152 lines
		
	
	
		
			6.0 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			152 lines
		
	
	
		
			6.0 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.QualityPlanning
 | |
| {
 | |
|     public partial class ConExperienceSummaryEdit : PageBase
 | |
|     {
 | |
|         #region 定义变量
 | |
|         /// <summary>
 | |
|         /// 主键
 | |
|         /// </summary>
 | |
|         public string ConExperienceSummaryId
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 return (string)ViewState["ConExperienceSummaryId"];
 | |
|             }
 | |
|             set
 | |
|             {
 | |
|                 ViewState["ConExperienceSummaryId"] = value;
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 加载
 | |
|         /// <summary>
 | |
|         /// 加载页面
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Page_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             if (!IsPostBack)
 | |
|             {
 | |
|                 GetButtonPower();
 | |
|                 //BLL.UserService.InitUserDropDownList(this.drpCompileMan, this.CurrUser.LoginProjectId, true);
 | |
| 
 | |
|                 this.ConExperienceSummaryId = Request.Params["id"];
 | |
|                 Model.QualityPlanning_ConExperienceSummary con = BLL.ConExperienceSummaryService.GetConExperienceSummaryById(this.ConExperienceSummaryId);
 | |
|                 if (con != null)
 | |
|                 {
 | |
|                     this.ConExperienceSummaryId = con.ConExperienceSummaryId;
 | |
|                     this.hdAttachUrl.Text = this.ConExperienceSummaryId;
 | |
|                     //this.txtFileCode.Text = projectQualityPlan.FileCode;
 | |
|                     this.txtFileName.Text = con.FileName;
 | |
|                     //if (!string.IsNullOrEmpty(projectQualityPlan.CompileMan))
 | |
|                     //{
 | |
|                     //    this.drpCompileMan.SelectedValue = projectQualityPlan.CompileMan;
 | |
|                     //}
 | |
|                     //this.txtAuditor.Text = projectQualityPlan.Auditor;
 | |
|                     //this.txtApprover.Text = projectQualityPlan.Approver;
 | |
|                     //this.txtApprovalDate.Text = projectQualityPlan.ApprovalDate.HasValue ? string.Format("{0:yyyy-MM-dd}", projectQualityPlan.ApprovalDate) : "";
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     //this.drpCompileMan.SelectedValue = this.CurrUser.UserId;
 | |
|                     //this.txtApprovalDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
 | |
|                     this.btnSave.Hidden = false;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 保存
 | |
|         /// <summary>
 | |
|         /// 保存按钮
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnSave_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             Model.QualityPlanning_ConExperienceSummary newData = new Model.QualityPlanning_ConExperienceSummary();
 | |
|             newData.ProjectId = this.CurrUser.LoginProjectId;
 | |
|             //projectQualityPlan.FileCode = this.txtFileCode.Text.Trim();
 | |
|             newData.FileName = this.txtFileName.Text.Trim();
 | |
|             //if (this.drpCompileMan.SelectedValue != BLL.Const._Null)
 | |
|             //{
 | |
|             //    projectQualityPlan.CompileMan = this.drpCompileMan.SelectedValue;
 | |
|             //}
 | |
|             newData.CompileMan = this.CurrUser.UserId;
 | |
|             newData.CompileDate = DateTime.Now;
 | |
|             //projectQualityPlan.Auditor = this.txtAuditor.Text.Trim();
 | |
|             //projectQualityPlan.Approver = this.txtApprover.Text.Trim();
 | |
|             //projectQualityPlan.ApprovalDate = Funs.GetNewDateTime(this.txtApprovalDate.Text.Trim());
 | |
|             if (string.IsNullOrEmpty(this.ConExperienceSummaryId))
 | |
|             {
 | |
|                 if (!string.IsNullOrEmpty(this.hdAttachUrl.Text))
 | |
|                 {
 | |
|                     newData.ConExperienceSummaryId = this.hdAttachUrl.Text;
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     newData.ConExperienceSummaryId = SQLHelper.GetNewID(typeof(Model.QualityPlanning_ConExperienceSummary));
 | |
|                     this.hdAttachUrl.Text = newData.ConExperienceSummaryId;
 | |
|                 }
 | |
|                 BLL.ConExperienceSummaryService.AddConExperienceSummary(newData);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 newData.ConExperienceSummaryId = this.ConExperienceSummaryId;
 | |
|                 BLL.ConExperienceSummaryService.UpdateExperienceSummary(newData);
 | |
|             }
 | |
|             ShowNotify("保存成功!", MessageBoxIcon.Success);
 | |
|             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 附件上传
 | |
|         /// <summary>
 | |
|         /// 附件上传
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnAttach_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             if (string.IsNullOrEmpty(this.hdAttachUrl.Text))   //新增记录
 | |
|             {
 | |
|                 this.hdAttachUrl.Text = SQLHelper.GetNewID(typeof(Model.QualityPlanning_ConExperienceSummary));
 | |
|             }
 | |
|             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/ConExperienceSummary&menuId={1}", this.hdAttachUrl.Text, BLL.Const.ConExperienceSummaryMenuId)));
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 获取按钮权限
 | |
|         /// <summary>
 | |
|         /// 获取按钮权限
 | |
|         /// </summary>
 | |
|         /// <param name="button"></param>
 | |
|         /// <returns></returns>
 | |
|         private void GetButtonPower()
 | |
|         {
 | |
|             if (Request.Params["value"] == "0")
 | |
|             {
 | |
|                 return;
 | |
|             }
 | |
|             var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ConExperienceSummaryMenuId);
 | |
|             if (buttonList.Count > 0)
 | |
|             {
 | |
|                 if (buttonList.Contains(BLL.Const.BtnSave))
 | |
|                 {
 | |
|                     this.btnSave.Hidden = false;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
|     }
 | |
| } |