136 lines
5.7 KiB
C#
136 lines
5.7 KiB
C#
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
|
|
}
|
|
} |