using BLL; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace FineUIPro.Web.JDGL.Check { public partial class UndergroundPipeCompletionEdit : PageBase { /// /// id /// public string UndergroundPipeCompletionId { get { return (string)ViewState["UndergroundPipeCompletionId"]; } set { ViewState["UndergroundPipeCompletionId"] = value; } } /// /// 项目id /// public string ProjectId { get { return (string)ViewState["ProjectId"]; } set { ViewState["ProjectId"] = value; } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); UndergroundPipeCompletionId = Request.Params["UndergroundPipeCompletionId"]; if (!string.IsNullOrEmpty(UndergroundPipeCompletionId)) { Model.JDGL_UndergroundPipeCompletion UndergroundPipeCompletion = BLL.UndergroundPipeCompletionService.GetUndergroundPipeCompletionById(UndergroundPipeCompletionId); if (UndergroundPipeCompletion != null) { this.ProjectId = UndergroundPipeCompletion.ProjectId; if (UndergroundPipeCompletion.ThisNum != null) { this.txtThisNum.Text = UndergroundPipeCompletion.ThisNum.ToString(); } } } } } protected void btnSave_Click(object sender, EventArgs e) { SaveData(true); } private void SaveData(bool bl) { string UndergroundPipeCompletionId = Request.Params["UndergroundPipeCompletionId"]; Model.JDGL_UndergroundPipeCompletion UndergroundPipeCompletion = new Model.JDGL_UndergroundPipeCompletion(); if (!string.IsNullOrEmpty(this.txtThisNum.Text.Trim())) { UndergroundPipeCompletion.ThisNum = Convert.ToDecimal(this.txtThisNum.Text.Trim()); } if (!string.IsNullOrEmpty(UndergroundPipeCompletionId)) { UndergroundPipeCompletion.UndergroundPipeCompletionId = UndergroundPipeCompletionId; BLL.UndergroundPipeCompletionService.UpdateUndergroundPipeCompletion(UndergroundPipeCompletion); } else { UndergroundPipeCompletion.UndergroundPipeCompletionId = SQLHelper.GetNewID(typeof(Model.JDGL_UndergroundPipeCompletion)); BLL.UndergroundPipeCompletionService.AddUndergroundPipeCompletion(UndergroundPipeCompletion); } ShowNotify("保存成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } } }