107 lines
3.7 KiB
C#
107 lines
3.7 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.BaseInfo
|
|
{
|
|
public partial class CheckTemplateEdit : PageBase
|
|
{
|
|
#region
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
public string CheckTemplateID
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["CheckTemplateID"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["CheckTemplateID"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
////权限按钮方法
|
|
this.GetButtonPower();
|
|
this.CheckTemplateID = Request.Params["CheckTemplateID"];
|
|
if (!string.IsNullOrEmpty(this.ID))
|
|
{
|
|
var getData = BLL.CheckTemplateService.GetCheckTemplateById(this.CheckTemplateID);
|
|
if (getData != null)
|
|
{
|
|
this.txtSortIndex.Text = getData.SortIndex.ToString();
|
|
this.txtCheckItem.Text = getData.CheckItem;
|
|
this.txtCheckStandard.Text = getData.CheckStandard;
|
|
this.txtCheckMethod.Text = getData.CheckMethod;
|
|
this.txtBaseScore.Text = getData.BaseScore.ToString();
|
|
this.txtIndexs.Text = getData.Indexs.ToString();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.txtIndexs.Text= ((Funs.DB.ProjectSupervision_CheckTemplate.Max(x => x.Indexs) ?? 0) + 1).ToString();
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
Model.ProjectSupervision_CheckTemplate newCheckTemplate = new Model.ProjectSupervision_CheckTemplate
|
|
{
|
|
ID = this.CheckTemplateID,
|
|
SortIndex = Funs.GetNewInt( this.txtSortIndex.Text),
|
|
CheckItem = this.txtCheckItem.Text.Trim(),
|
|
CheckStandard = this.txtCheckStandard.Text.Trim(),
|
|
CheckMethod = this.txtCheckMethod.Text.Trim(),
|
|
BaseScore = Funs.GetNewDecimal(this.txtBaseScore.Text.Trim()),
|
|
Indexs = Funs.GetNewInt(this.txtIndexs.Text),
|
|
};
|
|
|
|
if (string.IsNullOrEmpty(this.CheckTemplateID))
|
|
{
|
|
newCheckTemplate.ID = SQLHelper.GetNewID();
|
|
BLL.CheckTemplateService.AddCheckTemplate(newCheckTemplate);
|
|
|
|
}
|
|
else
|
|
{
|
|
newCheckTemplate.ID = this.CheckTemplateID;
|
|
BLL.CheckTemplateService.UpdateCheckTemplate(newCheckTemplate);
|
|
}
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
}
|
|
|
|
#region 获取按钮权限
|
|
/// <summary>
|
|
/// 获取按钮权限
|
|
/// </summary>
|
|
/// <param name="button"></param>
|
|
/// <returns></returns>
|
|
private void GetButtonPower()
|
|
{
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.CheckTemplateMenuId);
|
|
if (buttonList.Count() > 0)
|
|
{
|
|
if (buttonList.Contains(BLL.Const.BtnSave))
|
|
{
|
|
this.btnSave.Hidden = false;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
} |