155 lines
		
	
	
		
			6.1 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			155 lines
		
	
	
		
			6.1 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.TestRun.Produce | |||
|  | { | |||
|  |     public partial class InspectWanderAboutAllPass : PageBase | |||
|  |     { | |||
|  |         /// <summary> | |||
|  |         /// 检查表主键 | |||
|  |         /// </summary> | |||
|  |         public string SubInspectId | |||
|  |         { | |||
|  |             get { return (string)ViewState["SubInspectId"]; } | |||
|  |             set { ViewState["SubInspectId"] = value; } | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 统一处理附件 | |||
|  |         /// </summary> | |||
|  |         public int UnifyImg | |||
|  |         { | |||
|  |             get { return (int)ViewState["UnifyImg"]; } | |||
|  |             set { ViewState["UnifyImg"] = value; } | |||
|  |         } | |||
|  | 
 | |||
|  |         protected void Page_Load(object sender, EventArgs e) | |||
|  |         { | |||
|  |             if (!IsPostBack) | |||
|  |             { | |||
|  |                 this.UnifyImg = 0; | |||
|  |                 this.SubInspectId = Request["SubInspectId"]; | |||
|  |                 PageInit(); | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 绑定数据 | |||
|  |         /// </summary> | |||
|  |         public void PageInit() | |||
|  |         { | |||
|  |             var data = from term in Funs.DB.ProduceRun_SubInspectTerm | |||
|  |                        join pro in Funs.DB.Base_Project on term.ProjectId equals pro.ProjectId | |||
|  |                        join ua in Funs.DB.Sys_User on term.Contractor equals ua.UserId | |||
|  |                        join ub in Funs.DB.Sys_User on term.Owner equals ub.UserId | |||
|  |                        join uc in Funs.DB.Sys_User on term.ProcessPatent equals uc.UserId | |||
|  |                        where term.SubInspectId == this.SubInspectId | |||
|  |                        select new | |||
|  |                        { | |||
|  |                            term.SubInspectId, | |||
|  |                            term.ProjectId, | |||
|  |                            pro.ProjectName, | |||
|  |                            pro.ProjectCode, | |||
|  |                            term.AddUser, | |||
|  |                            term.AddTime, | |||
|  |                            ContractorName = ua.UserName, | |||
|  |                            OwnerName = ub.UserName, | |||
|  |                            ProcessPatentName = uc.UserName, | |||
|  |                            term.IsUnifyWanderAbout, | |||
|  |                            term.UnifyWanderAboutData, | |||
|  |                            term.UnifyWanderAboutOpinion | |||
|  |                        }; | |||
|  |             if (data.Count() > 0) | |||
|  |             { | |||
|  |                 var model = data.FirstOrDefault(); | |||
|  |                 //项目名称 | |||
|  |                 lblProjectName.Text = model.ProjectName; | |||
|  |                 //项目号 | |||
|  |                 lblProjectCode.Text = model.ProjectCode; | |||
|  |                 //承包商 | |||
|  |                 lblContractorName.Text = model.ContractorName; | |||
|  |                 //业主 | |||
|  |                 lblOwnerName.Text = model.OwnerName; | |||
|  |                 //工艺专利商 | |||
|  |                 lblProcessPatentName.Text = model.ProcessPatentName; | |||
|  |                 //是否统一流转 | |||
|  |                 rblIsUnifyWanderAbout.SelectedValue = model.IsUnifyWanderAbout != null ? model.IsUnifyWanderAbout.ToString() : "1"; | |||
|  |                 //审核意见 | |||
|  |                 txtUnifyWanderAboutOpinion.Text = model.UnifyWanderAboutOpinion; | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 确认 | |||
|  |         /// </summary> | |||
|  |         protected void btnConfirm_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             try | |||
|  |             { | |||
|  |                 if (Funs.DB.AttachFile.Count(x => x.ToKeyId == this.SubInspectId + "_unify" && x.AttachUrl != null && x.AttachUrl != "") == 0) | |||
|  |                 { | |||
|  |                     ShowNotify("请上传附件!", MessageBoxIcon.Warning); | |||
|  |                     return; | |||
|  |                 } | |||
|  |                 var term = Funs.DB.ProduceRun_SubInspectTerm.FirstOrDefault(x => x.SubInspectId == this.SubInspectId); | |||
|  |                 if (term != null) | |||
|  |                 { | |||
|  |                     var isPass = int.Parse(rblIsUnifyWanderAbout.SelectedValue); | |||
|  |                     term.IsUnifyWanderAbout = isPass; | |||
|  |                     term.UnifyWanderAboutData = DateTime.Now; | |||
|  |                     term.UnifyWanderAboutOpinion = txtUnifyWanderAboutOpinion.Text; | |||
|  |                     term.ContractorIsAllPass = isPass; | |||
|  |                     term.OwnerIsAllPass = isPass; | |||
|  |                     term.ProcessPatentIsAllPass = isPass; | |||
|  |                     term.WanderIsComplete = isPass; | |||
|  |                     term.InspectIsClose = isPass; | |||
|  |                     if (isPass == 1) | |||
|  |                     { | |||
|  |                         term.ContractorAllPassData = DateTime.Now; | |||
|  |                         term.OwnerAllPassData = DateTime.Now; | |||
|  |                         term.ProcessPatentAllPassData = DateTime.Now; | |||
|  |                         term.WanderCompleteData = DateTime.Now; | |||
|  |                         term.InspectCloseData = DateTime.Now; | |||
|  |                     } | |||
|  |                     else | |||
|  |                     { | |||
|  |                         term.ContractorAllPassData = null; | |||
|  |                         term.OwnerAllPassData = null; | |||
|  |                         term.ProcessPatentAllPassData = null; | |||
|  |                         term.WanderCompleteData = null; | |||
|  |                         term.InspectCloseData = null; | |||
|  |                     } | |||
|  |                     var termIetms = Funs.DB.ProduceRun_SubInspectTermItem.Where(x => x.SubInspectId == this.SubInspectId).ToList(); | |||
|  |                     if (termIetms.Count > 0) | |||
|  |                     { | |||
|  |                         foreach (var item in termIetms) | |||
|  |                         { | |||
|  |                             item.ContractorIsPass = isPass; | |||
|  |                             item.OwnerIsPass = isPass; | |||
|  |                             item.ProcessPatentIsPass = isPass; | |||
|  |                             Funs.DB.SubmitChanges(); | |||
|  |                         } | |||
|  |                     } | |||
|  |                     ShowNotify("确认成功!", MessageBoxIcon.Success); | |||
|  |                 } | |||
|  |             } | |||
|  |             catch (Exception ex) | |||
|  |             { | |||
|  |                 ShowNotify(ex.Message, MessageBoxIcon.Error); | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 附件上传 | |||
|  |         /// </summary> | |||
|  |         protected void btnAttach_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/CheckControl&menuId={2}", UnifyImg, this.SubInspectId + "_unify", Const.TestRunMenuId))); | |||
|  |         } | |||
|  |     } | |||
|  | } |