using System; using BLL; namespace FineUIPro.Web.PublicInfo.BaseInfo { public partial class PipingClassDetailEdit : PageBase { #region 加载 /// /// 加载 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); BLL.Base_WeldTypeService.InitWeldTypeDropDownList(this.drpWeldTypeId,Resources.Lan.PleaseSelect,true);//焊缝类型 BLL.Base_DetectionTypeService.InitDetectionTypeDropDownList(this.drpDetectionTypeId, Resources.Lan.PleaseSelect, true, string.Empty);//探伤类型 BLL.Base_DetectionRateService.InitDetectionRateDropDownList(this.drpDetectionRateId,Resources.Lan.PleaseSelect, true);//探伤比例 string pipingClassDetailId = Request.Params["PipingClassDetailId"]; if (!string.IsNullOrEmpty(pipingClassDetailId)) { Model.View_Base_PipingClassDetail pipingClassDetail = BLL.Base_PipingClassDetailService.GetViewPipingClassDetailById(pipingClassDetailId); if (pipingClassDetail != null) { this.hdPipingClassId.Text = pipingClassDetail.PipingClassId; this.txtPipingClass.Text = pipingClassDetail.PipingClassName; if (!string.IsNullOrEmpty(pipingClassDetail.WeldTypeId)) { this.drpWeldTypeId.SelectedValue = pipingClassDetail.WeldTypeId; } if (!string.IsNullOrEmpty(pipingClassDetail.DetectionTypeId)) { this.drpDetectionTypeId.SelectedValue = pipingClassDetail.DetectionTypeId; } if (!string.IsNullOrEmpty(pipingClassDetail.DetectionRateId)) { this.drpDetectionRateId.SelectedValue = pipingClassDetail.DetectionRateId; } if (pipingClassDetail.SizeMin.HasValue) { this.txtSizeMin.Text = pipingClassDetail.SizeMin.ToString(); } if (pipingClassDetail.SizeMax.HasValue) { this.txtSizeMax.Text = pipingClassDetail.SizeMax.ToString(); } if (pipingClassDetail.ThicknessMin.HasValue) { this.txtThicknessMin.Text = pipingClassDetail.ThicknessMin.ToString(); } if (pipingClassDetail.ThicknessMax.HasValue) { this.txtThicknessMax.Text = pipingClassDetail.ThicknessMax.ToString(); } } } this.hdPipingClassId.Text = Request.Params["PipingClassId"]; if (!string.IsNullOrEmpty(this.hdPipingClassId.Text)) { this.txtPipingClass.Text = BLL.Base_PipingClassService.GetPipingClassByPipingClassId(this.hdPipingClassId.Text.Trim()).PipingClassCode; } } } #endregion #region 保存 /// /// 保存按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { if (Funs.GetNewDecimal(this.txtSizeMin.Text.Trim()) > Funs.GetNewDecimal(this.txtSizeMax.Text.Trim())) { Alert.ShowInTop(Resources.Lan.DiameterVerification, MessageBoxIcon.Warning); return; } if (Funs.GetNewDecimal(this.txtThicknessMin.Text.Trim()) > Funs.GetNewDecimal(this.txtThicknessMax.Text.Trim())) { Alert.ShowInTop(Resources.Lan.WallThicknessVerification, MessageBoxIcon.Warning); return; } string pipingClassDetailId = Request.Params["PipingClassDetailId"]; Model.Base_PipingClassDetail newPipingClassDetail = new Model.Base_PipingClassDetail(); newPipingClassDetail.PipingClassId = this.hdPipingClassId.Text; if (this.drpWeldTypeId.SelectedValue!=BLL.Const._Null) { newPipingClassDetail.WeldTypeId = this.drpWeldTypeId.SelectedValue; } if (this.drpDetectionTypeId.SelectedValue!=BLL.Const._Null) { newPipingClassDetail.DetectionTypeId = this.drpDetectionTypeId.SelectedValue; } if (this.drpDetectionRateId.SelectedValue!=BLL.Const._Null) { newPipingClassDetail.DetectionRateId = this.drpDetectionRateId.SelectedValue; } newPipingClassDetail.SizeMin = Funs.GetNewDecimal(this.txtSizeMin.Text.Trim()); newPipingClassDetail.SizeMax = Funs.GetNewDecimal(this.txtSizeMax.Text.Trim()); newPipingClassDetail.ThicknessMin = Funs.GetNewDecimal(this.txtThicknessMin.Text.Trim()); newPipingClassDetail.ThicknessMax = Funs.GetNewDecimal(this.txtThicknessMax.Text.Trim()); if (!string.IsNullOrEmpty(pipingClassDetailId)) { newPipingClassDetail.PipingClassDetailId = pipingClassDetailId; BLL.Base_PipingClassDetailService.UpdatePipingClassDetail(newPipingClassDetail); } else { newPipingClassDetail.PipingClassDetailId = SQLHelper.GetNewID(typeof(Model.Base_PipingClassDetail)); BLL.Base_PipingClassDetailService.AddPipingClassDetail(newPipingClassDetail); } ShowNotify(Resources.Lan.SaveSuccessfully, MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } #endregion } }