不符合项清单基础数据字典(安全问题分类、性质;质量问题分类、性质)
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using BLL;
|
||||
|
||||
namespace FineUIPro.Web.BaseInfo
|
||||
{
|
||||
public partial class QualityProblemNatureSave : PageBase
|
||||
{
|
||||
#region 定义变量
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public string NatureId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["NatureId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["NatureId"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 加载
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.GetButtonPower();
|
||||
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
|
||||
this.NatureId = Request.QueryString["NatureId"];
|
||||
if (!string.IsNullOrEmpty(NatureId))
|
||||
{
|
||||
var q = BLL.QualityProblemNatureService.GetNatureById(NatureId);
|
||||
if (q != null)
|
||||
{
|
||||
this.txtNatureCode.Text = q.NatureCode;
|
||||
this.txtNatureName.Text = q.NatureName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
var obj = Funs.DB.Base_QualityProblemNature.FirstOrDefault(x => x.NatureCode == this.txtNatureCode.Text.Trim() && x.NatureId != this.NatureId);
|
||||
if (obj != null)
|
||||
{
|
||||
ShowNotify("输入的编号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
obj = Funs.DB.Base_QualityProblemNature.FirstOrDefault(x => x.NatureName == this.txtNatureName.Text.Trim() && x.NatureId != this.NatureId);
|
||||
if (obj != null)
|
||||
{
|
||||
ShowNotify("输入的名称已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Model.Base_QualityProblemNature model = new Model.Base_QualityProblemNature();
|
||||
model.NatureCode = this.txtNatureCode.Text.Trim();
|
||||
model.NatureName = this.txtNatureName.Text.Trim();
|
||||
if (!string.IsNullOrEmpty(this.NatureId))
|
||||
{
|
||||
model.NatureId = this.NatureId;
|
||||
BLL.QualityProblemNatureService.UpdateNature(model);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.NatureId = SQLHelper.GetNewID(typeof(Model.Base_QualityProblemNature));
|
||||
model.NatureId = this.NatureId;
|
||||
BLL.QualityProblemNatureService.AddNature(model);
|
||||
}
|
||||
// 2. 关闭本窗体,然后刷新父窗体
|
||||
// PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||||
// 2. 关闭本窗体,然后回发父窗体
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
//PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(trainingId) + ActiveWindow.GetHideReference());
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 验证安全问题性质名称是否存在
|
||||
/// <summary>
|
||||
/// 验证安全问题性质名称是否存在
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void TextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
var model = Funs.DB.Base_QualityProblemNature.FirstOrDefault(x => x.NatureName == this.txtNatureName.Text.Trim() && (x.NatureId != this.NatureId || this.NatureId == null));
|
||||
if (model != null)
|
||||
{
|
||||
ShowNotify("输入的名称已存在!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 按钮权限
|
||||
/// <summary>
|
||||
/// 获取按钮权限
|
||||
/// </summary>
|
||||
/// <param name="button"></param>
|
||||
/// <returns></returns>
|
||||
private void GetButtonPower()
|
||||
{
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.QualityProblemNatureMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnSave))
|
||||
{
|
||||
this.btnSave.Hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user