168 lines
		
	
	
		
			7.1 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			168 lines
		
	
	
		
			7.1 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								using System.Linq;
							 | 
						|||
| 
								 | 
							
								using System.Web;
							 | 
						|||
| 
								 | 
							
								using System.Web.UI;
							 | 
						|||
| 
								 | 
							
								using System.Web.UI.WebControls;
							 | 
						|||
| 
								 | 
							
								using BLL;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace FineUIPro.Web.CQMS.WBS
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class EditBreakdown : PageBase
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        #region 定义项
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 主键
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        public string BreakdownId
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            get
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return (string)ViewState["BreakdownId"];
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            set
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ViewState["BreakdownId"] = value;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        protected void Page_Load(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (!IsPostBack)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                string divisionId = Request.Params["divisionId"];
							 | 
						|||
| 
								 | 
							
								                BreakdownId = Request.Params["breakdownId"];
							 | 
						|||
| 
								 | 
							
								                Funs.FineUIPleaseSelect(this.drpCheckAcceptType);
							 | 
						|||
| 
								 | 
							
								                Model.WBS_Breakdown breakdown = BLL.BreakdownService.GetBreakdownById(BreakdownId);
							 | 
						|||
| 
								 | 
							
								                var division = BLL.DivisionService.GetDivisionById(divisionId);
							 | 
						|||
| 
								 | 
							
								                if (division != null)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    if (division.CNProfessionalId != null && Const.CNProfessionalConstructId == division.CNProfessionalId)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        this.tr1.Hidden = false;
							 | 
						|||
| 
								 | 
							
								                        this.tr2.Hidden = false;
							 | 
						|||
| 
								 | 
							
								                        this.tr3.Hidden = false;
							 | 
						|||
| 
								 | 
							
								                        this.tr4.Hidden = false;
							 | 
						|||
| 
								 | 
							
								                        this.txtCheckPoints.Label = "质量记录名称";
							 | 
						|||
| 
								 | 
							
								                        this.txtRecordAndCode.Label = "记录格式文本号";
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    else
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        this.tr1.Hidden = true;
							 | 
						|||
| 
								 | 
							
								                        this.tr2.Hidden = true;
							 | 
						|||
| 
								 | 
							
								                        this.tr3.Hidden = true;
							 | 
						|||
| 
								 | 
							
								                        this.tr4.Hidden = true;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                if (Request.Params["type"] == "add")
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    var list = BLL.BreakdownService.GetBreakdownsByDivisionId(divisionId);
							 | 
						|||
| 
								 | 
							
								                    this.txtSortIndex.Text = (list.Count() + 1).ToString();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                if (Request.Params["type"] == "modify")
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    if (breakdown != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        this.txtBreakdownCode.Text = breakdown.BreakdownCode;
							 | 
						|||
| 
								 | 
							
								                        this.txtBreakdownName.Text = breakdown.BreakdownName;
							 | 
						|||
| 
								 | 
							
								                        this.txtBasis.Text = breakdown.Basis;
							 | 
						|||
| 
								 | 
							
								                        this.txtCheckPoints.Text = breakdown.CheckPoints;
							 | 
						|||
| 
								 | 
							
								                        this.txtRecordAndCode.Text = breakdown.RecordAndCode;
							 | 
						|||
| 
								 | 
							
								                        this.txtClass.Text = breakdown.Class;
							 | 
						|||
| 
								 | 
							
								                        this.YeZhu.Text = breakdown.YeZhu;
							 | 
						|||
| 
								 | 
							
								                        this.JianLi.Text = breakdown.JianLi;
							 | 
						|||
| 
								 | 
							
								                        this.WuHuan.Text = breakdown.WuHuan;
							 | 
						|||
| 
								 | 
							
								                        this.FenBao.Text = breakdown.FenBao;
							 | 
						|||
| 
								 | 
							
								                        if (breakdown.SortIndex != null)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.txtSortIndex.Text = breakdown.SortIndex.ToString();
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        if (!string.IsNullOrEmpty(breakdown.CheckAcceptType))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.drpCheckAcceptType.SelectedValue = breakdown.CheckAcceptType;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        this.txtRemark.Text = breakdown.Remark;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 保存
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void btnSave_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            string divisionId = Request.Params["divisionId"];
							 | 
						|||
| 
								 | 
							
								            Model.WBS_Breakdown newBreakdown = new Model.WBS_Breakdown();
							 | 
						|||
| 
								 | 
							
								            newBreakdown.BreakdownCode = this.txtBreakdownCode.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newBreakdown.BreakdownName = this.txtBreakdownName.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newBreakdown.DivisionId = divisionId;
							 | 
						|||
| 
								 | 
							
								            newBreakdown.Basis = this.txtBasis.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newBreakdown.CheckPoints = this.txtCheckPoints.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newBreakdown.RecordAndCode = this.txtRecordAndCode.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newBreakdown.Class = this.txtClass.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newBreakdown.FenBao = this.FenBao.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newBreakdown.WuHuan = this.WuHuan.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newBreakdown.JianLi = this.JianLi.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newBreakdown.YeZhu = this.YeZhu.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            if (this.drpCheckAcceptType.SelectedValue != BLL.Const._Null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                newBreakdown.CheckAcceptType = this.drpCheckAcceptType.SelectedValue;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrEmpty(this.txtSortIndex.Text.Trim()))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                try
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    newBreakdown.SortIndex = Convert.ToInt32(this.txtSortIndex.Text.Trim());
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                catch (Exception)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    ScriptManager.RegisterStartupScript(this, typeof(string), "_alert", "alert('排序只能为整数!')", true);
							 | 
						|||
| 
								 | 
							
								                    return;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            newBreakdown.Remark = this.txtRemark.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            if (Request.Params["type"] == "add")
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (this.rblIsAcceptance.SelectedValue == "True")
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    newBreakdown.IsAcceptance = true;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    newBreakdown.IsAcceptance = false;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                if (string.IsNullOrEmpty(this.BreakdownId))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    string newKeyID = SQLHelper.GetNewID(typeof(Model.WBS_Breakdown));
							 | 
						|||
| 
								 | 
							
								                    newBreakdown.BreakdownId = newKeyID;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    newBreakdown.BreakdownId = this.BreakdownId;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                BLL.BreakdownService.AddBreakdown(newBreakdown);
							 | 
						|||
| 
								 | 
							
								                BLL.LogService.AddSys_Log(this.CurrUser, newBreakdown.BreakdownCode, newBreakdown.BreakdownId, BLL.Const.ControlPointMenuId, "添加分项工程信息!");
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (Request.Params["type"] == "modify")
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                newBreakdown.BreakdownId = BreakdownId;
							 | 
						|||
| 
								 | 
							
								                BLL.BreakdownService.UpdateBreakdown(newBreakdown);
							 | 
						|||
| 
								 | 
							
								                BLL.LogService.AddSys_Log(this.CurrUser, newBreakdown.BreakdownCode, BreakdownId, BLL.Const.ControlPointMenuId, "修改分项工程信息!");
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        protected void btnAttachUrl_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (string.IsNullOrEmpty(this.BreakdownId))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                this.BreakdownId = SQLHelper.GetNewID(typeof(Model.WBS_Breakdown));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/Breakdown&menuId={1}&type=0", BreakdownId + "m", BLL.Const.ControlPointMenuId)));
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |