149 lines
		
	
	
		
			7.4 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			149 lines
		
	
	
		
			7.4 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | 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.CQMS.DataBase | |||
|  | { | |||
|  |     public partial class ConstructionStandardListProjectEdit : PageBase | |||
|  |     { | |||
|  |         #region 加载 | |||
|  |         /// <summary> | |||
|  |         /// 加载页面 | |||
|  |         /// </summary> | |||
|  |         /// <param name="sender"></param> | |||
|  |         /// <param name="e"></param> | |||
|  |         protected void Page_Load(object sender, EventArgs e) | |||
|  |         { | |||
|  |             if (!IsPostBack) | |||
|  |             { | |||
|  |                 BLL.ConstValue.InitConstNameDropDownList(this.drpStandardType, ConstValue.GroupId_StandardType, false); | |||
|  |                 BLL.ConstValue.InitConstNameDropDownList(this.drpStatus, ConstValue.GroupId_StandardStatus, false); | |||
|  |                 BLL.ConstValue.InitConstNameDropDownList(this.drpUseLevel, ConstValue.GroupId_StandardLevel, false); | |||
|  |                 string standardCode = Request.Params["StandardCode"]; | |||
|  |                 if (!string.IsNullOrEmpty(standardCode)) | |||
|  |                 { | |||
|  |                     Model.CQMS_Law_ConstructionStandardListProject standard = BLL.ConstructionStandardListProjectService.GetConstructionStandardListProjectByStandardCode(Convert.ToInt32(standardCode),this.CurrUser.LoginProjectId); | |||
|  |                     if (standard != null) | |||
|  |                     { | |||
|  |                         this.drpStandardType.SelectedValue = standard.StandardType; | |||
|  |                         this.txtStandardGrade.Text = standard.StandardGrade; | |||
|  |                         this.txtStandardNo.Text = standard.StandardNo; | |||
|  |                         this.txtStandardName.Text = standard.StandardName; | |||
|  |                         this.txtPubDate.Text = standard.PubDate.HasValue ? string.Format("{0:yyyy-MM-dd}", standard.PubDate) : ""; | |||
|  |                         this.txtImpDate.Text = standard.ImpDate.HasValue ? string.Format("{0:yyyy-MM-dd}", standard.ImpDate) : ""; | |||
|  |                         this.txtReplaceStandard.Text = standard.ReplaceStandard; | |||
|  |                         this.drpStatus.SelectedValue = standard.Status; | |||
|  |                         this.drpUseLevel.SelectedValue = standard.UseLevel; | |||
|  |                         if (standard.IsSelected1 == true) | |||
|  |                         { | |||
|  |                             this.cbIsSelected1.Checked = true; | |||
|  |                         } | |||
|  |                         if (standard.IsSelected2 == true) | |||
|  |                         { | |||
|  |                             this.cbIsSelected2.Checked = true; | |||
|  |                         } | |||
|  |                         if (standard.IsSelected3 == true) | |||
|  |                         { | |||
|  |                             this.cbIsSelected3.Checked = true; | |||
|  |                         } | |||
|  |                         if (standard.IsSelected4 == true) | |||
|  |                         { | |||
|  |                             this.cbIsSelected4.Checked = true; | |||
|  |                         } | |||
|  |                         if (standard.IsSelected5 == true) | |||
|  |                         { | |||
|  |                             this.cbIsSelected5.Checked = true; | |||
|  |                         } | |||
|  |                         if (standard.IsSelected6 == true) | |||
|  |                         { | |||
|  |                             this.cbIsSelected6.Checked = true; | |||
|  |                         } | |||
|  |                         this.txtRemark.Text = standard.Memo; | |||
|  |                         this.hdStandardCode.Text = standard.StandardCode + this.CurrUser.LoginProjectId; | |||
|  |                     } | |||
|  |                 } | |||
|  |             } | |||
|  |         } | |||
|  |         #endregion | |||
|  | 
 | |||
|  |         #region 附件上传 | |||
|  |         /// <summary> | |||
|  |         /// 附件上传 | |||
|  |         /// </summary> | |||
|  |         /// <param name="sender"></param> | |||
|  |         /// <param name="e"></param> | |||
|  |         protected void btnAttach_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             if (string.IsNullOrEmpty(this.hdStandardCode.Text))   //新增记录 | |||
|  |             { | |||
|  |                 int maxStandardCode = 0; | |||
|  |                 if (BLL.ConstructionStandardListProjectService.GetCountConstructionStandardListProject(this.CurrUser.LoginProjectId) != 0) | |||
|  |                 { | |||
|  |                     maxStandardCode = BLL.ConstructionStandardListProjectService.GetMaxStandardCode(this.CurrUser.LoginProjectId); | |||
|  |                 } | |||
|  |                 this.hdStandardCode.Text = (maxStandardCode + 1).ToString()+this.CurrUser.LoginProjectId; | |||
|  |             } | |||
|  |             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/DataBase/ConstructionStandardProject&menuId={1}", this.hdStandardCode.Text, BLL.Const.CQMSConstructionStandardListProjectMenuId))); | |||
|  |         } | |||
|  |         #endregion | |||
|  | 
 | |||
|  |         #region 保存 | |||
|  |         /// <summary> | |||
|  |         /// 保存按钮 | |||
|  |         /// </summary> | |||
|  |         /// <param name="sender"></param> | |||
|  |         /// <param name="e"></param> | |||
|  |         protected void btnSave_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             string standardCode = Request.Params["StandardCode"]; | |||
|  | 
 | |||
|  |             Model.CQMS_Law_ConstructionStandardListProject newStandard = new Model.CQMS_Law_ConstructionStandardListProject(); | |||
|  |             newStandard.StandardType = this.drpStandardType.SelectedValue; | |||
|  |             newStandard.StandardGrade = this.txtStandardGrade.Text.Trim(); | |||
|  |             newStandard.StandardNo = this.txtStandardNo.Text.Trim(); | |||
|  |             newStandard.StandardName = this.txtStandardName.Text.Trim(); | |||
|  |             newStandard.PubDate = Funs.GetNewDateTime(this.txtPubDate.Text.Trim()); | |||
|  |             newStandard.ImpDate = Funs.GetNewDateTime(this.txtImpDate.Text.Trim()); | |||
|  |             newStandard.ReplaceStandard = this.txtReplaceStandard.Text.Trim(); | |||
|  |             newStandard.Status = this.drpStatus.SelectedValue; | |||
|  |             newStandard.UseLevel = this.drpUseLevel.SelectedValue; | |||
|  |             newStandard.IsSelected1 = this.cbIsSelected1.Checked ? true : false; | |||
|  |             newStandard.IsSelected2 = this.cbIsSelected2.Checked ? true : false; | |||
|  |             newStandard.IsSelected3 = this.cbIsSelected3.Checked ? true : false; | |||
|  |             newStandard.IsSelected4 = this.cbIsSelected4.Checked ? true : false; | |||
|  |             newStandard.IsSelected5 = this.cbIsSelected5.Checked ? true : false; | |||
|  |             newStandard.IsSelected6 = this.cbIsSelected6.Checked ? true : false; | |||
|  |             newStandard.Memo = this.txtRemark.Text.Trim(); | |||
|  |             newStandard.ProjectId = this.CurrUser.LoginProjectId; | |||
|  |             if (!string.IsNullOrEmpty(standardCode)) | |||
|  |             { | |||
|  |                 newStandard.StandardCode = Convert.ToInt32(standardCode); | |||
|  |                 BLL.ConstructionStandardListProjectService.UpdateConstructionStandardListProject(newStandard); | |||
|  |             } | |||
|  |             else | |||
|  |             { | |||
|  |                 //if (!string.IsNullOrEmpty(this.hdStandardCode.Text)) | |||
|  |                 //{ | |||
|  |                 //    newStandard.StandardCode = Convert.ToInt32(this.hdStandardCode.Text.Trim()); | |||
|  |                 //} | |||
|  |                 //else | |||
|  |                 //{ | |||
|  |                     int maxStandardCode = 0; | |||
|  |                     if (BLL.ConstructionStandardListProjectService.GetCountConstructionStandardListProject(this.CurrUser.LoginProjectId) != 0) | |||
|  |                     { | |||
|  |                         maxStandardCode = BLL.ConstructionStandardListProjectService.GetMaxStandardCode(this.CurrUser.LoginProjectId); | |||
|  |                     } | |||
|  |                     newStandard.StandardCode = maxStandardCode + 1; | |||
|  |                 //} | |||
|  |                 BLL.ConstructionStandardListProjectService.AddConstructionStandardListProject(newStandard); | |||
|  |             } | |||
|  |             ShowNotify("保存成功!", MessageBoxIcon.Success); | |||
|  |             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); | |||
|  |         } | |||
|  |         #endregion | |||
|  |     } | |||
|  | } |