using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using BLL; namespace FineUIPro.Web.ZHGL.TestRunPerformance { public partial class TestRunPerformanceStandardEdit : PageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string TestRunPerformanceStandardId = Request.Params["TestRunPerformanceStandardId"]; if (!string.IsNullOrEmpty(TestRunPerformanceStandardId)) { Model.Base_TestRunPerformanceStandard item = TestRunPerformanceStandardService.GetPerformanceStandardById(TestRunPerformanceStandardId); if (item != null) { this.txtCode.Text = item.Code; if (item.Code3 != null) { this.txtCode3.Text = item.Code3.ToString(); } this.txtType.Text = item.Type; this.txtItem.Text = item.Item; this.txtUnit.Text = item.Unit; if (item.Days != null) { this.txtDays.Text = item.Days.ToString(); } } } } } protected void btnSave_Click(object sender, EventArgs e) { if (!this.txtCode.Text.Contains(".")) { Alert.ShowInTop("编号格式不正确", MessageBoxIcon.Warning); return; } string TestRunPerformanceStandardId = Request.Params["TestRunPerformanceStandardId"]; Model.Base_TestRunPerformanceStandard newItem = new Model.Base_TestRunPerformanceStandard(); newItem.Code = this.txtCode.Text.Trim(); var strs = this.txtCode.Text.Trim().Split('.'); if (strs.Length == 2) { newItem.Code1 = Funs.GetNewInt(strs[0]); newItem.Code2 = Funs.GetNewInt(strs[1]); } newItem.Code3 = Funs.GetNewInt(this.txtCode3.Text.Trim()); newItem.Type = this.txtType.Text.Trim(); newItem.Item = this.txtItem.Text.Trim(); newItem.Unit = this.txtUnit.Text.Trim(); newItem.Days= Funs.GetNewInt(this.txtDays.Text.Trim()); if (string.IsNullOrEmpty(TestRunPerformanceStandardId)) { newItem.TestRunPerformanceStandardId = SQLHelper.GetNewID(); BLL.TestRunPerformanceStandardService.AddTestRunPerformanceStandard(newItem); BLL.LogService.AddSys_Log(this.CurrUser, newItem.Type, newItem.Item, BLL.Const.ControlItemInitSetMenuId, "增加试车绩效考核标准!"); } else { newItem.TestRunPerformanceStandardId = TestRunPerformanceStandardId; BLL.TestRunPerformanceStandardService.UpdateTestRunPerformanceStandard(newItem); BLL.LogService.AddSys_Log(this.CurrUser, newItem.Type, newItem.Item, BLL.Const.ControlItemInitSetMenuId, "修改试车绩效考核标准!"); } PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } } }