using System; using BLL; namespace FineUIPro.Web.HJGLServer.BaseInfo { public partial class HotProcessCardEdit : PageBase { #region 定义项 /// /// 测温点布置示意图 /// public string CewendianshcAttachUrl { get { return (string)ViewState["CewendianshcAttachUrl"]; } set { ViewState["CewendianshcAttachUrl"] = value; } } /// /// 理论焊后热处理曲线 /// public string LilunhanhouAttachUrl { get { return (string)ViewState["LilunhanhouAttachUrl"]; } set { ViewState["LilunhanhouAttachUrl"] = value; } } #endregion #region 加载 /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.drpguandaocz.DataValueField = "STE_ID"; this.drpguandaocz.DataTextField = "STE_Name"; this.drpguandaocz.DataSource = BLL.HJGL_MaterialService.GetSteelList(); this.drpguandaocz.DataBind(); Funs.FineUIPleaseSelect(this.drpguandaocz); string hotProcessCardId = Request.Params["HotProcessCardId"]; if (!string.IsNullOrEmpty(hotProcessCardId)) { Model.HJGL_Base_HotProcessCard hotProcessCard = BLL.HJGL_HotProcessCardService.GetHotProcessCardById(hotProcessCardId); if (hotProcessCard != null) { this.txtshejiwj.Text = hotProcessCard.Shejiwj; if (!string.IsNullOrEmpty(hotProcessCard.Guandaocz)) { this.drpguandaocz.SelectedValue = hotProcessCard.Guandaocz; } this.txtguandaogg.Text = hotProcessCard.Guandaogg; this.txtjietouxs.Text = hotProcessCard.Jietouxs; this.txtyijuhanpin.Text = hotProcessCard.Yijuhanpin; this.txtkzxtxh.Text = hotProcessCard.Kzxtxh; this.txtjiareqixh.Text = hotProcessCard.Jiareqixh; this.txtcewenyq.Text = hotProcessCard.Cewenyq; this.txtbuchangdx.Text = hotProcessCard.Buchangdx; this.txtjiaredaigd.Text = hotProcessCard.Jiaredaigd; this.txtbwkuandu.Text = hotProcessCard.Bwkuandu; this.txtbwcailao.Text = hotProcessCard.Bwcailao; this.txtbwdianshu.Text = hotProcessCard.Bwdianshu; if (!string.IsNullOrEmpty(hotProcessCard.Hanhouchl)) { var a = hotProcessCard.Hanhouchl.Split(','); this.cblhanhouchl.SelectedValueArray = a; } this.txtjiaresd.Text = hotProcessCard.Jiaresd; this.txtbwwendu.Text = hotProcessCard.Bwwendu; this.txtbwshijian.Text = hotProcessCard.Bwshijian; this.txtlenquesd.Text = hotProcessCard.Lenquesd; this.txtewailq.Text = hotProcessCard.Ewailq; this.txtqishuyq.Text = hotProcessCard.Qishuyq; if (!string.IsNullOrEmpty(hotProcessCard.Cewendianshc)) { this.CewendianshcAttachUrl = hotProcessCard.Cewendianshc; this.imgCewendianshc.ImageUrl = "~/" + this.CewendianshcAttachUrl; } if (!string.IsNullOrEmpty(hotProcessCard.Lilunhanhou)) { this.LilunhanhouAttachUrl = hotProcessCard.Lilunhanhou; this.imgLilunhanhou.ImageUrl = "~/" + this.LilunhanhouAttachUrl; } } } } } #endregion #region 提交 /// /// 提交按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { SaveData(); Alert.ShowInTop("提交成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); } /// /// 提交数据 /// private void SaveData() { string hotProcessCardId = Request.Params["HotProcessCardId"]; Model.HJGL_Base_HotProcessCard hotProcessCard = new Model.HJGL_Base_HotProcessCard(); hotProcessCard.Shejiwj = this.txtshejiwj.Text.Trim(); if (this.drpguandaocz.SelectedValue != BLL.Const._Null) { hotProcessCard.Guandaocz = this.drpguandaocz.SelectedValue; } hotProcessCard.Guandaogg = this.txtguandaogg.Text.Trim(); hotProcessCard.Jietouxs = this.txtjietouxs.Text.Trim(); hotProcessCard.Yijuhanpin = this.txtyijuhanpin.Text.Trim(); hotProcessCard.Kzxtxh = this.txtkzxtxh.Text.Trim(); hotProcessCard.Jiareqixh = this.txtjiareqixh.Text.Trim(); hotProcessCard.Cewenyq = this.txtcewenyq.Text.Trim(); hotProcessCard.Buchangdx = this.txtbuchangdx.Text.Trim(); hotProcessCard.Jiaredaigd = this.txtjiaredaigd.Text.Trim(); hotProcessCard.Bwkuandu = this.txtbwkuandu.Text.Trim(); hotProcessCard.Bwcailao = this.txtbwcailao.Text.Trim(); hotProcessCard.Bwdianshu = this.txtbwdianshu.Text.Trim(); var h = string.Empty; var hanhouchls = this.cblhanhouchl.SelectedValueArray;//焊后热处理类型 foreach (var item in hanhouchls) { h += item + ","; } if (!string.IsNullOrEmpty(h)) { hotProcessCard.Hanhouchl = h.Substring(0, h.LastIndexOf(',')); } hotProcessCard.Jiaresd = this.txtjiaresd.Text.Trim(); hotProcessCard.Bwwendu = this.txtbwwendu.Text.Trim(); hotProcessCard.Bwshijian = this.txtbwshijian.Text.Trim(); hotProcessCard.Lenquesd = this.txtlenquesd.Text.Trim(); hotProcessCard.Ewailq = this.txtewailq.Text.Trim(); hotProcessCard.Cewendianshc = this.CewendianshcAttachUrl;//测温点布置示意图(附件) hotProcessCard.Lilunhanhou = this.LilunhanhouAttachUrl;//理论焊后热处理曲线:(附件) hotProcessCard.Qishuyq = this.txtqishuyq.Text.Trim(); if (!string.IsNullOrEmpty(hotProcessCardId)) { hotProcessCard.HpcId = hotProcessCardId; BLL.HJGL_HotProcessCardService.UpdateHotProcessCard(hotProcessCard); BLL.Sys_LogService.AddLog(BLL.Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "修改热处理工艺卡目录"); } else { hotProcessCardId = SQLHelper.GetNewID(typeof(Model.HJGL_Base_HotProcessCard)); hotProcessCard.HpcId = hotProcessCardId; BLL.HJGL_HotProcessCardService.AddHotProcessCard(hotProcessCard); BLL.Sys_LogService.AddLog(BLL.Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加热处理工艺卡目录"); } } #endregion #region 附件上传 /// /// 测温点布置示意图 /// /// /// protected void FileUpload1_Click(object sender, EventArgs e) { if (FileUpload1.HasFile) { string fileName = FileUpload1.ShortFileName; if (!ValidateFileType(fileName)) { ShowNotify("无效的文件类型!", MessageBoxIcon.Warning); return; } this.CewendianshcAttachUrl = BLL.UploadFileService.UploadAttachment(BLL.Funs.RootPath, this.FileUpload1, this.CewendianshcAttachUrl, UploadFileService.CewendianshcFilePath); this.imgCewendianshc.ImageUrl = "~/" + this.CewendianshcAttachUrl; } } /// /// 理论焊后热处理曲线 /// /// /// protected void FileUpload2_Click(object sender, EventArgs e) { if (FileUpload2.HasFile) { string fileName = FileUpload2.ShortFileName; if (!ValidateFileType(fileName)) { ShowNotify("无效的文件类型!", MessageBoxIcon.Warning); return; } this.LilunhanhouAttachUrl = BLL.UploadFileService.UploadAttachment(BLL.Funs.RootPath, this.FileUpload2, this.LilunhanhouAttachUrl, UploadFileService.LilunhanhouFilePath); this.imgLilunhanhou.ImageUrl = "~/" + this.LilunhanhouAttachUrl; } } #endregion } }