254 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			254 lines
		
	
	
		
			11 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.Foreign
 | |
| {
 | |
|     public partial class ControlPointCheckEdit : PageBase
 | |
|     {
 | |
|         #region 加载
 | |
|         /// <summary>
 | |
|         /// 加载页面
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Page_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             if (!IsPostBack)
 | |
|             {
 | |
|                 //施工单位
 | |
|                 this.drpSubUnitId.DataValueField = "UnitId";
 | |
|                 this.drpSubUnitId.DataTextField = "UnitName";
 | |
|                 this.drpSubUnitId.DataSource = BLL.UnitService.GetUnitByProjectIdUnitTypeList(this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2);
 | |
|                 this.drpSubUnitId.DataBind();
 | |
|                 Funs.FineUIPleaseSelect(this.drpSubUnitId);
 | |
| 
 | |
|                 BLL.ForeignCNProfessionalService.InitForeignCNProfessionalDropDownList(this.drpCNProfessionalId, true);//专业
 | |
| 
 | |
|                 string controlPointCheckId = Request.Params["ControlPointCheckId"];
 | |
|                 if (!string.IsNullOrEmpty(controlPointCheckId))
 | |
|                 {
 | |
|                     var controlPointCheck = BLL.ControlPointCheckService.GetControlPointCheckById(controlPointCheckId);
 | |
|                     if (controlPointCheck != null)
 | |
|                     {
 | |
|                         if (!string.IsNullOrEmpty(controlPointCheck.UnitId))
 | |
|                         {
 | |
|                             this.drpSubUnitId.SelectedValue = controlPointCheck.UnitId;
 | |
|                         }
 | |
|                         if (!string.IsNullOrEmpty(controlPointCheck.CNProfessionalId))
 | |
|                         {
 | |
|                             this.drpCNProfessionalId.SelectedValue = controlPointCheck.CNProfessionalId;
 | |
|                         }
 | |
|                         this.txtInspectionCode.Text = controlPointCheck.InspectionCode;
 | |
|                         if (!string.IsNullOrEmpty(controlPointCheck.UnitWorkId))
 | |
|                         {
 | |
|                             this.hdUnitWorkId.Text = controlPointCheck.UnitWorkId;
 | |
|                             var unitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(controlPointCheck.UnitWorkId);
 | |
|                             if (unitWork != null)
 | |
|                             {
 | |
|                                 this.txtUnitWorkName.Text = unitWork.UnitWorkName;
 | |
|                             }
 | |
|                         }
 | |
|                         if (!string.IsNullOrEmpty(controlPointCheck.ControlPointType))
 | |
|                         {
 | |
|                             this.hdControlPointType.Text = controlPointCheck.ControlPointType;
 | |
|                             var controlPointType = BLL.ForeignBreakdownProjectService.GetForeignBreakdownProjectById(this.hdControlPointType.Text);
 | |
|                             if (controlPointType != null)
 | |
|                             {
 | |
|                                 this.txtControlPointType.Text = controlPointType.BreakdownName;
 | |
|                             }
 | |
|                         }
 | |
|                         this.txtAcceptanceSite.Text = controlPointCheck.AcceptanceSite;
 | |
|                         this.txtAcceptanceCheckMan.Text = controlPointCheck.AcceptanceCheckMan;
 | |
|                         this.txtNoticeCode.Text = controlPointCheck.NoticeCode;
 | |
|                         this.txtUnqualifiedReason.Text = controlPointCheck.UnqualifiedReason;
 | |
|                         if (controlPointCheck.IsOnceQualified != null)
 | |
|                         {
 | |
|                             this.rblIsOnceQualified.SelectedValue = Convert.ToString(controlPointCheck.IsOnceQualified);
 | |
|                             if (controlPointCheck.IsOnceQualified == false)
 | |
|                             {
 | |
|                                 this.txtUnqualifiedReason.Hidden = true;//隐藏不合格原因
 | |
|                             }
 | |
|                             else
 | |
|                             {
 | |
|                                 this.txtUnqualifiedReason.Hidden = false;
 | |
|                             }
 | |
|                         }
 | |
|                         if (controlPointCheck.InspectionDate.HasValue)
 | |
|                         {
 | |
|                             this.txtInspectionDate.Text = string.Format("{0:yyyy-MM-dd}", controlPointCheck.InspectionDate);
 | |
|                         }
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 保存
 | |
|         /// <summary>
 | |
|         /// 保存按钮
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnSave_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             if (string.IsNullOrEmpty(this.drpSubUnitId.SelectedValue) || this.drpSubUnitId.SelectedValue == BLL.Const._Null)
 | |
|             {
 | |
|                 Alert.ShowInTop("请选择施工分包商", MessageBoxIcon.Warning);
 | |
|                 return;
 | |
|             }
 | |
|             string controlPointCheckId = Request.Params["ControlPointCheckId"];
 | |
|             Model.CQMS_Foreign_ControlPointCheck check = new Model.CQMS_Foreign_ControlPointCheck();
 | |
|             check.ProjectId = this.CurrUser.LoginProjectId;
 | |
|             if (this.drpSubUnitId.SelectedValue != BLL.Const._Null)
 | |
|             {
 | |
|                 check.UnitId = this.drpSubUnitId.SelectedValue;
 | |
|             }
 | |
|             if (this.drpCNProfessionalId.SelectedValue != BLL.Const._Null)
 | |
|             {
 | |
|                 check.CNProfessionalId = this.drpCNProfessionalId.SelectedValue;
 | |
|             }
 | |
|             check.InspectionCode = txtInspectionCode.Text.Trim();
 | |
|             if (!string.IsNullOrEmpty(this.hdUnitWorkId.Text))
 | |
|             {
 | |
|                 check.UnitWorkId = this.hdUnitWorkId.Text;
 | |
|             }
 | |
|             if (!string.IsNullOrEmpty(this.hdControlPointType.Text))
 | |
|             {
 | |
|                 check.ControlPointType = this.hdControlPointType.Text;
 | |
|             }
 | |
|             check.NoticeCode = this.txtNoticeCode.Text.Trim();
 | |
|             check.AcceptanceCheckMan = this.txtAcceptanceCheckMan.Text.Trim();
 | |
|             check.AcceptanceSite = this.txtAcceptanceSite.Text.Trim();
 | |
|             check.IsOnceQualified = Convert.ToBoolean(this.rblIsOnceQualified.SelectedValue);
 | |
|             if (!string.IsNullOrEmpty(txtUnqualifiedReason.Text))
 | |
|             {
 | |
|                 check.UnqualifiedReason = this.txtUnqualifiedReason.Text.Trim();
 | |
|             }
 | |
|             if (!string.IsNullOrEmpty(this.txtInspectionDate.Text))
 | |
|             {
 | |
|                 check.InspectionDate = Convert.ToDateTime(this.txtInspectionDate.Text);
 | |
|             }
 | |
|             if (!string.IsNullOrEmpty(controlPointCheckId))
 | |
|             {
 | |
|                 check.ControlPointCheckId = controlPointCheckId;
 | |
|                 BLL.ControlPointCheckService.UpdateControlPointCheck(check);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 check.CompileMan = this.CurrUser.UserId;
 | |
|                 check.CompileDate = DateTime.Now;
 | |
|                 if (!string.IsNullOrEmpty(this.hdControlPointCheckId.Text))
 | |
|                 {
 | |
|                     check.ControlPointCheckId = this.hdControlPointCheckId.Text;
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     check.ControlPointCheckId = SQLHelper.GetNewID(typeof(Model.CQMS_Foreign_ControlPointCheck));
 | |
|                 }
 | |
|                 BLL.ControlPointCheckService.AddControlPointCheck(check);
 | |
|             }
 | |
|             ShowNotify("保存成功!", MessageBoxIcon.Success);
 | |
|             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 是否一次合格选择事件
 | |
|         /// <summary>
 | |
|         /// 是否一次合格选择事件
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void rblIsOnceQualified_SelectedIndexChanged(object sender, EventArgs e)
 | |
|         {
 | |
|             if (this.rblIsOnceQualified.SelectedValue == "False")
 | |
|             {
 | |
|                 this.txtUnqualifiedReason.Hidden = false;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 this.txtUnqualifiedReason.Hidden = true;
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 选择事件
 | |
|         /// <summary>
 | |
|         /// 专业下拉选择事件
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void drpCNProfessionalId_SelectedIndexChanged(object sender, EventArgs e)
 | |
|         {
 | |
|             this.hdUnitWorkId.Text = string.Empty;
 | |
|             this.txtUnitWorkName.Text = string.Empty;
 | |
| 
 | |
|             this.hdControlPointType.Text = string.Empty;
 | |
|             this.txtControlPointType.Text = string.Empty;
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 查找
 | |
|         /// <summary>
 | |
|         /// 查找
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnSearch_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             if (this.drpCNProfessionalId.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpCNProfessionalId.SelectedValue))
 | |
|             {
 | |
|                 Alert.ShowInTop("请先选择专业!", MessageBoxIcon.Warning);
 | |
|                 return;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 string window = String.Format("ShoBreakdownProject.aspx?CNProfessionalId={0}", this.drpCNProfessionalId.SelectedValue, "查找 - ");
 | |
|                 PageContext.RegisterStartupScript(Window1.GetSaveStateReference(hdItemsString.ClientID) + Window1.GetShowReference(window));
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 关闭弹出窗体
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Window1_Close(object sender, WindowCloseEventArgs e)
 | |
|         {
 | |
|             List<string> lists = Funs.GetStrListByStr(hdItemsString.Text, '|');
 | |
|             this.hdControlPointType.Text = lists[0];
 | |
|             this.hdUnitWorkId.Text = lists[1];
 | |
|             var pro = BLL.ForeignBreakdownProjectService.GetForeignBreakdownProjectById(hdControlPointType.Text.Trim());
 | |
|             if (pro!=null)
 | |
|             {
 | |
|                 this.txtControlPointType.Text = pro.BreakdownName;
 | |
|             }
 | |
|             var unitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(this.hdUnitWorkId.Text.Trim());
 | |
|             if (unitWork!=null)
 | |
|             {
 | |
|                 this.txtUnitWorkName.Text = unitWork.UnitWorkName;
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 附件上传
 | |
|         /// <summary>
 | |
|         /// 附件上传
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnAttach_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             if (string.IsNullOrEmpty(this.hdControlPointCheckId.Text))   //新增记录
 | |
|             {
 | |
|                 this.hdControlPointCheckId.Text = SQLHelper.GetNewID(typeof(Model.CQMS_Foreign_ControlPointCheck));
 | |
|             }
 | |
|             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/Foreign/ControlPointCheck&menuId={1}", this.hdControlPointCheckId.Text, BLL.Const.ControlPointCheckMenuId)));
 | |
|         }
 | |
|         #endregion       
 | |
|     }
 | |
| } |