namespace FineUIPro.Web.HJGL.DataIn { using System; using System.Collections.Generic; using Model; public partial class DrawingRecognitionContentEdit : PageBase { #region 定义项 public int Index { get { return (int)ViewState["Index"]; } set { ViewState["Index"] = value; } } public string DataKey { get { return (string)ViewState["DataKey"]; } set { ViewState["DataKey"] = value; } } private List MaterialEntities { get { return Session[DataKey + DrawingRecognitionContent.MaterialSessionSuffix] as List; } } #endregion #region 加载页面 /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.Index = int.Parse(Request.Params["Index"]); this.DataKey = Request.Params["DataKey"]; var materialEntities = MaterialEntities; if (materialEntities == null || this.Index < 0 || this.Index >= materialEntities.Count) { Alert.ShowInTop("材料实体数据已失效,请关闭窗口后重新审核!", MessageBoxIcon.Warning); return; } var material = materialEntities[this.Index]; this.txtPipeNo.Text = material.Pipe_no; this.txtDrawingNumber.Text = material.Drawing_number; this.txtCategory.Text = material.Category; this.txtQty.Text = material.Qty; this.txtSpec.Text = material.Spec; this.txtPageNo.Text = Convert.ToString(material.Pipe_page_no); this.txtDescription.Text = material.Description; } } #endregion #region 提交按钮 /// /// 提交按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { var materialEntities = MaterialEntities; if (materialEntities == null || this.Index < 0 || this.Index >= materialEntities.Count) { Alert.ShowInTop("材料实体数据已失效,请关闭窗口后重新审核!", MessageBoxIcon.Warning); return; } if (!int.TryParse(this.txtPageNo.Text, out var pipePageNo)) { Alert.ShowInTop("管线页码必须为整数!", MessageBoxIcon.Warning); return; } var material = materialEntities[this.Index]; material.Pipe_no = this.txtPipeNo.Text; material.Drawing_number = this.txtDrawingNumber.Text; material.Category = this.txtCategory.Text; material.Qty = this.txtQty.Text; material.Spec = this.txtSpec.Text; material.Pipe_page_no = pipePageNo; material.Description = this.txtDescription.Text; Alert.ShowInTop("信息修改完成!", MessageBoxIcon.Success); if (ckAll.Checked) { PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(Index.ToString()) + ActiveWindow.GetHidePostBackReference()); } else { PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference("") + ActiveWindow.GetHidePostBackReference()); } } #endregion } }