76 lines
3.0 KiB
C#
76 lines
3.0 KiB
C#
|
using BLL;
|
|||
|
using System;
|
|||
|
using System.Linq;
|
|||
|
|
|||
|
namespace FineUIPro.Web.PublicInfo.BaseInfo
|
|||
|
{
|
|||
|
public partial class TestStandardEdit : PageBase
|
|||
|
{
|
|||
|
#region 加载
|
|||
|
/// <summary>
|
|||
|
/// 加载页面
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
this.txtTestStandardName.Focus();
|
|||
|
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|||
|
|
|||
|
string testStandardId = Request.Params["testStandardId"];
|
|||
|
if (!string.IsNullOrEmpty(testStandardId))
|
|||
|
{
|
|||
|
Model.Base_TestStandard testStandard = BLL.Base_TestStandardService.GetTestStandardById(testStandardId);
|
|||
|
if (testStandard != null)
|
|||
|
{
|
|||
|
this.txtTestStandardName.Text = testStandard.TestStandardName;
|
|||
|
this.txtRemark.Text = testStandard.Remark;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 保存
|
|||
|
/// <summary>
|
|||
|
/// 保存按钮
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnSave_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
string testStandardId = Request.Params["testStandardId"];
|
|||
|
var q = Funs.DB.Base_TestStandard.FirstOrDefault(x => x.TestStandardName == this.txtTestStandardName.Text.Trim() && (x.TestStandardId != testStandardId || (testStandardId == null && x.TestStandardId != null)));
|
|||
|
if (q != null)
|
|||
|
{
|
|||
|
Alert.ShowInTop("检测标准已存在!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
Model.Base_TestStandard newTestStandard = new Model.Base_TestStandard
|
|||
|
{
|
|||
|
TestStandardName = this.txtTestStandardName.Text.Trim(),
|
|||
|
Remark = this.txtRemark.Text.Trim()
|
|||
|
};
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(testStandardId))
|
|||
|
{
|
|||
|
newTestStandard.TestStandardId = testStandardId;
|
|||
|
BLL.Base_TestStandardService.UpdateTestStandard(newTestStandard);
|
|||
|
BLL.Sys_LogService.AddLog(Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_TestStandardMenuId, Const.BtnModify, testStandardId);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
newTestStandard.TestStandardId = SQLHelper.GetNewID(typeof(Model.Base_TestStandard)); ;
|
|||
|
BLL.Base_TestStandardService.AddTestStandard(newTestStandard);
|
|||
|
BLL.Sys_LogService.AddLog(Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_TestStandardMenuId, Const.BtnAdd, testStandardId);
|
|||
|
}
|
|||
|
|
|||
|
ShowNotify(Resources.Lan.SaveSuccessfully, MessageBoxIcon.Success);
|
|||
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|