165 lines
		
	
	
		
			6.8 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			165 lines
		
	
	
		
			6.8 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.TestRunManage
 | |
| {
 | |
|     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.TestRun_SubInspectTerm
 | |
|                        join workpage in Funs.DB.TestRun_WorkPackage on term.WorkPackId equals workpage.WorkPackId
 | |
|                        join pro in Funs.DB.Base_Project on term.ProjectId equals pro.ProjectId
 | |
|                        join subuser in Funs.DB.Sys_User on term.Subcontractor equals subuser.UserId
 | |
|                        join conuser in Funs.DB.Sys_User on term.Contractor equals conuser.UserId
 | |
|                        join supuser in Funs.DB.Sys_User on term.Supervision equals supuser.UserId
 | |
|                        join ownuser in Funs.DB.Sys_User on term.Owner equals ownuser.UserId
 | |
|                        where term.SubInspectId == this.SubInspectId
 | |
|                        select new
 | |
|                        {
 | |
|                            term.SubInspectId,
 | |
|                            term.ProjectId,
 | |
|                            pro.ProjectName,
 | |
|                            pro.ProjectCode,
 | |
|                            term.WorkPackId,
 | |
|                            workpage.WorkPackName,
 | |
|                            term.AddUser,
 | |
|                            term.AddTime,
 | |
|                            SubcontractorName = subuser.UserName,
 | |
|                            ContractorName = conuser.UserName,
 | |
|                            SupervisionName = supuser.UserName,
 | |
|                            OwnerName = ownuser.UserName,
 | |
|                            term.IsUnifyWanderAbout,
 | |
|                            term.UnifyWanderAboutData,
 | |
|                            term.UnifyWanderAboutOpinion
 | |
|                        };
 | |
|             if (data.Count() > 0)
 | |
|             {
 | |
|                 var model = data.FirstOrDefault();
 | |
|                 //项目名称
 | |
|                 lblProjectName.Text = model.ProjectName;
 | |
|                 //项目号
 | |
|                 lblProjectCode.Text = model.ProjectCode;
 | |
|                 //工作包名称
 | |
|                 lblWorkPackName.Text = model.WorkPackName;
 | |
|                 //分包商
 | |
|                 lblSubcontractorName.Text = model.SubcontractorName;
 | |
|                 //承包商
 | |
|                 lblContractorName.Text = model.ContractorName;
 | |
|                 //监理
 | |
|                 lblSupervisionName.Text = model.SupervisionName;
 | |
|                 //业主
 | |
|                 lblOwnerName.Text = model.OwnerName;
 | |
|                 //是否统一流转
 | |
|                 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.TestRun_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.SubcontractorIsAllPass = isPass;
 | |
|                     term.ContractorIsAllPass = isPass;
 | |
|                     term.SupervisionIsAllPass = isPass;
 | |
|                     term.OwnerIsAllPass = isPass;
 | |
|                     term.WanderIsComplete = isPass;
 | |
|                     if (isPass == 1)
 | |
|                     {
 | |
|                         term.SubcontractorAllPassData = DateTime.Now;
 | |
|                         term.ContractorAllPassData = DateTime.Now;
 | |
|                         term.SupervisionAllPassData = DateTime.Now;
 | |
|                         term.OwnerAllPassData = DateTime.Now;
 | |
|                         term.WanderCompleteData = DateTime.Now;
 | |
|                     }
 | |
|                     else
 | |
|                     {
 | |
|                         term.SubcontractorAllPassData = null;
 | |
|                         term.ContractorAllPassData = null;
 | |
|                         term.SupervisionAllPassData = null;
 | |
|                         term.OwnerAllPassData = null;
 | |
|                         term.WanderCompleteData = null;
 | |
|                     }
 | |
|                     var termIetms = Funs.DB.TestRun_SubInspectTermItem.Where(x => x.SubInspectId == this.SubInspectId).ToList();
 | |
|                     if (termIetms.Count > 0)
 | |
|                     {
 | |
|                         foreach (var item in termIetms)
 | |
|                         {
 | |
|                             item.SubcontractorIsPass = isPass;
 | |
|                             item.ContractorIsPass = isPass;
 | |
|                             item.SupervisionIsPass = isPass;
 | |
|                             item.OwnerIsPass = 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)));
 | |
|         }
 | |
|     }
 | |
| } |