11
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ViolationClause.aspx.cs" Inherits="FineUIPro.Web.BaseInfo.ViolationClause" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title>Violation Clause</title>
|
||||
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
|
||||
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
|
||||
ShowHeader="false" Layout="Region" BoxConfigAlign="Stretch">
|
||||
<Items>
|
||||
<f:Panel runat="server" ID="panelLeftRegion" RegionPosition="Left" RegionSplit="true"
|
||||
EnableCollapse="true" Width="220px" Title="FO" ShowBorder="true" Layout="VBox"
|
||||
ShowHeader="false" AutoScroll="true" BodyPadding="5px" IconFont="ArrowCircleLeft">
|
||||
<Items>
|
||||
<f:Tree ID="tvViolationClause" ShowHeader="false" OnNodeCommand="tvViolationClause_NodeCommand" runat="server"
|
||||
ShowBorder="false" EnableCollapse="true" EnableSingleClickExpand="true"
|
||||
AutoLeafIdentification="true" EnableSingleExpand="true" EnableTextSelection="true">
|
||||
</f:Tree>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
<f:Panel runat="server" ID="panelCenterRegion" RegionPosition="Center" ShowBorder="true"
|
||||
Layout="VBox" ShowHeader="false" BodyPadding="5px" IconFont="PlusCircle" Title="Files Management"
|
||||
TitleToolTip="Role Authorization" AutoScroll="true">
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="Violation Clause" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="ViolationClauseId" AllowCellEditing="true" EnableColumnLines="true"
|
||||
ClicksToEdit="2" DataIDField="ViolationClauseId" AllowSorting="true" SortField="SortIndex"
|
||||
SortDirection="ASC" OnSort="Grid1_Sort"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" runat="server">
|
||||
<Items>
|
||||
<f:Button ID="btnNew" ToolTip="Add" Icon="Add" Text="Add" OnClick="btnAdd_Click" runat="server">
|
||||
</f:Button>
|
||||
<f:Button ID="btnEdit" ToolTip="Modify" Text="Modify" Icon="Pencil" runat="server" OnClick="btnEdit_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnDelete" ToolTip="Delete" Text="Delete" Icon="Delete" ConfirmText="Make sure to delete the current data?" OnClick="btnDelete_Click"
|
||||
runat="server">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Columns>
|
||||
<f:RenderField Width="350px" ColumnID="ClauseDef" DataField="ClauseDef"
|
||||
SortField="ClauseDef" FieldType="String" HeaderText="违章条款描述" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="150px" ColumnID="DeductionComPany1" DataField="DeductionComPany1"
|
||||
FieldType="String" HeaderText="一般违章(公司)" HeaderTextAlign="Center" TextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="150px" ColumnID="DeductionIndividual1" DataField="DeductionIndividual1"
|
||||
FieldType="String" HeaderText="一般违章(个人)" HeaderTextAlign="Center" TextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="150px" ColumnID="DeductionComPany2" DataField="DeductionComPany2"
|
||||
FieldType="String" HeaderText="严重违章(公司)" HeaderTextAlign="Center" TextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="150px" ColumnID="DeductionIndividual2" DataField="DeductionIndividual2"
|
||||
FieldType="String" HeaderText="严重违章(个人)" HeaderTextAlign="Center" TextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="150px" ColumnID="DeductionComPany3" DataField="DeductionComPany3"
|
||||
FieldType="String" HeaderText="零容忍(公司)" HeaderTextAlign="Center" TextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="150px" ColumnID="DeductionIndividual3" DataField="DeductionIndividual3"
|
||||
FieldType="String" HeaderText="零容忍(个人)" HeaderTextAlign="Center" TextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="350px" ColumnID="ApplicationDef" DataField="ApplicationDef"
|
||||
FieldType="String" HeaderText="示例应用场景" HeaderTextAlign="Center" TextAlign="Center">
|
||||
</f:RenderField>
|
||||
</Columns>
|
||||
<Listeners>
|
||||
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
|
||||
</Listeners>
|
||||
</f:Grid>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
<f:Window ID="Window1" Title="Pop-up window" Hidden="true" EnableIFrame="true" EnableMaximize="true"
|
||||
Target="Self" EnableResize="true" runat="server" OnClose="Window1_Close" IsModal="true"
|
||||
Width="900px" Height="600px">
|
||||
</f:Window>
|
||||
<f:Menu ID="Menu1" runat="server">
|
||||
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true"
|
||||
Icon="BulletEdit" runat="server" Text="Modify">
|
||||
</f:MenuButton>
|
||||
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true"
|
||||
Icon="Delete" ConfirmText="Delete selected row?" ConfirmTarget="Top" runat="server" Text="Delete">
|
||||
</f:MenuButton>
|
||||
</f:Menu>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
var menuID = '<%= Menu1.ClientID %>';
|
||||
// 返回false,来阻止浏览器右键菜单
|
||||
function onRowContextMenu(event, rowId) {
|
||||
F(menuID).show(); //showAt(event.pageX, event.pageY);
|
||||
return false;
|
||||
}
|
||||
|
||||
function reloadGrid() {
|
||||
__doPostBack(null, 'reloadGrid');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,275 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.BaseInfo
|
||||
{
|
||||
public partial class ViolationClause : PageBase
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
GetButtonPower();//权限设置
|
||||
btnDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("Please select at least one item!");
|
||||
btnDelete.ConfirmText = String.Format("Are you sure you want to delete the selected <b><script>{0}</script></b> rows?", Grid1.GetSelectedCountReference());
|
||||
InitTreeMenu();
|
||||
// 绑定表格
|
||||
//BindGrid();
|
||||
}
|
||||
}
|
||||
|
||||
#region 加载树
|
||||
private void InitTreeMenu()
|
||||
{
|
||||
this.tvViolationClause.Nodes.Clear();
|
||||
TreeNode rootRole = new TreeNode();
|
||||
rootRole.Text = "违章条款";
|
||||
rootRole.NodeID = "0";
|
||||
rootRole.Expanded = true;
|
||||
this.tvViolationClause.Nodes.Add(rootRole);
|
||||
BoundTree(rootRole.Nodes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 遍历节点
|
||||
/// </summary>
|
||||
/// <param name="nodes"></param>
|
||||
/// <param name="parentId"></param>
|
||||
/// <param name="type"></param>
|
||||
private void BoundTree(TreeNodeCollection nodes)
|
||||
{
|
||||
List<Model.EMC_ViolationClause> supVio = BLL.ViolationClauseService.GetSupViolationClause();
|
||||
|
||||
if (supVio.Count() > 0)
|
||||
{
|
||||
TreeNode tn = null;
|
||||
foreach (var q in supVio)
|
||||
{
|
||||
tn = new TreeNode();
|
||||
tn.Text = q.ClauseDef;
|
||||
tn.NodeID = q.ViolationClauseId;
|
||||
tn.EnableClickEvent = true;
|
||||
nodes.Add(tn);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Tree点击事件
|
||||
/// <summary>
|
||||
/// 选择角色事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void tvViolationClause_NodeCommand(object sender, TreeCommandEventArgs e)
|
||||
{
|
||||
this.BindGrid(this.tvViolationClause.SelectedNodeID);
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void BindGrid(string supViolationClauseId)
|
||||
{
|
||||
string strSql = @"SELECT ViolationClauseId,ClauseDef,ApplicationDef,
|
||||
(CASE WHEN (DeductionIndividual1=0 OR DeductionIndividual1 IS NULL) THEN 'N/A' ELSE CAST(CAST(DeductionIndividual1 AS REAL) AS VARCHAR) END) AS DeductionIndividual1,
|
||||
(CASE WHEN (DeductionComPany1=0 OR DeductionComPany1 IS NULL) THEN 'N/A' ELSE CAST(CAST(DeductionComPany1 AS REAL) AS VARCHAR) END) AS DeductionComPany1,
|
||||
(CASE WHEN (DeductionIndividual2=0 OR DeductionIndividual2 IS NULL) THEN 'N/A' ELSE CAST(CAST(DeductionIndividual2 AS REAL) AS VARCHAR) END) AS DeductionIndividual2,
|
||||
(CASE WHEN (DeductionComPany2=0 OR DeductionComPany2 IS NULL) THEN 'N/A' ELSE CAST(CAST(DeductionComPany2 AS REAL) AS VARCHAR) END) AS DeductionComPany2,
|
||||
(CASE WHEN (DeductionIndividual3=0 OR DeductionIndividual3 IS NULL) THEN 'N/A' ELSE CAST(CAST(DeductionIndividual3 AS REAL) AS VARCHAR) END) AS DeductionIndividual3,
|
||||
(CASE WHEN (DeductionComPany3=0 OR DeductionComPany3 IS NULL) THEN 'N/A' ELSE CAST(CAST(DeductionComPany3 AS REAL) AS VARCHAR) END) AS DeductionComPany3
|
||||
FROM dbo.EMC_ViolationClause
|
||||
WHERE SupViolationClause=@SupViolationClause
|
||||
ORDER BY SortIndex";
|
||||
List<SqlParameter> parms = new List<SqlParameter>();
|
||||
parms.Add(new SqlParameter("@SupViolationClause", supViolationClauseId));
|
||||
SqlParameter[] parameter = parms.ToArray();
|
||||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
// 2.获取当前分页数据
|
||||
Grid1.DataSource = dt;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
#region 编辑
|
||||
|
||||
protected void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (tvViolationClause.SelectedNodeID=="" || tvViolationClause.SelectedNodeID =="0")
|
||||
{
|
||||
Alert.ShowInParent("Please select Tree Node!");
|
||||
return;
|
||||
}
|
||||
string Id = tvViolationClause.SelectedNodeID;
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ViolationClauseEdit.aspx?supViolationClauseId={0}", Id, "编辑 - ")));
|
||||
}
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInParent("Please select at least one record!");
|
||||
return;
|
||||
}
|
||||
string Id = Grid1.SelectedRowID;
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ViolationClauseEdit.aspx?violationClauseId={0}", Id, "编辑 - ")));
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 右键编辑事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnEdit_Click(null, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Grid行双击事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
||||
{
|
||||
btnEdit_Click(null, null);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除数据
|
||||
/// <summary>
|
||||
/// 批量删除数据
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.DeleteData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 右键删除事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.DeleteData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除方法
|
||||
/// </summary>
|
||||
private void DeleteData()
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length > 0)
|
||||
{
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
var role = BLL.ViolationClauseService.GetViolationClause(rowID);
|
||||
if (role != null)
|
||||
{
|
||||
if (judgementDelete(rowID, false))
|
||||
{
|
||||
BLL.ViolationClauseService.DeleteViolationClause(rowID);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.BindGrid(this.tvViolationClause.SelectedNodeID);
|
||||
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "Delete Violation Clause");
|
||||
ShowNotify("Deleted successfully!");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 关闭弹出窗口
|
||||
/// <summary>
|
||||
/// 关闭窗口
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Window1_Close(object sender, EventArgs e)
|
||||
{
|
||||
this.BindGrid(this.tvViolationClause.SelectedNodeID);
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
||||
{
|
||||
Grid1.SortDirection = e.SortDirection;
|
||||
Grid1.SortField = e.SortField;
|
||||
this.BindGrid(this.tvViolationClause.SelectedNodeID);
|
||||
}
|
||||
|
||||
|
||||
#region 判断是否可删除
|
||||
/// <summary>
|
||||
/// 判断是否可以删除
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private bool judgementDelete(string id, bool isShow)
|
||||
{
|
||||
string content = string.Empty;
|
||||
if (Funs.DB.EMC_Punishment.FirstOrDefault(x => x.ViolationClauseId == id) != null)
|
||||
{
|
||||
content = "This role is already in use in [违章条款] and cannot be deleted!";
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(content))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isShow)
|
||||
{
|
||||
Alert.ShowInTop(content);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 权限设置
|
||||
/// <summary>
|
||||
/// 菜单按钮权限
|
||||
/// </summary>
|
||||
private void GetButtonPower()
|
||||
{
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.UserId, BLL.Const.ViolationClauseMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnAdd))
|
||||
{
|
||||
this.btnNew.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnModify))
|
||||
{
|
||||
this.btnEdit.Hidden = false;
|
||||
this.btnMenuEdit.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnDelete))
|
||||
{
|
||||
this.btnDelete.Hidden = false;
|
||||
this.btnMenuDelete.Hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.BaseInfo
|
||||
{
|
||||
|
||||
|
||||
public partial class ViolationClause
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// Panel1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel1;
|
||||
|
||||
/// <summary>
|
||||
/// panelLeftRegion 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel panelLeftRegion;
|
||||
|
||||
/// <summary>
|
||||
/// tvViolationClause 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Tree tvViolationClause;
|
||||
|
||||
/// <summary>
|
||||
/// panelCenterRegion 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel panelCenterRegion;
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar2;
|
||||
|
||||
/// <summary>
|
||||
/// btnNew 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnNew;
|
||||
|
||||
/// <summary>
|
||||
/// btnEdit 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnEdit;
|
||||
|
||||
/// <summary>
|
||||
/// btnDelete 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnDelete;
|
||||
|
||||
/// <summary>
|
||||
/// Window1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window1;
|
||||
|
||||
/// <summary>
|
||||
/// Menu1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Menu Menu1;
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuEdit 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.MenuButton btnMenuEdit;
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuDelete 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.MenuButton btnMenuDelete;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ViolationClauseEdit.aspx.cs" Inherits="FineUIPro.Web.BaseInfo.ViolationClauseEdit" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title>编辑违章条款</title>
|
||||
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" />
|
||||
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
|
||||
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
|
||||
<Rows>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextBox ID="txtClauseDef" runat="server" Label="违章条款描述" LabelWidth="150px" Required="true" ShowRedStar="true">
|
||||
</f:TextBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:NumberBox ID="numDeductionIndividual1" runat="server" Label="一般违章(公司)" LabelWidth="150px" NoDecimal="true"></f:NumberBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:NumberBox ID="numDeductionComPany1" runat="server" Label="一般违章(个人)" LabelWidth="150px" NoDecimal="true"></f:NumberBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:NumberBox ID="numDeductionIndividual2" runat="server" Label="严重违章(公司)" LabelWidth="150px" NoDecimal="true"></f:NumberBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:NumberBox ID="numDeductionComPany2" runat="server" Label="严重违章(个人)" LabelWidth="150px" NoDecimal="true"></f:NumberBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:NumberBox ID="numDeductionIndividual3" runat="server" Label="零容忍(公司)" LabelWidth="150px" NoDecimal="true"></f:NumberBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:NumberBox ID="numDeductionComPany3" runat="server" Label="零容忍(个人)" LabelWidth="150px" NoDecimal="true"></f:NumberBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:NumberBox ID="numSortIndex" runat="server" Label="排序号" LabelWidth="150px" NoDecimal="true"></f:NumberBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextArea ID="txtApplicationDef" runat="server" Label="示例应用场景" LabelWidth="150px"></f:TextArea>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
</Rows>
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
|
||||
<Items>
|
||||
<f:Button ID="btnSave" Icon="SystemSave" runat="server" Text="Save" ToolTip="Save" ValidateForms="SimpleForm1"
|
||||
OnClick="btnSave_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnClose" EnablePostBack="false" ToolTip="Close" Text="Close" runat="server" Icon="SystemClose">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
</f:Form>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,136 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.BaseInfo
|
||||
{
|
||||
public partial class ViolationClauseEdit : PageBase
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
GetButtonPower();//按钮权限
|
||||
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
string violationClauseId = Request.Params["violationClauseId"];
|
||||
|
||||
if (!string.IsNullOrEmpty(violationClauseId))
|
||||
{
|
||||
var vio = BLL.ViolationClauseService.GetViolationClause(violationClauseId);
|
||||
if (vio != null)
|
||||
{
|
||||
this.txtClauseDef.Text = vio.ClauseDef;
|
||||
this.txtApplicationDef.Text = vio.ApplicationDef;
|
||||
if (vio.DeductionIndividual1 != null && vio.DeductionIndividual1 != 0)
|
||||
{
|
||||
numDeductionIndividual1.Text = vio.DeductionIndividual1.ToString();
|
||||
}
|
||||
if (vio.DeductionComPany1 != null && vio.DeductionComPany1 != 0)
|
||||
{
|
||||
numDeductionComPany1.Text = vio.DeductionComPany1.ToString();
|
||||
}
|
||||
if (vio.DeductionIndividual2 != null && vio.DeductionIndividual2 != 0)
|
||||
{
|
||||
numDeductionIndividual2.Text = vio.DeductionIndividual2.ToString();
|
||||
}
|
||||
if (vio.DeductionComPany2 != null && vio.DeductionComPany2 != 0)
|
||||
{
|
||||
numDeductionComPany2.Text = vio.DeductionComPany2.ToString();
|
||||
}
|
||||
if (vio.DeductionIndividual3 != null && vio.DeductionIndividual3 != 0)
|
||||
{
|
||||
numDeductionIndividual3.Text = vio.DeductionIndividual3.ToString();
|
||||
}
|
||||
if (vio.DeductionComPany3 != null && vio.DeductionComPany3 != 0)
|
||||
{
|
||||
numDeductionComPany3.Text = vio.DeductionComPany3.ToString();
|
||||
}
|
||||
if (vio.SortIndex != null)
|
||||
{
|
||||
numSortIndex.Text = vio.SortIndex.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
string violationClauseId = Request.Params["violationClauseId"];
|
||||
string supViolationClauseId = Request.Params["supViolationClauseId"];
|
||||
Model.EMC_ViolationClause vio = new Model.EMC_ViolationClause();
|
||||
vio.ClauseDef = txtClauseDef.Text.Trim();
|
||||
vio.ApplicationDef = txtApplicationDef.Text.Trim();
|
||||
if (!string.IsNullOrEmpty(numDeductionIndividual1.Text))
|
||||
{
|
||||
vio.DeductionIndividual1 = Convert.ToDecimal(numDeductionIndividual1.Text);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(numDeductionComPany1.Text))
|
||||
{
|
||||
vio.DeductionComPany1 = Convert.ToDecimal(numDeductionComPany1.Text);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(numDeductionIndividual2.Text))
|
||||
{
|
||||
vio.DeductionIndividual2 = Convert.ToDecimal(numDeductionIndividual2.Text);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(numDeductionComPany2.Text))
|
||||
{
|
||||
vio.DeductionComPany2 = Convert.ToDecimal(numDeductionComPany2.Text);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(numDeductionIndividual3.Text))
|
||||
{
|
||||
vio.DeductionIndividual3 = Convert.ToDecimal(numDeductionIndividual3.Text);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(numDeductionComPany3.Text))
|
||||
{
|
||||
vio.DeductionComPany3 = Convert.ToDecimal(numDeductionComPany3.Text);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(numSortIndex.Text))
|
||||
{
|
||||
vio.SortIndex = Convert.ToInt32(numSortIndex.Text);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(violationClauseId))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(supViolationClauseId))
|
||||
{
|
||||
string newKeyID = SQLHelper.GetNewID(typeof(Model.EMC_ViolationClause));
|
||||
vio.ViolationClauseId = newKeyID;
|
||||
vio.SupViolationClause = supViolationClauseId;
|
||||
BLL.ViolationClauseService.AddViolationClause(vio);
|
||||
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "Add Violation Clause!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vio.ViolationClauseId = violationClauseId;
|
||||
BLL.ViolationClauseService.UpdateViolationClause(vio);
|
||||
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "Modify Violation Clause!");
|
||||
}
|
||||
ShowNotify("Save successfully!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
|
||||
#region 权限设置
|
||||
/// <summary>
|
||||
/// 菜单按钮权限
|
||||
/// </summary>
|
||||
private void GetButtonPower()
|
||||
{
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.UserId, BLL.Const.ViolationClauseMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnSave))
|
||||
{
|
||||
this.btnSave.Hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.BaseInfo
|
||||
{
|
||||
|
||||
|
||||
public partial class ViolationClauseEdit
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// SimpleForm1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Form SimpleForm1;
|
||||
|
||||
/// <summary>
|
||||
/// txtClauseDef 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtClauseDef;
|
||||
|
||||
/// <summary>
|
||||
/// numDeductionIndividual1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox numDeductionIndividual1;
|
||||
|
||||
/// <summary>
|
||||
/// numDeductionComPany1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox numDeductionComPany1;
|
||||
|
||||
/// <summary>
|
||||
/// numDeductionIndividual2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox numDeductionIndividual2;
|
||||
|
||||
/// <summary>
|
||||
/// numDeductionComPany2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox numDeductionComPany2;
|
||||
|
||||
/// <summary>
|
||||
/// numDeductionIndividual3 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox numDeductionIndividual3;
|
||||
|
||||
/// <summary>
|
||||
/// numDeductionComPany3 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox numDeductionComPany3;
|
||||
|
||||
/// <summary>
|
||||
/// numSortIndex 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox numSortIndex;
|
||||
|
||||
/// <summary>
|
||||
/// txtApplicationDef 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextArea txtApplicationDef;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
|
||||
/// <summary>
|
||||
/// btnClose 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnClose;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user