2024 lines
		
	
	
		
			84 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			2024 lines
		
	
	
		
			84 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | ||
| using System.Collections.Generic;
 | ||
| using System.Data;
 | ||
| using System.Linq;
 | ||
| using System.Reflection;
 | ||
| using System.Web;
 | ||
| using BLL;
 | ||
| using FineUIPro.Web.HSSE.Solution;
 | ||
| using Model;
 | ||
| using Newtonsoft.Json.Linq;
 | ||
| using AspNet = System.Web.UI.WebControls;
 | ||
| 
 | ||
| namespace FineUIPro.Web.CQMS.Solution
 | ||
| {
 | ||
|     public partial class EditConstructSolution : PageBase
 | ||
|     {
 | ||
|         
 | ||
|         #region 定义变量
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     方案审查主键
 | ||
|         /// </summary>
 | ||
|         public string ConstructSolutionId
 | ||
|         {
 | ||
|             get => (string)ViewState["ConstructSolutionId"];
 | ||
|             set => ViewState["ConstructSolutionId"] = value;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 是否第二次并且不同意的时候
 | ||
|         /// </summary>
 | ||
|         public bool isSendTrue
 | ||
|         {
 | ||
|             get => (bool)ViewState["isSendTrue"];
 | ||
|             set => ViewState["isSendTrue"] = value;
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         private static List<Model.Solution_CQMSConstructSolutionApprove_Item> complianceObligationsCs = new List<Model.Solution_CQMSConstructSolutionApprove_Item>();
 | ||
| 
 | ||
|         public int ContactImg
 | ||
|         {
 | ||
|             get => Convert.ToInt32(ViewState["ContactImg"]);
 | ||
|             set => ViewState["ContactImg"] = value;
 | ||
|         }
 | ||
| 
 | ||
|         private string[] GetUserNames(string Ids)
 | ||
|         {
 | ||
|             string[] arr = Ids.Split(',');
 | ||
|             var data = Funs.DB.Sys_User.Where(t => arr.Contains(t.UserId)).Select(t => t.UserName).ToList();
 | ||
|             if (data.Count > 0)
 | ||
|                 return data.ToArray();
 | ||
|             return null;
 | ||
| 
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         protected void Page_Load(object sender, EventArgs e)
 | ||
|         {
 | ||
|             if (!IsPostBack)
 | ||
|             {
 | ||
|                 isSendTrue = false;
 | ||
|                 complianceObligationsCs.Clear();
 | ||
|                 InitDropDownList(); //加载下拉框
 | ||
| 
 | ||
|                 //加载一级审核人员
 | ||
|                 GetCheckManBindGrid1();
 | ||
|                 //加载二级审批人员
 | ||
|                 GetCheckManBindGrid2();
 | ||
| 
 | ||
|                 //GetCheckManBindGrid3();
 | ||
| 
 | ||
|                 GetCheckManBindGrid4();
 | ||
| 
 | ||
|                 //BindZYRole();
 | ||
|                 //BindAQRole();
 | ||
|                 //BindSGRole();
 | ||
|                 ContactImg = 0;
 | ||
|                 txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
 | ||
|                 ConstructSolutionId = Request.Params["constructSolutionId"];
 | ||
| 
 | ||
|                 txtProjectName.Text = ProjectService.GetProjectByProjectId(CurrUser.LoginProjectId).ProjectName;
 | ||
| 
 | ||
|                 if (!string.IsNullOrWhiteSpace(ConstructSolutionId))
 | ||
|                 {
 | ||
|                     bindApprove();
 | ||
| 
 | ||
|                     #region 初始化表单
 | ||
| 
 | ||
|                     HFConstructSolutionId.Text = ConstructSolutionId;
 | ||
|                     var constructSolution =
 | ||
|                         CQMSConstructSolutionService.GetConstructSolutionByConstructSolutionId(ConstructSolutionId);
 | ||
|                     txtCode.Text = constructSolution.Code;
 | ||
|                     if (!string.IsNullOrEmpty(constructSolution.UnitId))
 | ||
|                     {
 | ||
|                         drpUnit.SelectedValue = constructSolution.UnitId;
 | ||
|                     }
 | ||
| 
 | ||
|                     if (!string.IsNullOrEmpty(constructSolution.SolutionType))
 | ||
|                     {
 | ||
|                         drpModelType.SelectedValue = constructSolution.SolutionType;
 | ||
|                     }
 | ||
| 
 | ||
|                     if (!string.IsNullOrEmpty(constructSolution.SpecialSchemeTypeId) &&
 | ||
|                         !string.IsNullOrEmpty(constructSolution.SolutionType))
 | ||
|                     {
 | ||
|                         drpSpecialType.SelectedValue = constructSolution.SpecialSchemeTypeId;
 | ||
|                     }
 | ||
| 
 | ||
|                     if (constructSolution.CompileDate != null)
 | ||
|                     {
 | ||
|                         txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", constructSolution.CompileDate);
 | ||
|                     }
 | ||
| 
 | ||
|                     if (!string.IsNullOrEmpty(constructSolution.UnitWorkIds) &&
 | ||
|                         constructSolution.UnitWorkIds.Length > 0)
 | ||
|                     {
 | ||
|                         txtUnitWork.Values = constructSolution.UnitWorkIds.Split(',');
 | ||
|                     }
 | ||
| 
 | ||
|                     if (!string.IsNullOrEmpty(constructSolution.CNProfessionalCodes) &&
 | ||
|                         constructSolution.CNProfessionalCodes.Length > 0)
 | ||
|                     {
 | ||
|                         txtCNProfessional.Values = constructSolution.CNProfessionalCodes.Split(',');
 | ||
|                     }
 | ||
| 
 | ||
|                     if (constructSolution.Edition != null)
 | ||
|                     {
 | ||
|                         txtEdition.Text = constructSolution.Edition.ToString();
 | ||
|                     }
 | ||
| 
 | ||
|                     txtSolutionName.Text = constructSolution.SolutionName;
 | ||
|                     txtDocContent.Text = HttpUtility.HtmlDecode(constructSolution.Content);
 | ||
| 
 | ||
|                     #endregion
 | ||
| 
 | ||
|                     #region 检查树节点
 | ||
| 
 | ||
|                     var zyUserIds =
 | ||
|                         CQMSConstructSolutionApproveService.GetUserIdsApprovesBySignType(ConstructSolutionId, "Yi");
 | ||
|                     if (zyUserIds.Count > 0)
 | ||
|                     {
 | ||
|                         var zyUserIdsStr = string.Join(",", zyUserIds);
 | ||
|                         drpzyUserIds.Values = zyUserIdsStr.Split(',');
 | ||
|                         drpzyUserIds.Texts = GetUserNames(zyUserIdsStr);
 | ||
|                         //SetCheck(trOne, zyUserIds);
 | ||
|                     }
 | ||
| 
 | ||
|                     var aqUserIds =
 | ||
|                         CQMSConstructSolutionApproveService.GetUserIdsApprovesBySignType(ConstructSolutionId, "Er");
 | ||
|                     if (aqUserIds.Count > 0)
 | ||
|                     {
 | ||
|                         var aqUserIdsStr = string.Join(",", aqUserIds);
 | ||
|                         drpaqUserIds.Values = aqUserIdsStr.Split(',');
 | ||
|                         drpaqUserIds.Texts = GetUserNames(aqUserIdsStr);
 | ||
|                         //SetCheck(trThree, aqUserIds);
 | ||
|                     }
 | ||
| 
 | ||
|                     var sgUserIds =
 | ||
|                         CQMSConstructSolutionApproveService.GetUserIdsApprovesBySignType(ConstructSolutionId, "SG");
 | ||
|                     if (sgUserIds.Count > 0)
 | ||
|                     {
 | ||
|                         var sgUserIdsStr = string.Join(",", sgUserIds);
 | ||
|                         //drpsgUserIds.Values = sgUserIdsStr.Split(',');
 | ||
|                         //drpsgUserIds.Texts = GetUserNames(sgUserIdsStr);
 | ||
|                         //SetCheck(trFive, sgUserIds);
 | ||
|                     }
 | ||
| 
 | ||
|                     if (!string.IsNullOrEmpty(constructSolution.CsUsers))
 | ||
|                     {
 | ||
|                         drpCsUsers.Values = constructSolution.CsUsers.Split(',');
 | ||
|                         drpCsUsers.Texts = GetUserNames(constructSolution.CsUsers);
 | ||
|                     }
 | ||
|                     #endregion
 | ||
| 
 | ||
|                     
 | ||
|                     if (constructSolution.State == Const.CQMSConstructSolution_ReCompile)
 | ||
|                     {
 | ||
|                         txtProjectName.Enabled = false;
 | ||
|                         txtCode.Enabled = false;
 | ||
|                         drpUnit.Enabled = false;
 | ||
|                         drpModelType.Enabled = false;
 | ||
|                         drpSpecialType.Enabled = false;
 | ||
|                         txtCompileDate.Enabled = false;
 | ||
|                         txtSolutionName.Enabled = false;
 | ||
|                         txtCNProfessional.Enabled = false;
 | ||
|                         txtUnitWork.Enabled = false;
 | ||
|                         //ContactImg = -2;
 | ||
|                         //Panel2.Enabled = false;
 | ||
|                         //Panel2.Hidden = true;
 | ||
|                         btnSave.Hidden = true;
 | ||
|                         //txtDocContent.Readonly = true;
 | ||
|                         drpzyUserIds.Enabled = false;
 | ||
|                         drpaqUserIds.Enabled = false;
 | ||
|                         //drpsgUserIds.Enabled = false;
 | ||
|                         drpCsUsers.Enabled = false;
 | ||
|                         txtEdition.Enabled = false;
 | ||
| 
 | ||
|                         agree.Hidden = true;
 | ||
|                        
 | ||
|                         optio.Hidden = true;
 | ||
| 
 | ||
|                         #region 重报
 | ||
|                         zyUserIds =
 | ||
|                         CQMSConstructSolutionApproveService.GetUserIdsApprovesBySignTypeNew(ConstructSolutionId, "Yi");
 | ||
|                         if (zyUserIds.Count > 0)
 | ||
|                         {
 | ||
|                             var zyUserIdsStr = string.Join(",", zyUserIds);
 | ||
|                             drpzyUserIds.Values = zyUserIdsStr.Split(',');
 | ||
|                             drpzyUserIds.Texts = GetUserNames(zyUserIdsStr);
 | ||
|                             //SetCheck(trOne, zyUserIds);
 | ||
|                         }
 | ||
| 
 | ||
|                          aqUserIds =
 | ||
|                             CQMSConstructSolutionApproveService.GetUserIdsApprovesBySignTypeNew(ConstructSolutionId, "Er");
 | ||
|                         if (aqUserIds.Count > 0)
 | ||
|                         {
 | ||
|                             var aqUserIdsStr = string.Join(",", aqUserIds);
 | ||
|                             drpaqUserIds.Values = aqUserIdsStr.Split(',');
 | ||
|                             drpaqUserIds.Texts = GetUserNames(aqUserIdsStr);
 | ||
|                             //SetCheck(trThree, aqUserIds);
 | ||
|                         }
 | ||
| 
 | ||
|                          sgUserIds =
 | ||
|                             CQMSConstructSolutionApproveService.GetUserIdsApprovesBySignTypeNew(ConstructSolutionId, "SG");
 | ||
|                         if (sgUserIds.Count > 0)
 | ||
|                         {
 | ||
|                             var sgUserIdsStr = string.Join(",", sgUserIds);
 | ||
|                             //drpsgUserIds.Values = sgUserIdsStr.Split(',');
 | ||
|                             //drpsgUserIds.Texts = GetUserNames(sgUserIdsStr);
 | ||
|                             //SetCheck(trFive, sgUserIds);
 | ||
|                         }
 | ||
|                         #endregion
 | ||
|                         //重报的情况下
 | ||
|                         //加载
 | ||
|                         complianceObligationsCs = Funs.DB.Solution_CQMSConstructSolutionApprove_Item.Where(x => x.ConstructSolutionId == ConstructSolutionId)
 | ||
|                            .OrderBy(x => x.SortId).OrderBy(x => x.Proposer).ToList();
 | ||
|                         if (complianceObligationsCs.Count > 0)
 | ||
|                         {
 | ||
|                             gvOperateComplianceObligations.DataSource = complianceObligationsCs;
 | ||
|                             gvOperateComplianceObligations.DataBind();
 | ||
|                         }
 | ||
| 
 | ||
|                         options.Hidden = false;
 | ||
|                         options1.Hidden = false;
 | ||
|                         btnNew.Hidden = true;
 | ||
|                         gvOperateComplianceObligations.AllColumns[0].Hidden = true;
 | ||
|                         gvOperateComplianceObligations.AllColumns[6].Hidden = true;
 | ||
|                         gvOperateComplianceObligations.AllColumns[7].Hidden = true;
 | ||
|                     }
 | ||
| 
 | ||
|                     if (constructSolution.State == Const.CQMSConstructSolution_Audit ||
 | ||
|                         constructSolution.State == Const.CQMSConstructSolution_Audit1)
 | ||
|                     {
 | ||
|                         plApprove2.Hidden = true;
 | ||
|                         txtProjectName.Enabled = false;
 | ||
|                         txtCode.Enabled = false;
 | ||
|                         drpUnit.Enabled = false;
 | ||
|                         drpModelType.Enabled = false;
 | ||
|                         drpSpecialType.Enabled = false;
 | ||
|                         txtCompileDate.Enabled = false;
 | ||
|                         txtSolutionName.Enabled = false;
 | ||
|                         txtCNProfessional.Enabled = false;
 | ||
|                         txtUnitWork.Enabled = false;
 | ||
|                         ContactImg = -2;
 | ||
|                         //Panel2.Enabled = false;
 | ||
|                         //Panel2.Hidden = true;
 | ||
|                         btnSave.Hidden=true;
 | ||
|                         txtDocContent.Readonly=true;
 | ||
|                         drpzyUserIds.Enabled = false;
 | ||
|                         drpaqUserIds.Enabled = false;
 | ||
|                         //drpsgUserIds.Enabled = false;
 | ||
|                         drpCsUsers.Enabled = false;
 | ||
|                         txtEdition.Enabled = false;
 | ||
| 
 | ||
|                         //1级审批 二级审批,如果填写过Solution_CQMSConstructSolutionApprove_Item的情况 则显示
 | ||
|                         complianceObligationsCs = Funs.DB.Solution_CQMSConstructSolutionApprove_Item.Where(x => x.ConstructSolutionId == ConstructSolutionId
 | ||
|                         && x.Proposer == CurrUser.UserId).OrderBy(x => x.SortId).ToList();
 | ||
|                         if (complianceObligationsCs.Count > 0)
 | ||
|                         {
 | ||
|                             isSendTrue = true;
 | ||
|                             options.Hidden = false;
 | ||
|                             options1.Hidden = false;
 | ||
|                             gvOperateComplianceObligations.DataSource = complianceObligationsCs;
 | ||
|                             gvOperateComplianceObligations.DataBind();
 | ||
|                             gvOperateComplianceObligations.AllColumns[4].Hidden = true;
 | ||
|                         }
 | ||
|                         
 | ||
|                     }
 | ||
| 
 | ||
|                    
 | ||
| 
 | ||
|                     ////提交版本人多次修改
 | ||
|                     //if (constructSolution.CompileMan.Equals(CurrUser.UserId))
 | ||
|                     //{
 | ||
|                     //    txtProjectName.Enabled = true;
 | ||
|                     //    txtCode.Enabled = true;
 | ||
|                     //    drpUnit.Enabled = true;
 | ||
|                     //    drpModelType.Enabled = true;
 | ||
|                     //    drpSpecialType.Enabled = true;
 | ||
|                     //    txtCompileDate.Enabled = true;
 | ||
|                     //    txtSolutionName.Enabled = true;
 | ||
|                     //    txtCNProfessional.Enabled = true;
 | ||
|                     //    txtUnitWork.Enabled = true;
 | ||
|                     //    ContactImg = 0;
 | ||
|                     //    Panel2.Enabled = true;
 | ||
|                     //    rblIsAgree.Hidden = true;
 | ||
|                     //    rblIsAgree.Required = false;
 | ||
|                     //    options.Hidden = true;
 | ||
|                     //    txtOptions.Required = false;
 | ||
|                     //    optio.Hidden = true;
 | ||
|                     //}
 | ||
| 
 | ||
|                     //    if (drpModelType.SelectedItem.Text == "施工组织设计") drpSpecialType.Enabled = false;
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     agree.Hidden = true;
 | ||
|                     txtEdition.Text = "0";
 | ||
|                     options.Hidden = true;
 | ||
|                     options1.Hidden = true;
 | ||
|                     optio.Hidden = true;
 | ||
|                     plApprove2.Hidden = true;
 | ||
|                     txtCode.Text = SQLHelper.RunProcNewId2("SpGetNewCode3ByProjectId",
 | ||
|                         "dbo.Solution_CQMSConstructSolution", "Code", CurrUser.LoginProjectId);
 | ||
|                 }
 | ||
|                 AddAttachTab();
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     向tab增加
 | ||
|         /// </summary>
 | ||
|         private void AddAttachTab()
 | ||
|         {
 | ||
|             if (string.IsNullOrEmpty(HFConstructSolutionId.Text)) //新增记录
 | ||
|                 HFConstructSolutionId.Text = SQLHelper.GetNewID(typeof(Solution_CQMSConstructSolution));
 | ||
|             PageContext.RegisterStartupScript(TabStrip1.GetAddTabReference("dynamic_tab2",
 | ||
|                 string.Format(
 | ||
|                     "../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/Solution&menuId={2}",
 | ||
|                     ContactImg, HFConstructSolutionId.Text, Const.CQMSConstructSolutionMenuId), "附件",
 | ||
|                 IconHelper.GetIconUrl(Icon.Attach), false));
 | ||
| 
 | ||
|             // PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/DocManage&menuId={1}", hdDocId.Text, Const.DocManageMenuId)));
 | ||
|         }
 | ||
| 
 | ||
|         private void InitDropDownList()
 | ||
|         {
 | ||
|             var unitWork = UnitWorkService.GetUnitWorkLists(CurrUser.LoginProjectId);
 | ||
|             var unitWorks = from x in unitWork
 | ||
|                 select
 | ||
|                     new
 | ||
|                     {
 | ||
|                         x.UnitWorkId,
 | ||
|                         UnitWorkName = x.UnitWorkCode + "-" + x.UnitWorkName +
 | ||
|                                        UnitWorkService.GetProjectType(x.ProjectType)
 | ||
|                     };
 | ||
|             gvUnitWork.DataSource = unitWorks;
 | ||
|             gvUnitWork.DataBind();
 | ||
|             var gvCNProfessional = CNProfessionalService.GetList();
 | ||
|             gvCNPro.DataSource = gvCNProfessional;
 | ||
|             gvCNPro.DataBind();
 | ||
|             SolutionTempleteTypeService.InitSolutionTempleteDropDownList(drpModelType, false);
 | ||
|             SpecialSchemeTypeService.InitSpecialSchemeTypeDropDownList(drpSpecialType, false);
 | ||
|             UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpUnit, CurrUser.LoginProjectId,
 | ||
|                 Const.ProjectUnitType_2, false);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     审批列表
 | ||
|         /// </summary>
 | ||
|         private void bindApprove()
 | ||
|         {
 | ||
|             var list = CQMSConstructSolutionApproveService.getListData(ConstructSolutionId);
 | ||
|             gvApprove.DataSource = list;
 | ||
|             gvApprove.DataBind();
 | ||
|         }
 | ||
| 
 | ||
|         public string man(object man)
 | ||
|         {
 | ||
|             var appman = string.Empty;
 | ||
|             if (UserService.GetUserByUserId(man.ToString()) != null)
 | ||
|                 appman = UserService.GetUserByUserId(man.ToString()).UserName;
 | ||
|             return appman;
 | ||
|         }
 | ||
| 
 | ||
|         private void Save(string saveType)
 | ||
|         {
 | ||
|              var constructSolution = new Solution_CQMSConstructSolution();
 | ||
|              if (!string.IsNullOrEmpty(ConstructSolutionId))
 | ||
|              {
 | ||
|                  constructSolution =
 | ||
|                      CQMSConstructSolutionService.GetConstructSolutionByConstructSolutionId(ConstructSolutionId);
 | ||
|              } 
 | ||
|             constructSolution.Code = txtCode.Text.Trim();
 | ||
|             constructSolution.ProjectId = CurrUser.LoginProjectId;
 | ||
|             if (drpUnit.SelectedValue != "0")
 | ||
|             {
 | ||
|                 constructSolution.UnitId = drpUnit.SelectedValue;
 | ||
|             }
 | ||
|             if (drpModelType.SelectedValue != "0")
 | ||
|             {
 | ||
|                 constructSolution.SolutionType = drpModelType.SelectedValue;
 | ||
|             }
 | ||
| 
 | ||
|             if (drpSpecialType.SelectedValue != "0")
 | ||
|             {
 | ||
|                 constructSolution.SpecialSchemeTypeId = drpSpecialType.SelectedValue;
 | ||
|             }
 | ||
| 
 | ||
|             constructSolution.SolutionName = txtSolutionName.Text.Trim();
 | ||
|             if (!string.IsNullOrEmpty(txtCompileDate.Text.Trim()))
 | ||
|             {
 | ||
|                 constructSolution.CompileDate = Convert.ToDateTime(txtCompileDate.Text.Trim());
 | ||
|             }
 | ||
| 
 | ||
|             if (txtUnitWork.Values.Length > 0)
 | ||
|             {
 | ||
|                 constructSolution.UnitWorkIds = string.Join(",", txtUnitWork.Values);
 | ||
|             }
 | ||
| 
 | ||
|             if (txtCNProfessional.Values.Length > 0)
 | ||
|             {
 | ||
|                 constructSolution.CNProfessionalCodes = string.Join(",", txtCNProfessional.Values);
 | ||
|             }
 | ||
| 
 | ||
|             //抄送人
 | ||
|             string sendUserIds = string.Empty;
 | ||
|             if (!string.IsNullOrEmpty(drpCsUsers.Value))
 | ||
|             {
 | ||
|                 sendUserIds = string.Join(",", drpCsUsers.Values);
 | ||
|             }
 | ||
|             constructSolution.CsUsers = sendUserIds;
 | ||
| 
 | ||
|             constructSolution.Edition = Convert.ToInt32(txtEdition.Text);
 | ||
|             constructSolution.ConstructSolutionId = HFConstructSolutionId.Text;
 | ||
|             constructSolution.Content = txtDocContent.Text.Trim();
 | ||
|             
 | ||
|             if (!string.IsNullOrEmpty(ConstructSolutionId))
 | ||
|             {
 | ||
|                 CQMSConstructSolutionService.UpdateConstructSolution(constructSolution);
 | ||
|                 if(string.IsNullOrEmpty(constructSolution.State))
 | ||
|                 {
 | ||
|                     constructSolution.State = Const.CQMSConstructSolution_Compile;
 | ||
|                 }
 | ||
| 
 | ||
|                 LogService.AddSys_Log(CurrUser, constructSolution.Code, ConstructSolutionId,
 | ||
|                     Const.CQMSConstructSolutionMenuId, "修改施工方案");
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 constructSolution.CompileMan = CurrUser.UserId;
 | ||
|                 constructSolution.State = Const.CQMSConstructSolution_Compile;
 | ||
|                 CQMSConstructSolutionService.AddConstructSolution(constructSolution);
 | ||
|                 LogService.AddSys_Log(CurrUser, constructSolution.Code, ConstructSolutionId,
 | ||
|                     Const.CQMSConstructSolutionMenuId, "添加施工方案");
 | ||
|             }
 | ||
|             if (constructSolution.State== Const. CQMSConstructSolution_Compile  && saveType == "submit") 
 | ||
|             {
 | ||
|                 countersign(constructSolution.ConstructSolutionId);
 | ||
|                 constructSolution.State = Const.CQMSConstructSolution_Audit;
 | ||
|                 CQMSConstructSolutionService.UpdateConstructSolution(constructSolution);
 | ||
| 
 | ||
|                 var approve = new Solution_CQMSConstructSolutionApprove();
 | ||
|                 approve.ConstructSolutionId = constructSolution.ConstructSolutionId;
 | ||
|                 approve.ApproveDate = DateTime.Now;
 | ||
|                 approve.ApproveMan = CurrUser.UserId;
 | ||
|                 approve.ApproveType = Const.CQMSConstructSolution_Compile;
 | ||
|                 approve.Edition = Convert.ToInt32(txtEdition.Text);
 | ||
|                 CQMSConstructSolutionApproveService.AddConstructSolutionApprove(approve);
 | ||
|             }
 | ||
|             else if (constructSolution.State == Const.CQMSConstructSolution_ReCompile && saveType == "submit")
 | ||
|             {
 | ||
|                 countersign(constructSolution.ConstructSolutionId);
 | ||
|                 constructSolution.State = Const.CQMSConstructSolution_Audit;
 | ||
|                 CQMSConstructSolutionService.UpdateConstructSolution(constructSolution);
 | ||
|                 var approve = Funs.DB.Solution_CQMSConstructSolutionApprove.Where(x => x.ApproveDate == null &&
 | ||
|                 x.ConstructSolutionId == ConstructSolutionId && x.ApproveMan == CurrUser.UserId && x.ApproveType=="0").First();
 | ||
| 
 | ||
|                 if (approve!=null)
 | ||
|                 {
 | ||
|                     approve.ApproveDate = DateTime.Now;
 | ||
|                     CQMSConstructSolutionApproveService.UpdateConstructSolutionApprove(approve);
 | ||
|                     TbrOperateComplianceObligationsCSort();
 | ||
|                 }
 | ||
| 
 | ||
|             }
 | ||
|             //一级审核
 | ||
|             else if (constructSolution.State == Const.CQMSConstructSolution_Audit && saveType == "submit")
 | ||
|             {
 | ||
|                 UpdateApprove("Yi");
 | ||
|             }
 | ||
|             //二级审批
 | ||
|             else if (constructSolution.State == Const.CQMSConstructSolution_Audit1 && saveType == "submit")
 | ||
|             {
 | ||
|                 UpdateApprove("Er");
 | ||
|             }
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 修改审批意见
 | ||
|         /// </summary>
 | ||
|         private void UpdateApprove(string signType)
 | ||
|         {
 | ||
|             var state = "";
 | ||
|             if (signType == "Yi")
 | ||
|             {
 | ||
|                 state = "2";
 | ||
|             }
 | ||
|             else {
 | ||
|                 state = "3";
 | ||
|             }
 | ||
|             var approveList = CQMSConstructSolutionApproveService.GetThisApproveByConstructSolutionId(ConstructSolutionId, state);
 | ||
|             if (approveList.Any(x => x.ApproveMan.IndexOf(CurrUser.UserId) > -1))
 | ||
|             {
 | ||
|                 var approve = approveList.FirstOrDefault(x => x.ApproveMan == CurrUser.UserId);
 | ||
|                 if (approve.ApproveMan == this.CurrUser.UserId)
 | ||
|                 {
 | ||
|                     approve.ApproveDate = DateTime.Now;
 | ||
|                     approve.IsAgree = Convert.ToBoolean(rblIsAgree.SelectedValue);
 | ||
|                     //approve.ApproveIdea = txtOptions.Text.Trim();
 | ||
|                     approve.Edition = Convert.ToInt32(txtEdition.Text);
 | ||
|                     CQMSConstructSolutionApproveService.UpdateConstructSolutionApprove(approve);
 | ||
| 
 | ||
|                     //如果第二次审批,并且有不同意的情况下,进行修改
 | ||
|                     if (isSendTrue)
 | ||
|                     {
 | ||
|                         SprOperateComplianceObligationsCSort();
 | ||
|                     }
 | ||
| 
 | ||
|                     //不同意的情况下 审批人增加列表
 | ||
|                     if (Convert.ToBoolean(rblIsAgree.SelectedValue) == false)
 | ||
|                     {
 | ||
|                         if (isSendTrue)
 | ||
|                         {
 | ||
|                             SprOperateComplianceObligationsCSort();
 | ||
|                         }
 | ||
|                         else {
 | ||
|                             OperateComplianceObligationsCSort();
 | ||
|                         }
 | ||
|                         
 | ||
|                     }
 | ||
| 
 | ||
|                     CheckIsAllAgree(signType);
 | ||
|                 }
 | ||
|             }
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 判断是否全部同意
 | ||
|         /// </summary>
 | ||
|         private void CheckIsAllAgree(string signType)
 | ||
|         {
 | ||
|             var edtion = Convert.ToInt32(txtEdition.Text);
 | ||
|             var constructSolution =
 | ||
|                 CQMSConstructSolutionService.GetConstructSolutionByConstructSolutionId(ConstructSolutionId);
 | ||
|          
 | ||
| 
 | ||
|             //var needApporveCount = allApproves.Where(x => x.ApproveDate == null).Count();
 | ||
|             //if (needApporveCount>0) return; //判断是否最后一个审批
 | ||
|              
 | ||
|            
 | ||
| 
 | ||
|             //一级审核
 | ||
|             if (signType=="Yi")
 | ||
|             {
 | ||
|                 var allApproves = CQMSConstructSolutionApproveService.GetHandleConstructSolutionApprovesByConstructSolutionId(ConstructSolutionId,
 | ||
|                  constructSolution.Edition == null ? 0 : Convert.ToInt32(constructSolution.Edition));
 | ||
| 
 | ||
|                 var count = allApproves.Where(p => p.SignType == "Yi").Count(); //查询一级所有数量
 | ||
| 
 | ||
|                 var ycount = allApproves.Where(p =>p.ApproveDate != null && p.IsAgree != null 
 | ||
|                 && Convert.ToBoolean(p.IsAgree) && p.SignType=="Yi").Count(); //查询一级审核同意的
 | ||
| 
 | ||
|                 var fcount = allApproves.Where(p =>p.ApproveDate != null && p.IsAgree != null 
 | ||
|                 && !Convert.ToBoolean(p.IsAgree) && p.SignType == "Yi").Count(); //查询一级审核不同意的
 | ||
| 
 | ||
|                 //如果当前已经审核完
 | ||
|                 if (count == (ycount + fcount))
 | ||
|                 {
 | ||
|                     //全部同意
 | ||
|                     if (ycount == count)
 | ||
|                     {
 | ||
|                         //走到下一步,修改施工方案状态为二级审批
 | ||
|                         var cons = CQMSConstructSolutionService.GetConstructSolutionByConstructSolutionId(ConstructSolutionId);
 | ||
|                         cons.State = Const.CQMSConstructSolution_Audit1;
 | ||
|                         CQMSConstructSolutionService.UpdateConstructSolution(cons);
 | ||
| 
 | ||
|                     }
 | ||
|                     else {
 | ||
|                         //有不同意的直接打回
 | ||
|                         var cons = CQMSConstructSolutionService.GetConstructSolutionByConstructSolutionId(
 | ||
|                         ConstructSolutionId);
 | ||
|                         var reApprove = new Solution_CQMSConstructSolutionApprove();
 | ||
|                         reApprove.ConstructSolutionId = constructSolution.ConstructSolutionId;
 | ||
|                         reApprove.ApproveMan = cons.CompileMan;
 | ||
|                         reApprove.ApproveType = Const.CQMSConstructSolution_ReCompile;
 | ||
|                         edtion++;
 | ||
|                         reApprove.Edition = edtion;
 | ||
|                         CQMSConstructSolutionApproveService.AddConstructSolutionApprove(reApprove);
 | ||
| 
 | ||
|                         cons.State = Const.CQMSConstructSolution_ReCompile;
 | ||
|                         cons.CompileDate = DateTime.Now;
 | ||
|                         cons.Edition = edtion;
 | ||
|                         constructSolution.State = Const.CQMSConstructSolution_ReCompile;
 | ||
|                         CQMSConstructSolutionService.UpdateConstructSolution(cons);
 | ||
|                         LogService.AddSys_Log(CurrUser, constructSolution.Code, ConstructSolutionId,
 | ||
|                             Const.CQMSConstructSolutionMenuId, "修改施工方案");
 | ||
|                     }
 | ||
|                 }
 | ||
|                 else {
 | ||
|                     //没有审核完就跳出
 | ||
|                     return;
 | ||
|                 }
 | ||
| 
 | ||
|             }
 | ||
|             else if (signType=="Er")
 | ||
|             {
 | ||
|                 var allApproves = CQMSConstructSolutionApproveService.GetHandleConstructSolutionApprovesByConstructSolutionId2(ConstructSolutionId,
 | ||
|                  constructSolution.Edition == null ? 0 : Convert.ToInt32(constructSolution.Edition));
 | ||
|                 var count = allApproves.Where(p => p.SignType == "Er").Count(); //查询二级所有数量
 | ||
| 
 | ||
|                 var ycount = allApproves.Where(p => p.ApproveDate != null && p.IsAgree != null
 | ||
|                 && Convert.ToBoolean(p.IsAgree) && p.SignType == "Er").Count(); //查询二级审核同意的
 | ||
| 
 | ||
|                 var fcount = allApproves.Where(p => p.ApproveDate != null && p.IsAgree != null
 | ||
|                 && !Convert.ToBoolean(p.IsAgree) && p.SignType == "Er").Count(); //查询二级审核不同意的
 | ||
|                 // 如果当前已经审核完
 | ||
|                 if (count == (ycount + fcount))
 | ||
|                 {
 | ||
|                     //全部同意
 | ||
|                     if (ycount == count)
 | ||
|                     {
 | ||
|                         //完成
 | ||
|                         var cons = CQMSConstructSolutionService.GetConstructSolutionByConstructSolutionId(ConstructSolutionId);
 | ||
|                         cons.State = Const.CQMSConstructSolution_Complete;
 | ||
|                         cons.CompileDate = DateTime.Now;
 | ||
|                         CQMSConstructSolutionService.UpdateConstructSolution(cons);
 | ||
| 
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         //有不同意的直接打回
 | ||
|                         var cons = CQMSConstructSolutionService.GetConstructSolutionByConstructSolutionId(
 | ||
|                         ConstructSolutionId);
 | ||
|                         var reApprove = new Solution_CQMSConstructSolutionApprove();
 | ||
|                         reApprove.ConstructSolutionId = constructSolution.ConstructSolutionId;
 | ||
|                         reApprove.ApproveMan = cons.CompileMan;
 | ||
|                         reApprove.ApproveType = Const.CQMSConstructSolution_ReCompile;
 | ||
|                         edtion++;
 | ||
|                         reApprove.Edition = edtion;
 | ||
|                         CQMSConstructSolutionApproveService.AddConstructSolutionApprove(reApprove);
 | ||
| 
 | ||
|                         cons.State = Const.CQMSConstructSolution_ReCompile;
 | ||
|                         cons.CompileDate = DateTime.Now;
 | ||
|                         cons.Edition = edtion;
 | ||
|                         constructSolution.State = Const.CQMSConstructSolution_ReCompile;
 | ||
|                         CQMSConstructSolutionService.UpdateConstructSolution(cons);
 | ||
|                         LogService.AddSys_Log(CurrUser, constructSolution.Code, ConstructSolutionId,
 | ||
|                             Const.CQMSConstructSolutionMenuId, "修改施工方案");
 | ||
|                     }
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     //没有审核完就跳出
 | ||
|                     return;
 | ||
|                 }
 | ||
| 
 | ||
|             }
 | ||
|             //if (count == allApproves.Count)//全部同意
 | ||
|             //{
 | ||
|                 
 | ||
|             //}
 | ||
| 
 | ||
|             ////有不同意意见,打回重新编制
 | ||
|             //if (fcount > 0)
 | ||
|             //{
 | ||
|                 
 | ||
|             //}
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     保存验证
 | ||
|         /// </summary>
 | ||
|         /// <param name="buttonName"></param>
 | ||
|         /// <param name="tip"></param>
 | ||
|         public void validate(string buttonName, string tip)
 | ||
|         {
 | ||
|             if (CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, CurrUser.UserId,
 | ||
|                     Const.CQMSConstructSolutionMenuId, buttonName))
 | ||
|             {
 | ||
|                 var err = string.Empty;
 | ||
|                 if (!AttachFileService.Getfile(HFConstructSolutionId.Text, Const.CQMSConstructSolutionMenuId))
 | ||
|                     err += "请上传附件,";
 | ||
|                 var list = new List<Tree>();
 | ||
|                 //list.Add(trOne);
 | ||
|                 //list.Add(trThree);
 | ||
|                 //list.Add(trFive);
 | ||
|                 var res = false;
 | ||
|                 foreach (var item in list)
 | ||
|                     if (nodesCheckd(item))
 | ||
|                     {
 | ||
|                         res = true;
 | ||
|                         break;
 | ||
|                     }
 | ||
| 
 | ||
|                 if (!res) err += "请选择总包会签人员,";
 | ||
|                 if (!string.IsNullOrWhiteSpace(err))
 | ||
|                 {
 | ||
|                     err = err.Substring(0, err.LastIndexOf(","));
 | ||
|                     err += "!";
 | ||
|                 }
 | ||
| 
 | ||
|                 if (!string.IsNullOrWhiteSpace(err))
 | ||
|                 {
 | ||
|                     Alert.ShowInTop(err, MessageBoxIcon.Warning);
 | ||
|                     return;
 | ||
|                 }
 | ||
| 
 | ||
|                 if (!string.IsNullOrWhiteSpace(ConstructSolutionId))
 | ||
|                 {
 | ||
|                     //更新时操作
 | ||
|                     if (tip == "save")
 | ||
|                         EditConstructSol("save");
 | ||
|                     else
 | ||
|                         EditConstructSol("submit");
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     if (tip == "save")
 | ||
|                         SaveCQMSConstructSolution("save");
 | ||
|                     else
 | ||
|                         SaveCQMSConstructSolution("submit");
 | ||
|                     //添加时操作           
 | ||
|                 }
 | ||
| 
 | ||
|                 PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | ||
|                 if (tip == "save")
 | ||
|                 {
 | ||
|                     tip = "保存成功!";
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     tip = "提交成功!";
 | ||
|                     CQMSConstructSolutionApproveService.PushMessageToNextMan(ConstructSolutionId);
 | ||
|                 }
 | ||
| 
 | ||
|                 Alert.ShowInTop(tip, MessageBoxIcon.Success);
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
 | ||
|             }
 | ||
|         }
 | ||
|         #region 添加时候的保存
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     保存方案审查
 | ||
|         /// </summary>
 | ||
|         /// <param name="saveType">保存类型</param>
 | ||
|         private void SaveCQMSConstructSolution(string saveType)
 | ||
|         {
 | ||
|             var constructSolution = new Solution_CQMSConstructSolution();
 | ||
|             constructSolution.Code = txtCode.Text.Trim();
 | ||
|             constructSolution.ProjectId = CurrUser.LoginProjectId;
 | ||
|             if (drpUnit.SelectedValue != "0")
 | ||
|             {
 | ||
|                 constructSolution.UnitId = drpUnit.SelectedValue;
 | ||
|             }
 | ||
| 
 | ||
|             if (drpModelType.SelectedValue != "0")
 | ||
|             {
 | ||
|                 constructSolution.SolutionType = drpModelType.SelectedValue;
 | ||
|             }
 | ||
| 
 | ||
|             if (drpSpecialType.SelectedValue != "0")
 | ||
|             {
 | ||
|                 constructSolution.SpecialSchemeTypeId = drpSpecialType.SelectedValue;
 | ||
|             }
 | ||
| 
 | ||
|             constructSolution.SolutionName = txtSolutionName.Text.Trim();
 | ||
|             if (!string.IsNullOrEmpty(txtCompileDate.Text.Trim()))
 | ||
|             {
 | ||
|                 constructSolution.CompileDate = Convert.ToDateTime(txtCompileDate.Text.Trim());
 | ||
|             }
 | ||
| 
 | ||
|             if (txtUnitWork.Values.Length > 0)
 | ||
|             {
 | ||
|                 constructSolution.UnitWorkIds = string.Join(",", txtUnitWork.Values);
 | ||
|             }
 | ||
| 
 | ||
|             if (txtCNProfessional.Values.Length > 0)
 | ||
|             {
 | ||
|                 constructSolution.CNProfessionalCodes = string.Join(",", txtCNProfessional.Values);
 | ||
|             }
 | ||
| 
 | ||
|             if (saveType == "submit")
 | ||
|             {
 | ||
|                 constructSolution.State = Const.CQMSConstructSolution_Audit;
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 constructSolution.State = Const.CQMSConstructSolution_Compile;
 | ||
|             }
 | ||
| 
 | ||
|             constructSolution.CompileMan = CurrUser.UserId;
 | ||
|             constructSolution.Edition = Convert.ToInt32(txtEdition.Text);
 | ||
|             constructSolution.ConstructSolutionId = HFConstructSolutionId.Text;
 | ||
|             constructSolution.Content = txtDocContent.Text.Trim();
 | ||
|             if (!string.IsNullOrEmpty(ConstructSolutionId))
 | ||
|             {
 | ||
|                 CQMSConstructSolutionService.UpdateConstructSolution(constructSolution);
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 CQMSConstructSolutionService.AddConstructSolution(constructSolution);
 | ||
|             }
 | ||
| 
 | ||
| 
 | ||
|             if (saveType == "submit")
 | ||
|             {
 | ||
|                 var approve1 = new Solution_CQMSConstructSolutionApprove();
 | ||
|                 approve1.ConstructSolutionId = constructSolution.ConstructSolutionId;
 | ||
|                 approve1.ApproveDate = DateTime.Now;
 | ||
|                 approve1.ApproveMan = CurrUser.UserId;
 | ||
|                 approve1.ApproveType = Const.CQMSConstructSolution_Compile;
 | ||
|                 approve1.Edition = Convert.ToInt32(txtEdition.Text);
 | ||
|                 CQMSConstructSolutionApproveService.AddConstructSolutionApprove(approve1);
 | ||
|             }
 | ||
| 
 | ||
| 
 | ||
|             LogService.AddSys_Log(CurrUser, constructSolution.Code, ConstructSolutionId,
 | ||
|                 Const.CQMSConstructSolutionMenuId, "添加施工方案");
 | ||
| 
 | ||
|             //}
 | ||
| 
 | ||
|             //提交
 | ||
|             if (saveType == "submit")
 | ||
|             {
 | ||
|                 countersign(constructSolution.ConstructSolutionId);
 | ||
|             }
 | ||
| 
 | ||
|             LogService.AddSys_Log(CurrUser, constructSolution.Code, ConstructSolutionId,
 | ||
|                 Const.CQMSConstructSolutionMenuId, "编制方案审查");
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     删除未选择的代办记录
 | ||
|         /// </summary>
 | ||
|         /// <param name="constructSolutionId"></param>
 | ||
|         private void delSolutionApprove(string constructSolutionId, string man, string signType)
 | ||
|         {
 | ||
|             var count = CQMSConstructSolutionApproveService.getListSolutionApproveCount(constructSolutionId, man,
 | ||
|                 signType);
 | ||
|             if (count > 0) CQMSConstructSolutionApproveService.delSolutionApprove(constructSolutionId, man);
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     会签
 | ||
|         /// </summary>
 | ||
|         private void countersign(string constructSolutionId)
 | ||
|         {
 | ||
|             var solution = CQMSConstructSolutionService.GetConstructSolutionByConstructSolutionId(ConstructSolutionId);
 | ||
|             //一级审核人员
 | ||
|             foreach (var item in drpzyUserIds.Values)
 | ||
|             {
 | ||
|                 var approve = new Solution_CQMSConstructSolutionApprove();
 | ||
|                 approve.ConstructSolutionId = constructSolutionId;
 | ||
|                 approve.ApproveMan = item;
 | ||
|                 approve.ApproveType = Const.CQMSConstructSolution_Audit;
 | ||
|                 approve.SignType = "Yi";
 | ||
|                 var edtion = Convert.ToInt32(txtEdition.Text);
 | ||
|                 //if (solution != null) edtion++;
 | ||
|                 approve.Edition = edtion;
 | ||
|                 approve.Order = 2;
 | ||
|                 //delSolutionApprove(constructSolutionId, item, "Yi");
 | ||
|                 CQMSConstructSolutionApproveService.AddConstructSolutionApprove(approve);
 | ||
|             }
 | ||
|             //二级审批人员
 | ||
|             foreach (var item in drpaqUserIds.Values)
 | ||
|             {
 | ||
|                 var approve = new Solution_CQMSConstructSolutionApprove();
 | ||
|                 approve.ConstructSolutionId = constructSolutionId;
 | ||
|                 approve.ApproveMan = item;
 | ||
|                 approve.ApproveType = Const.CQMSConstructSolution_Audit1;
 | ||
|                 approve.SignType = "Er";
 | ||
|                 var edtion = Convert.ToInt32(txtEdition.Text);
 | ||
|                 //  if (solution != null) edtion++;
 | ||
|                 approve.Edition = edtion;
 | ||
|                 approve.Order = 3;
 | ||
|                 //delSolutionApprove(constructSolutionId, item, "Er");
 | ||
|                 CQMSConstructSolutionApproveService.AddConstructSolutionApprove(approve);
 | ||
|             }
 | ||
|             //foreach (var item in drpsgUserIds.Values)
 | ||
|             //{
 | ||
|             //    var approve = new Solution_CQMSConstructSolutionApprove();
 | ||
|             //    approve.ConstructSolutionId = constructSolutionId;
 | ||
|             //    approve.ApproveMan = item;
 | ||
|             //    approve.ApproveType = Const.CQMSConstructSolution_Audit;
 | ||
|             //    approve.SignType = "SG";
 | ||
|             //    var edtion = Convert.ToInt32(txtEdition.Text);
 | ||
|             //    //if (solution != null) edtion++;
 | ||
|             //    approve.Edition = edtion;
 | ||
|             //    approve.Order = 3;
 | ||
|             //    delSolutionApprove(constructSolutionId, item, "SG");
 | ||
|             //    CQMSConstructSolutionApproveService.AddConstructSolutionApprove(approve);
 | ||
|             //}
 | ||
| 
 | ||
| 
 | ||
|             //if (trOne.Nodes[0].Nodes.Count > 0)
 | ||
|             //    foreach (var tn in trOne.Nodes[0].Nodes)
 | ||
|             //        if (tn.Checked)
 | ||
|             //        {
 | ||
|             //            var approve = new Solution_CQMSConstructSolutionApprove();
 | ||
|             //            approve.ConstructSolutionId = constructSolutionId;
 | ||
|             //            approve.ApproveMan = tn.NodeID;
 | ||
|             //            approve.ApproveType = Const.CQMSConstructSolution_Audit;
 | ||
|             //            approve.SignType = "ZY";
 | ||
|             //            var edtion = Convert.ToInt32(txtEdition.Text);
 | ||
|             //            //if (solution != null) edtion++;
 | ||
|             //            approve.Edition = edtion;
 | ||
|             //            delSolutionApprove(constructSolutionId, tn.NodeID, "ZY");
 | ||
|             //            CQMSConstructSolutionApproveService.AddConstructSolutionApprove(approve);
 | ||
|             //            //APICommonService.SendSubscribeMessage(approve.ApproveMan, "施工方案待办理", this.CurrUser.UserName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
 | ||
|             //        }
 | ||
|             //        else
 | ||
|             //        {
 | ||
|             //            delSolutionApprove(constructSolutionId, tn.NodeID, "ZY");
 | ||
|             //        }
 | ||
| 
 | ||
|             //if (trThree.Nodes[0].Nodes.Count > 0)
 | ||
|             //    foreach (var tn in trThree.Nodes[0].Nodes)
 | ||
|             //        if (tn.Checked)
 | ||
|             //        {
 | ||
|             //            var approve = new Solution_CQMSConstructSolutionApprove();
 | ||
|             //            approve.ConstructSolutionId = constructSolutionId;
 | ||
|             //            approve.ApproveMan = tn.NodeID;
 | ||
|             //            approve.ApproveType = Const.CQMSConstructSolution_Audit;
 | ||
|             //            approve.SignType = "AQ";
 | ||
|             //            var edtion = Convert.ToInt32(txtEdition.Text);
 | ||
|             //            //  if (solution != null) edtion++;
 | ||
|             //            approve.Edition = edtion;
 | ||
|             //            delSolutionApprove(constructSolutionId, tn.NodeID, "AQ");
 | ||
|             //            CQMSConstructSolutionApproveService.AddConstructSolutionApprove(approve);
 | ||
|             //            //APICommonService.SendSubscribeMessage(approve.ApproveMan, "施工方案待办理", this.CurrUser.UserName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
 | ||
|             //        }
 | ||
|             //        else
 | ||
|             //        {
 | ||
|             //            delSolutionApprove(constructSolutionId, tn.NodeID, "AQ");
 | ||
|             //        }
 | ||
| 
 | ||
|             //if (trFive.Nodes[0].Nodes.Count > 0)
 | ||
|             //    foreach (var tn in trFive.Nodes[0].Nodes)
 | ||
|             //        if (tn.Checked)
 | ||
|             //        {
 | ||
|             //            var approve = new Solution_CQMSConstructSolutionApprove();
 | ||
|             //            approve.ConstructSolutionId = constructSolutionId;
 | ||
|             //            approve.ApproveMan = tn.NodeID;
 | ||
|             //            approve.ApproveType = Const.CQMSConstructSolution_Audit;
 | ||
|             //            approve.SignType = "SG";
 | ||
|             //            var edtion = Convert.ToInt32(txtEdition.Text);
 | ||
|             //          //  if (solution != null) edtion++;
 | ||
|             //            approve.Edition = edtion;
 | ||
|             //            delSolutionApprove(constructSolutionId, tn.NodeID, "SG");
 | ||
|             //            CQMSConstructSolutionApproveService.AddConstructSolutionApprove(approve);
 | ||
|             //            // APICommonService.SendSubscribeMessage(approve.ApproveMan, "施工方案待办理", this.CurrUser.UserName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
 | ||
|             //        }
 | ||
|             //        else
 | ||
|             //        {
 | ||
|             //            delSolutionApprove(constructSolutionId, tn.NodeID, "SG");
 | ||
|             //        }
 | ||
|         }
 | ||
| 
 | ||
|         //protected void imgBtnFile_Click(object sender, EventArgs e)
 | ||
|         //{
 | ||
|         //    if (string.IsNullOrEmpty(HFConstructSolutionId.Text)) //新增记录
 | ||
|         //        HFConstructSolutionId.Text = SQLHelper.GetNewID(typeof(Solution_CQMSConstructSolution));
 | ||
|         //    PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
 | ||
|         //        string.Format(
 | ||
|         //            "../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/Solution&menuId={2}",
 | ||
|         //            ContactImg, HFConstructSolutionId.Text, Const.CQMSConstructSolutionMenuId)));
 | ||
|         //}
 | ||
| 
 | ||
|         protected void btnapprove_Click(object sender, EventArgs e)
 | ||
|         {
 | ||
|             //HFConstructSolutionId.Text
 | ||
|             var approve =
 | ||
|                 CQMSConstructSolutionApproveService.GetConstructSolutionApproveByApproveMan(HFConstructSolutionId.Text,
 | ||
|                     CurrUser.UserId);
 | ||
|             if (approve != null)
 | ||
|             {
 | ||
|                 var approveId = approve.ConstructSolutionApproveId;
 | ||
|                 PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
 | ||
|                     string.Format(
 | ||
|                         "../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/Solution&menuId={2}",
 | ||
|                         0, approveId, Const.CQMSConstructSolutionMenuId)));
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         protected void gvApprove_RowCommand(object sender, GridCommandEventArgs e)
 | ||
|         {
 | ||
|             var keys = gvApprove.DataKeys[e.RowIndex];
 | ||
|             var fileId = string.Empty;
 | ||
|             if (keys == null)
 | ||
|                 return;
 | ||
|             fileId = keys[0].ToString();
 | ||
|             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
 | ||
|                 string.Format(
 | ||
|                     "../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/Solution&menuId={2}",
 | ||
|                     -1, fileId, Const.CQMSConstructSolutionMenuId)));
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     根据施工方案加载专项施工方案
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void drpModelType_SelectedIndexChanged(object sender, EventArgs e)
 | ||
|         {
 | ||
|             if (drpModelType.SelectedValue != Const._Null)
 | ||
|             {
 | ||
|                 if (drpModelType.SelectedItem.Text == "施工组织设计")
 | ||
|                 {
 | ||
|                     drpSpecialType.Enabled = false;
 | ||
|                     drpSpecialType.SelectedValue = null;
 | ||
|                     drpSpecialType.Required = false;
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     drpSpecialType.Enabled = true;
 | ||
|                     drpSpecialType.Required = true;
 | ||
|                 }
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         #region 保存/提交
 | ||
| 
 | ||
|         protected void btnSave_Click(object sender, EventArgs e)
 | ||
|         {
 | ||
|             //validate(Const.BtnSave, "save");
 | ||
|             if (CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, CurrUser.UserId,
 | ||
|                     Const.CQMSConstructSolutionMenuId, Const.BtnSave))
 | ||
|             {
 | ||
|                 // SaveCQMSConstructSolution("save");
 | ||
|                 Save("save");
 | ||
|                 PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | ||
|                 Alert.ShowInTop("保存成功!", MessageBoxIcon.Success);
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         protected void btnSubmit_Click(object sender, EventArgs e)
 | ||
|         {
 | ||
|            // validate(Const.BtnSubmit, "submmit");
 | ||
|             if (!CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, CurrUser.UserId,
 | ||
|                     Const.CQMSConstructSolutionMenuId, Const.BtnSubmit))
 | ||
|             {
 | ||
|                 Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
 | ||
|                 return;
 | ||
|             }
 | ||
|             var err = string.Empty;
 | ||
|             //if (!AttachFileService.Getfile(HFConstructSolutionId.Text, Const.CQMSConstructSolutionMenuId))
 | ||
|             //    err += "请上传附件,";
 | ||
|             //var list = new List<Tree>();
 | ||
|             //list.Add(trOne);
 | ||
|             //list.Add(trThree);
 | ||
|             //list.Add(trFive);
 | ||
|             //var res = false;
 | ||
|             //foreach (var item in list)
 | ||
|             //    if (nodesCheckd(item))
 | ||
|             //    {
 | ||
|             //        res = true;
 | ||
|             //        break;
 | ||
|             //    }
 | ||
| 
 | ||
|             //if (!res) err += "请选择总包会签人员,";
 | ||
| 
 | ||
|             if (drpzyUserIds.Values.Length<2)
 | ||
|             {
 | ||
|                 err += "一级审核人员必须选择施工工程师和HSE工程师,当前小于2人,";
 | ||
|             }
 | ||
| 
 | ||
|             if (drpaqUserIds.Values.Length < 3)
 | ||
|             {
 | ||
|                 err += "一二级审批人员必须选择施工经理、HSE经理、质量经理,当前小于3人,";
 | ||
|             }
 | ||
| 
 | ||
|             //if (string.IsNullOrEmpty(drpzyUserIds.Value))
 | ||
|             //{
 | ||
|             //    err += "请选择总包会签专业工程师,";
 | ||
|             //}
 | ||
|             //if (string.IsNullOrEmpty(drpaqUserIds.Value))
 | ||
|             //{
 | ||
|             //    err += "请选择总包会签HSE组,";
 | ||
|             //}
 | ||
|             //if (string.IsNullOrEmpty(drpsgUserIds.Value))
 | ||
|             //{
 | ||
|             //    err += "请选择总包会签施工经理,";
 | ||
|             //}
 | ||
| 
 | ||
|             if (!string.IsNullOrWhiteSpace(err))
 | ||
|             {
 | ||
|                 err = err.Substring(0, err.LastIndexOf(","));
 | ||
|                 err += "!";
 | ||
|             }
 | ||
|             if (!string.IsNullOrEmpty(ConstructSolutionId))
 | ||
|             {
 | ||
|                 var constructSolution =
 | ||
|                     CQMSConstructSolutionService.GetConstructSolutionByConstructSolutionId(ConstructSolutionId);
 | ||
|                 if (constructSolution.State == Const.CQMSConstructSolution_Audit && Convert.ToBoolean(rblIsAgree.SelectedValue)==false)
 | ||
|                 {
 | ||
|                     if (complianceObligationsCs.Count==0)
 | ||
|                     {
 | ||
|                         err += "不同意的情况下请添加修改意见,";
 | ||
|                     }
 | ||
|                 }
 | ||
|             }
 | ||
| 
 | ||
| 
 | ||
|             if (!string.IsNullOrWhiteSpace(err))
 | ||
|             {
 | ||
|                 Alert.ShowInTop(err, MessageBoxIcon.Warning);
 | ||
|                 return;
 | ||
|             }
 | ||
| 
 | ||
|             
 | ||
| 
 | ||
|                 Save("submit");
 | ||
|             CQMSConstructSolutionApproveService.PushMessageToNextMan(ConstructSolutionId);
 | ||
|             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | ||
|             Alert.ShowInTop("提交成功!", MessageBoxIcon.Success);
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     编辑时候保存
 | ||
|         /// </summary>
 | ||
|         private void EditConstructSol(string saveType)
 | ||
|         {
 | ||
|             var constructSolution = new Solution_CQMSConstructSolution();
 | ||
|             constructSolution.Code = txtCode.Text.Trim();
 | ||
|             constructSolution.ProjectId = CurrUser.LoginProjectId;
 | ||
|             if (drpUnit.SelectedValue != "0")
 | ||
|             {
 | ||
|                 constructSolution.UnitId = drpUnit.SelectedValue;
 | ||
|             }
 | ||
| 
 | ||
|             if (drpModelType.SelectedValue != "0")
 | ||
|             {
 | ||
|                 constructSolution.SolutionType = drpModelType.SelectedValue;
 | ||
|             }
 | ||
| 
 | ||
|             if (drpSpecialType.SelectedValue != "0")
 | ||
|             {
 | ||
|                 constructSolution.SpecialSchemeTypeId = drpSpecialType.SelectedValue;
 | ||
|             }
 | ||
| 
 | ||
|             constructSolution.SolutionName = txtSolutionName.Text.Trim();
 | ||
|             var edtion = Convert.ToInt32(txtEdition.Text);
 | ||
|             constructSolution.Edition = edtion;
 | ||
|             if (!string.IsNullOrEmpty(txtCompileDate.Text.Trim()))
 | ||
|             {
 | ||
|                 constructSolution.CompileDate = Convert.ToDateTime(txtCompileDate.Text.Trim());
 | ||
|             }
 | ||
| 
 | ||
|             if (txtUnitWork.Values.Length > 0)
 | ||
|             {
 | ||
|                 constructSolution.UnitWorkIds = string.Join(",", txtUnitWork.Values);
 | ||
|             }
 | ||
| 
 | ||
|             if (txtCNProfessional.Values.Length > 0)
 | ||
|             {
 | ||
|                 constructSolution.CNProfessionalCodes = string.Join(",", txtCNProfessional.Values);
 | ||
|             }
 | ||
| 
 | ||
|             if (!string.IsNullOrEmpty(ConstructSolutionId))
 | ||
|             {
 | ||
|                 constructSolution.ConstructSolutionId = ConstructSolutionId;
 | ||
| 
 | ||
|                 var constructSolution1 =
 | ||
|                     CQMSConstructSolutionService.GetConstructSolutionByConstructSolutionId(ConstructSolutionId);
 | ||
|                 if (saveType == "submit")
 | ||
|                 {
 | ||
|                     if (CurrUser.UserId != constructSolution1.CompileMan) //办理人不是编制人,提示查看审批信息
 | ||
|                     {
 | ||
|                         if (constructSolution1.State == Const.CQMSConstructSolution_Audit)
 | ||
|                         {
 | ||
|                             constructSolution.State = constructSolution1.State;
 | ||
|                         }
 | ||
|                         else
 | ||
|                         {
 | ||
|                             constructSolution.State = Const.CQMSConstructSolution_Audit;
 | ||
|                         }
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         countersign(constructSolution.ConstructSolutionId);
 | ||
|                         constructSolution.State = constructSolution1.State;
 | ||
|                     }
 | ||
| 
 | ||
|                     if (!CurrUser.UserId.Equals(constructSolution1.CompileMan))
 | ||
|                     {
 | ||
|                         var approve = CQMSConstructSolutionApproveService.GetConstructSoluAppByApproveMan(
 | ||
|                             ConstructSolutionId, CurrUser.UserId, Convert.ToInt32(constructSolution1.Edition));
 | ||
|                         if (saveType == "submit")
 | ||
|                         {
 | ||
|                             approve.ApproveDate = DateTime.Now;
 | ||
|                         }
 | ||
| 
 | ||
|                         approve.Edition = Convert.ToInt32(edtion);
 | ||
|                         approve.IsAgree = Convert.ToBoolean(rblIsAgree.SelectedValue);
 | ||
|                         //approve.ApproveIdea = txtOptions.Text.Trim();
 | ||
|                         CQMSConstructSolutionApproveService.UpdateConstructSolutionApprove(approve);
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         if (saveType == "submit")
 | ||
|                         {
 | ||
|                             if (constructSolution1.State == Const.CQMSConstructSolution_Audit) //==会签状态升级版本
 | ||
|                             {
 | ||
|                                 var reApprove = new Solution_CQMSConstructSolutionApprove();
 | ||
|                                 reApprove.ConstructSolutionId = constructSolution.ConstructSolutionId;
 | ||
|                                 reApprove.ApproveDate = DateTime.Now;
 | ||
|                                 reApprove.ApproveMan = constructSolution1.CompileMan;
 | ||
|                                 reApprove.ApproveType = Const.CQMSConstructSolution_ReCompile;
 | ||
|                                 edtion++;
 | ||
|                                 reApprove.Edition = edtion;
 | ||
|                                 CQMSConstructSolutionApproveService.AddConstructSolutionApprove(reApprove);
 | ||
|                             }
 | ||
|                             else
 | ||
|                             {
 | ||
|                                 var approves =
 | ||
|                                     CQMSConstructSolutionApproveService.GetConstructSolApproveByApproveMan(
 | ||
|                                         ConstructSolutionId, constructSolution1.CompileMan);
 | ||
|                                 approves.ApproveDate = DateTime.Now;
 | ||
|                                 CQMSConstructSolutionApproveService.UpdateConstructSolutionApprove(approves);
 | ||
|                             }
 | ||
|                         }
 | ||
|                     }
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     constructSolution.State = constructSolution1.State;
 | ||
|                 }
 | ||
| 
 | ||
|                 //提交时候,更新提交版本
 | ||
|                 if (CurrUser.UserId.Equals(constructSolution1.CompileMan))
 | ||
|                 {
 | ||
|                     if (constructSolution1.State != Const.CQMSConstructSolution_Audit)
 | ||
|                     {
 | ||
|                         edtion++;
 | ||
|                     }
 | ||
| 
 | ||
|                     constructSolution.Edition = Convert.ToInt32(edtion);
 | ||
|                     constructSolution.State = Const.CQMSConstructSolution_Audit;
 | ||
|                 }
 | ||
| 
 | ||
|                 CQMSConstructSolutionService.UpdateConstructSolution(constructSolution);
 | ||
|                 //判断状态,全部会签同意,则审批完成
 | ||
|                 if (saveType == "submit")
 | ||
|                 {
 | ||
|                     var allApproves =
 | ||
|                         CQMSConstructSolutionApproveService.GetHandleConstructSolutionApprovesByConstructSolutionId(
 | ||
|                             ConstructSolutionId,
 | ||
|                             constructSolution.Edition == null ? 0 : Convert.ToInt32(constructSolution.Edition));
 | ||
|                     var count = allApproves.Where(p =>
 | ||
|                         p.ApproveDate != null && p.IsAgree != null && Convert.ToBoolean(p.IsAgree)).Count(); //查询会签同意的
 | ||
|                     var fcount = allApproves.Where(p =>
 | ||
|                         p.ApproveDate != null && p.IsAgree != null && !Convert.ToBoolean(p.IsAgree)).Count(); //查询会签不同意的
 | ||
|                     if (count + fcount == allApproves.Count)
 | ||
|                     {
 | ||
|                         if (count == allApproves.Count)
 | ||
|                         {
 | ||
|                             var cons =
 | ||
|                                 CQMSConstructSolutionService.GetConstructSolutionByConstructSolutionId(
 | ||
|                                     ConstructSolutionId);
 | ||
|                             cons.State = Const.CQMSConstructSolution_Complete;
 | ||
|                             cons.CompileDate = DateTime.Now;
 | ||
|                             CQMSConstructSolutionService.UpdateConstructSolution(cons);
 | ||
|                         }
 | ||
| 
 | ||
|                         //有不同意意见,打回重新编制
 | ||
|                         if (fcount > 0)
 | ||
|                         {
 | ||
|                             var cons =
 | ||
|                                 CQMSConstructSolutionService.GetConstructSolutionByConstructSolutionId(
 | ||
|                                     ConstructSolutionId);
 | ||
|                             var reApprove = new Solution_CQMSConstructSolutionApprove();
 | ||
|                             reApprove.ConstructSolutionId = constructSolution.ConstructSolutionId;
 | ||
|                             reApprove.ApproveMan = cons.CompileMan;
 | ||
|                             reApprove.ApproveType = Const.CQMSConstructSolution_ReCompile;
 | ||
|                             edtion++;
 | ||
|                             reApprove.Edition = edtion;
 | ||
|                             CQMSConstructSolutionApproveService.AddConstructSolutionApprove(reApprove);
 | ||
| 
 | ||
|                             cons.State = Const.CQMSConstructSolution_ReCompile;
 | ||
|                             cons.CompileDate = DateTime.Now;
 | ||
|                             constructSolution.State = Const.CQMSConstructSolution_ReCompile;
 | ||
|                             CQMSConstructSolutionService.UpdateConstructSolution(cons);
 | ||
|                         }
 | ||
|                     }
 | ||
|                 }
 | ||
| 
 | ||
|                 LogService.AddSys_Log(CurrUser, constructSolution.Code, ConstructSolutionId,
 | ||
|                     Const.CQMSConstructSolutionMenuId, "修改施工方案");
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 动态加载角色树
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     设置树的节点选择
 | ||
|         /// </summary>
 | ||
|         /// <param name="nodes"></param>
 | ||
|         /// <param name="role"></param>
 | ||
|         private void SetCheck(Tree tree, List<string> userIds)
 | ||
|         {
 | ||
|             foreach (var tn in tree.Nodes[0].Nodes)
 | ||
|             {
 | ||
|                 if (userIds.Contains(tn.NodeID))
 | ||
|                 {
 | ||
|                     tn.Checked = true;
 | ||
|                     //txtCopyMan.Text += tn.Text;
 | ||
|                 }
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         /// 加载角色树:动态加载
 | ||
|         /// </summary>
 | ||
|         private void BindZYRole()
 | ||
|         {
 | ||
|             var rootNode = new TreeNode(); //定义根节点
 | ||
|             rootNode.Text = "专业工程师";
 | ||
|             rootNode.NodeID = "0";
 | ||
|             rootNode.Expanded = true;
 | ||
|             rootNode.EnableCheckEvent = true;
 | ||
|             //trOne.Nodes.Add(rootNode);
 | ||
|             //trOne.EnableCheckBox = true;
 | ||
|             using (var db = new SGGLDB(Funs.ConnString))
 | ||
|             {
 | ||
|                 var userList = from x in db.Sys_User
 | ||
|                     join y in db.Project_ProjectUnit
 | ||
|                         on x.UnitId equals y.UnitId
 | ||
|                     join p in db.Project_ProjectUser
 | ||
|                         on x.UserId equals p.UserId
 | ||
|                     where p.RoleId.Contains(Const.ZBCNEngineer)
 | ||
|                           && y.UnitType == Const.ProjectUnitType_1 && p.ProjectId == CurrUser.LoginProjectId &&
 | ||
|                           y.ProjectId == CurrUser.LoginProjectId
 | ||
|                     select x;
 | ||
|                 //var ss = LINQToDataTable(userList);
 | ||
|                 foreach (var u in userList)
 | ||
|                 {
 | ||
|                     var Node = new TreeNode();
 | ||
|                     Node.Text = u.UserName;
 | ||
|                     Node.NodeID = u.UserId;
 | ||
|                     Node.EnableCheckEvent = true;
 | ||
|                     rootNode.Nodes.Add(Node);
 | ||
|                 }
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     判断是否有选择
 | ||
|         /// </summary>
 | ||
|         /// <param name="node"></param>
 | ||
|         /// <returns></returns>
 | ||
|         public bool nodesCheckd(Tree node)
 | ||
|         {
 | ||
|             var res = false;
 | ||
|             if (node.Nodes[0].Nodes.Count > 0)
 | ||
|                 foreach (var item in node.Nodes[0].Nodes)
 | ||
|                     if (item.Checked)
 | ||
|                     {
 | ||
|                         res = true;
 | ||
|                         break;
 | ||
|                     }
 | ||
| 
 | ||
|             return res;
 | ||
|         }
 | ||
| 
 | ||
|         private void BindAQRole()
 | ||
|         {
 | ||
|             var rootNode = new TreeNode(); //定义根节点
 | ||
|             rootNode.Text = "HSE组";
 | ||
|             rootNode.NodeID = "0";
 | ||
|             rootNode.Expanded = true;
 | ||
|             rootNode.EnableCheckEvent = true;
 | ||
|             //trThree.Nodes.Add(rootNode);
 | ||
|             //trThree.EnableCheckBox = true;
 | ||
|             using (var db = new SGGLDB(Funs.ConnString))
 | ||
|             {
 | ||
|                 var userList = from x in db.Sys_User
 | ||
|                     join y in db.Project_ProjectUnit
 | ||
|                         on x.UnitId equals y.UnitId
 | ||
|                     join p in db.Project_ProjectUser
 | ||
|                         on x.UserId equals p.UserId
 | ||
|                     where (p.RoleId.Contains(Const.HSSEManager) || p.RoleId.Contains(Const.HSSEEngineer))
 | ||
|                           && y.UnitType == Const.ProjectUnitType_1 && p.ProjectId == CurrUser.LoginProjectId &&
 | ||
|                           y.ProjectId == CurrUser.LoginProjectId
 | ||
|                     orderby x.UserCode
 | ||
|                     select x;
 | ||
|                 foreach (var u in userList)
 | ||
|                 {
 | ||
|                     var roleNode = new TreeNode();
 | ||
|                     roleNode.Text = u.UserName;
 | ||
|                     roleNode.NodeID = u.UserId;
 | ||
|                     rootNode.Nodes.Add(roleNode);
 | ||
|                 }
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         private void BindSGRole()
 | ||
|         {
 | ||
|             var rootNode = new TreeNode(); //定义根节点
 | ||
|             rootNode.Text = "施工经理";
 | ||
|             rootNode.NodeID = "0";
 | ||
|             rootNode.Expanded = true;
 | ||
|             rootNode.EnableCheckEvent = true;
 | ||
|             //trFive.Nodes.Add(rootNode);
 | ||
|             //trFive.EnableCheckBox = true;
 | ||
|             using (var db = new SGGLDB(Funs.ConnString))
 | ||
|             {
 | ||
|                 var userList = from x in db.Sys_User
 | ||
|                     join y in db.Project_ProjectUnit
 | ||
|                         on x.UnitId equals y.UnitId
 | ||
|                     join p in db.Project_ProjectUser
 | ||
|                         on x.UserId equals p.UserId
 | ||
|                     where (p.RoleId.Contains(Const.ConstructionManager) ||
 | ||
|                            p.RoleId.Contains(Const.ConstructionAssistantManager))
 | ||
|                           && y.UnitType == Const.ProjectUnitType_1 && p.ProjectId == CurrUser.LoginProjectId &&
 | ||
|                           y.ProjectId == CurrUser.LoginProjectId
 | ||
|                     orderby x.UserCode
 | ||
|                     select x;
 | ||
|                 foreach (var u in userList)
 | ||
|                 {
 | ||
|                     var roleNode = new TreeNode();
 | ||
|                     roleNode.Text = u.UserName;
 | ||
|                     roleNode.NodeID = u.UserId;
 | ||
|                     rootNode.Nodes.Add(roleNode);
 | ||
|                 }
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 树结构的全选
 | ||
| 
 | ||
|         protected void trOne_NodeCheck(object sender, TreeCheckEventArgs e)
 | ||
|         {
 | ||
|             //if (e.Checked)
 | ||
|             //    trOne.CheckAllNodes(e.Node.Nodes);
 | ||
|             //else
 | ||
|             //    trOne.UncheckAllNodes(e.Node.Nodes);
 | ||
|         }
 | ||
| 
 | ||
|         protected void trTwo_NodeCheck(object sender, TreeCheckEventArgs e)
 | ||
|         {
 | ||
|             /*if (e.Checked)
 | ||
|             {
 | ||
|                 trTwo.CheckAllNodes(e.Node.Nodes);
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 trTwo.UncheckAllNodes(e.Node.Nodes);
 | ||
|             }*/
 | ||
|         }
 | ||
| 
 | ||
|         protected void trThree_NodeCheck(object sender, TreeCheckEventArgs e)
 | ||
|         {
 | ||
|             //if (e.Checked)
 | ||
|             //    trThree.CheckAllNodes(e.Node.Nodes);
 | ||
|             //else
 | ||
|             //    trThree.UncheckAllNodes(e.Node.Nodes);
 | ||
|         }
 | ||
| 
 | ||
|         protected void trFour_NodeCheck(object sender, TreeCheckEventArgs e)
 | ||
|         {
 | ||
|             /*if (e.Checked)
 | ||
|             {
 | ||
|                 trFour.CheckAllNodes(e.Node.Nodes);
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 trFour.UncheckAllNodes(e.Node.Nodes);
 | ||
|             }*/
 | ||
|         }
 | ||
| 
 | ||
|         protected void trFive_NodeCheck(object sender, TreeCheckEventArgs e)
 | ||
|         {
 | ||
|             //if (e.Checked)
 | ||
|             //    trFive.CheckAllNodes(e.Node.Nodes);
 | ||
|             //else
 | ||
|             //    trFive.UncheckAllNodes(e.Node.Nodes);
 | ||
|         }
 | ||
| 
 | ||
|         protected void trSixe_NodeCheck(object sender, TreeCheckEventArgs e)
 | ||
|         {
 | ||
|             /*if (e.Checked)
 | ||
|             {
 | ||
|                 trSixe.CheckAllNodes(e.Node.Nodes);
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 trSixe.UncheckAllNodes(e.Node.Nodes);
 | ||
|             }*/
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 加载一级审核人员
 | ||
|         private void GetCheckManBindGrid1()
 | ||
|         {
 | ||
|             var tb = GetCheckManSource1();
 | ||
|             // 1.设置总项数(特别注意:数据库分页一定要设置总记录数RecordCount)
 | ||
|             Grid1.RecordCount = tb.Rows.Count;
 | ||
| 
 | ||
|             // 2.获取当前分页数据
 | ||
|             var table = this.GetPagedDataTable(Grid1, tb);
 | ||
| 
 | ||
|             // 3.绑定到Grid
 | ||
|             Grid1.DataSource = table;
 | ||
|             Grid1.DataBind();
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 一级审核人员, 施工工程师和HSE工程师
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         private DataTable GetCheckManSource1()
 | ||
|         {
 | ||
|             string sortField = Grid1.SortField;
 | ||
|             string sortDirection = Grid1.SortDirection;
 | ||
| 
 | ||
|             var userList = (from x in Funs.DB.Sys_User
 | ||
|                             join y in Funs.DB.Project_ProjectUnit
 | ||
|                                 on x.UnitId equals y.UnitId
 | ||
|                             join p in Funs.DB.Project_ProjectUser
 | ||
|                                 on x.UserId equals p.UserId
 | ||
|                             where (p.RoleId.Contains(Const.ZBCNEngineer)|| p.RoleId.Contains(Const.HSSEEngineer)
 | ||
|                                    || p.RoleId.Contains(Const.SGEngineer))
 | ||
|                                   && y.UnitType == Const.ProjectUnitType_1 && p.ProjectId == CurrUser.LoginProjectId &&
 | ||
|                                   y.ProjectId == CurrUser.LoginProjectId
 | ||
|                             select x);
 | ||
| 
 | ||
|             DataTable table2 = LINQToDataTable(userList);
 | ||
|             DataView view2 = table2.DefaultView;
 | ||
|             view2.Sort = String.Format("{0} {1}", sortField, sortDirection);
 | ||
| 
 | ||
|             string searchKeyword = ttbSearch1.Text.Trim();
 | ||
|             if (!String.IsNullOrEmpty(searchKeyword) && ttbSearch1.ShowTrigger1)
 | ||
|             {
 | ||
|                 view2.RowFilter = String.Format(" UserName LIKE '%{0}%'", searchKeyword);
 | ||
|             }
 | ||
| 
 | ||
|             return view2.ToTable();
 | ||
|         }
 | ||
| 
 | ||
|         protected void ttbSearch_Trigger1Click1(object sender, EventArgs e)
 | ||
|         {
 | ||
|             ttbSearch1.ShowTrigger1 = true;
 | ||
|             GetCheckManBindGrid1();
 | ||
|         }
 | ||
|         protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
 | ||
|         {
 | ||
|             Grid1.PageIndex = e.NewPageIndex;
 | ||
|             GetCheckManBindGrid1();
 | ||
|         }
 | ||
|         protected void Grid1_Sort(object sender, GridSortEventArgs e)
 | ||
|         {
 | ||
|             Grid1.SortDirection = e.SortDirection;
 | ||
|             Grid1.SortField = e.SortField;
 | ||
|             GetCheckManBindGrid1();
 | ||
|         }
 | ||
|         protected void ttbSearch_Trigger2Click1(object sender, EventArgs e)
 | ||
|         {
 | ||
|             ttbSearch1.ShowTrigger1 = true;
 | ||
|             GetCheckManBindGrid1();
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 加载二级审批人员
 | ||
|         private void GetCheckManBindGrid2()
 | ||
|         {
 | ||
|             var tb = GetCheckManSource2();
 | ||
|             // 1.设置总项数(特别注意:数据库分页一定要设置总记录数RecordCount)
 | ||
|             Grid2.RecordCount = tb.Rows.Count;
 | ||
| 
 | ||
|             // 2.获取当前分页数据
 | ||
|             var table = this.GetPagedDataTable(Grid2, tb);
 | ||
| 
 | ||
|             // 3.绑定到Grid
 | ||
|             Grid2.DataSource = table;
 | ||
|             Grid2.DataBind();
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 二级审批人员显示施工经理、HSE经理、质量经理
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         private DataTable GetCheckManSource2()
 | ||
|         {
 | ||
|             string sortField = Grid2.SortField;
 | ||
|             string sortDirection = Grid2.SortDirection;
 | ||
| 
 | ||
|             var userList = (from x in Funs.DB.Sys_User
 | ||
|                             join y in Funs.DB.Project_ProjectUnit
 | ||
|                                 on x.UnitId equals y.UnitId
 | ||
|                             join p in Funs.DB.Project_ProjectUser
 | ||
|                                 on x.UserId equals p.UserId
 | ||
|                             where (p.RoleId.Contains(Const.HSSEManager) || p.RoleId.Contains(Const.ConstructionManager)
 | ||
|                             || p.RoleId.Contains(Const.QAManager))
 | ||
|                                   && y.UnitType == Const.ProjectUnitType_1 && p.ProjectId == CurrUser.LoginProjectId &&
 | ||
|                                   y.ProjectId == CurrUser.LoginProjectId
 | ||
|                             orderby x.UserCode
 | ||
|                             select x);
 | ||
| 
 | ||
|             DataTable table2 = LINQToDataTable(userList);
 | ||
|             DataView view2 = table2.DefaultView;
 | ||
|             view2.Sort = String.Format("{0} {1}", sortField, sortDirection);
 | ||
| 
 | ||
|             string searchKeyword = ttbSearch1.Text.Trim();
 | ||
|             if (!String.IsNullOrEmpty(searchKeyword) && ttbSearch1.ShowTrigger1)
 | ||
|             {
 | ||
|                 view2.RowFilter = String.Format(" UserName LIKE '%{0}%'", searchKeyword);
 | ||
|             }
 | ||
| 
 | ||
|             return view2.ToTable();
 | ||
|         }
 | ||
| 
 | ||
|         protected void ttbSearch_Trigger1Click2(object sender, EventArgs e)
 | ||
|         {
 | ||
|             ttbSearch2.ShowTrigger1 = true;
 | ||
|             GetCheckManBindGrid2();
 | ||
|         }
 | ||
|         protected void Grid2_PageIndexChange(object sender, GridPageEventArgs e)
 | ||
|         {
 | ||
|             Grid2.PageIndex = e.NewPageIndex;
 | ||
|             GetCheckManBindGrid2();
 | ||
|         }
 | ||
|         protected void Grid2_Sort(object sender, GridSortEventArgs e)
 | ||
|         {
 | ||
|             Grid2.SortDirection = e.SortDirection;
 | ||
|             Grid2.SortField = e.SortField;
 | ||
|             GetCheckManBindGrid2();
 | ||
|         }
 | ||
|         protected void ttbSearch_Trigger2Click2(object sender, EventArgs e)
 | ||
|         {
 | ||
|             ttbSearch2.ShowTrigger1 = true;
 | ||
|             GetCheckManBindGrid2();
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 加载施工经理  不用
 | ||
|         //private void GetCheckManBindGrid3()
 | ||
|         //{
 | ||
|         //    var tb = GetCheckManSource3();
 | ||
|         //    // 1.设置总项数(特别注意:数据库分页一定要设置总记录数RecordCount)
 | ||
|         //    Grid3.RecordCount = tb.Rows.Count;
 | ||
| 
 | ||
|         //    // 2.获取当前分页数据
 | ||
|         //    var table = this.GetPagedDataTable(Grid3, tb);
 | ||
| 
 | ||
|         //    // 3.绑定到Grid
 | ||
|         //    Grid3.DataSource = table;
 | ||
|         //    Grid3.DataBind();
 | ||
|         //}
 | ||
| 
 | ||
|         //private DataTable GetCheckManSource3()
 | ||
|         //{
 | ||
|         //    string sortField = Grid3.SortField;
 | ||
|         //    string sortDirection = Grid3.SortDirection;
 | ||
| 
 | ||
|         //    var userList = (from x in Funs.DB.Sys_User
 | ||
|         //                    join y in Funs.DB.Project_ProjectUnit
 | ||
|         //                        on x.UnitId equals y.UnitId
 | ||
|         //                    join p in Funs.DB.Project_ProjectUser
 | ||
|         //                        on x.UserId equals p.UserId
 | ||
|         //                    where (p.RoleId.Contains(Const.ConstructionManager) ||
 | ||
|         //                           p.RoleId.Contains(Const.ConstructionAssistantManager))
 | ||
|         //                          && y.UnitType == Const.ProjectUnitType_1 && p.ProjectId == CurrUser.LoginProjectId &&
 | ||
|         //                          y.ProjectId == CurrUser.LoginProjectId
 | ||
|         //                    orderby x.UserCode
 | ||
|         //                    select x);
 | ||
| 
 | ||
|         //    DataTable table2 = LINQToDataTable(userList);
 | ||
|         //    DataView view2 = table2.DefaultView;
 | ||
|         //    view2.Sort = String.Format("{0} {1}", sortField, sortDirection);
 | ||
| 
 | ||
|         //    string searchKeyword = ttbSearch1.Text.Trim();
 | ||
|         //    if (!String.IsNullOrEmpty(searchKeyword) && ttbSearch1.ShowTrigger1)
 | ||
|         //    {
 | ||
|         //        view2.RowFilter = String.Format(" UserName LIKE '%{0}%'", searchKeyword);
 | ||
|         //    }
 | ||
| 
 | ||
|         //    return view2.ToTable();
 | ||
|         //}
 | ||
| 
 | ||
|         //protected void ttbSearch_Trigger1Click3(object sender, EventArgs e)
 | ||
|         //{
 | ||
|         //    ttbSearch3.ShowTrigger1 = true;
 | ||
|         //    GetCheckManBindGrid3();
 | ||
|         //}
 | ||
|         //protected void Grid3_PageIndexChange(object sender, GridPageEventArgs e)
 | ||
|         //{
 | ||
|         //    Grid3.PageIndex = e.NewPageIndex;
 | ||
|         //    GetCheckManBindGrid3();
 | ||
|         //}
 | ||
|         //protected void Grid3_Sort(object sender, GridSortEventArgs e)
 | ||
|         //{
 | ||
|         //    Grid3.SortDirection = e.SortDirection;
 | ||
|         //    Grid3.SortField = e.SortField;
 | ||
|         //    GetCheckManBindGrid3();
 | ||
|         //}
 | ||
|         //protected void ttbSearch_Trigger2Click3(object sender, EventArgs e)
 | ||
|         //{
 | ||
|         //    ttbSearch3.ShowTrigger1 = true;
 | ||
|         //    GetCheckManBindGrid3();
 | ||
|         //}
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 加载抄送人员
 | ||
|         private void GetCheckManBindGrid4()
 | ||
|         {
 | ||
|             var tb = GetCheckManSource4();
 | ||
|             // 1.设置总项数(特别注意:数据库分页一定要设置总记录数RecordCount)
 | ||
|             Grid4.RecordCount = tb.Rows.Count;
 | ||
| 
 | ||
|             // 2.获取当前分页数据
 | ||
|             var table = this.GetPagedDataTable(Grid4, tb);
 | ||
| 
 | ||
|             // 3.绑定到Grid
 | ||
|             Grid4.DataSource = table;
 | ||
|             Grid4.DataBind();
 | ||
|         }
 | ||
| 
 | ||
|         private DataTable GetCheckManSource4()
 | ||
|         {
 | ||
|             string sortField = Grid4.SortField;
 | ||
|             string sortDirection = Grid4.SortDirection;
 | ||
| 
 | ||
|             var userList = (from x in Funs.DB.Sys_User
 | ||
|                             join y in Funs.DB.Project_ProjectUnit
 | ||
|                                 on x.UnitId equals y.UnitId
 | ||
|                             join p in Funs.DB.Project_ProjectUser
 | ||
|                                 on x.UserId equals p.UserId
 | ||
|                             where p.ProjectId == CurrUser.LoginProjectId &&
 | ||
|                                   y.ProjectId == CurrUser.LoginProjectId
 | ||
|                             orderby x.UserCode
 | ||
|                             select x);
 | ||
| 
 | ||
|             DataTable table2 = LINQToDataTable(userList);
 | ||
|             DataView view2 = table2.DefaultView;
 | ||
|             view2.Sort = String.Format("{0} {1}", sortField, sortDirection);
 | ||
| 
 | ||
|             string searchKeyword = ttbSearch4.Text.Trim();
 | ||
|             if (!String.IsNullOrEmpty(searchKeyword) && ttbSearch4.ShowTrigger1)
 | ||
|             {
 | ||
|                 view2.RowFilter = String.Format(" UserName LIKE '%{0}%'", searchKeyword);
 | ||
|             }
 | ||
| 
 | ||
|             return view2.ToTable();
 | ||
|         }
 | ||
| 
 | ||
|         protected void ttbSearch_Trigger1Click4(object sender, EventArgs e)
 | ||
|         {
 | ||
|             ttbSearch4.ShowTrigger1 = true;
 | ||
|             GetCheckManBindGrid4();
 | ||
|         }
 | ||
|         protected void Grid4_PageIndexChange(object sender, GridPageEventArgs e)
 | ||
|         {
 | ||
|             Grid4.PageIndex = e.NewPageIndex;
 | ||
|             GetCheckManBindGrid4();
 | ||
|         }
 | ||
|         protected void Grid4_Sort(object sender, GridSortEventArgs e)
 | ||
|         {
 | ||
|             Grid4.SortDirection = e.SortDirection;
 | ||
|             Grid4.SortField = e.SortField;
 | ||
|             GetCheckManBindGrid4();
 | ||
|         }
 | ||
|         protected void ttbSearch_Trigger2Click4(object sender, EventArgs e)
 | ||
|         {
 | ||
|             ttbSearch4.ShowTrigger1 = true;
 | ||
|             GetCheckManBindGrid4();
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region  linq结果转换datatable
 | ||
|         /// <summary>
 | ||
|         /// linq结果转换datatable
 | ||
|         /// </summary>
 | ||
|         /// <typeparam name="T"></typeparam>
 | ||
|         /// <param name="varlist"></param>
 | ||
|         /// <returns></returns>
 | ||
|         public DataTable LINQToDataTable<T>(IEnumerable<T> varlist)
 | ||
| 
 | ||
|         {
 | ||
|             DataTable dtReturn = new DataTable();
 | ||
|             // column names 
 | ||
|             PropertyInfo[] oProps = null;
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
|             if (varlist == null) return dtReturn;
 | ||
| 
 | ||
|             foreach (T rec in varlist)
 | ||
|             {
 | ||
|                 // Use reflection to get property names, to create table, Only first time, others 
 | ||
|                  if (oProps == null)
 | ||
|                 {
 | ||
|                     oProps = ((Type)rec.GetType()).GetProperties();
 | ||
|                     foreach (PropertyInfo pi in oProps)
 | ||
|                     {
 | ||
|                         Type colType = pi.PropertyType;
 | ||
| 
 | ||
|                         if ((colType.IsGenericType) && (colType.GetGenericTypeDefinition()
 | ||
|                         == typeof(Nullable<>)))
 | ||
|                         {
 | ||
|                             colType = colType.GetGenericArguments()[0];
 | ||
|                         }
 | ||
| 
 | ||
|                         dtReturn.Columns.Add(new DataColumn(pi.Name, colType));
 | ||
|                     }
 | ||
|                 }
 | ||
| 
 | ||
|                 DataRow dr = dtReturn.NewRow();
 | ||
| 
 | ||
|                 foreach (PropertyInfo pi in oProps)
 | ||
|                 {
 | ||
|                     dr[pi.Name] = pi.GetValue(rec, null) == null ? DBNull.Value : pi.GetValue
 | ||
|                     (rec, null);
 | ||
|                 }
 | ||
| 
 | ||
|                 dtReturn.Rows.Add(dr);
 | ||
|             }
 | ||
|             return dtReturn;
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 审批填写表格
 | ||
|         /// <summary>
 | ||
|         /// 审批人保存第一次
 | ||
|         /// </summary>
 | ||
|         private void OperateComplianceObligationsCSort()
 | ||
|         {
 | ||
|             BLL.ComplianceObligationsCService.DeleteSolution_CQMSConstructSolutionApprove_Item(ConstructSolutionId,CurrUser.UserId);
 | ||
|             jerqueSaveComplianceObligationsCList();
 | ||
|             foreach (Model.Solution_CQMSConstructSolutionApprove_Item coc in complianceObligationsCs)
 | ||
|             {
 | ||
|                 coc.ConstructSolutionId = ConstructSolutionId;
 | ||
|                 BLL.ComplianceObligationsCService.AddSolution_CQMSConstructSolutionApprove_Item(coc);
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 填报人保存(修改)
 | ||
|         /// </summary>
 | ||
|         private void TbrOperateComplianceObligationsCSort()
 | ||
|         {
 | ||
|             jerqueSaveComplianceObligationsCListTbr();
 | ||
|             foreach (Model.Solution_CQMSConstructSolutionApprove_Item coc in complianceObligationsCs)
 | ||
|             {
 | ||
|                 coc.ConstructSolutionId = ConstructSolutionId;
 | ||
|                 BLL.ComplianceObligationsCService.UpdateSolution_CQMSConstructSolutionApprove_Item(coc);
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 审批人(修改)
 | ||
|         /// </summary>
 | ||
|         private void SprOperateComplianceObligationsCSort()
 | ||
|         {
 | ||
|             jerqueSaveComplianceObligationsCListSpr();
 | ||
|             foreach (Model.Solution_CQMSConstructSolutionApprove_Item coc in complianceObligationsCs)
 | ||
|             {
 | ||
|                 coc.ConstructSolutionId = ConstructSolutionId;
 | ||
|                 BLL.ComplianceObligationsCService.UpdateSolution_CQMSConstructSolutionApprove_ItemNew(coc);
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         protected void btnNew_Click(object sender, EventArgs e)
 | ||
|         {
 | ||
|             jerqueSaveComplianceObligationsCList();
 | ||
|             Model.Solution_CQMSConstructSolutionApprove_Item complianceObligationsC = new Model.Solution_CQMSConstructSolutionApprove_Item
 | ||
|             {
 | ||
|                 Id = SQLHelper.GetNewID(typeof(Model.Solution_CQMSConstructSolutionApprove_Item))
 | ||
|             };
 | ||
|             complianceObligationsCs.Add(complianceObligationsC);
 | ||
|             this.gvOperateComplianceObligations.DataSource = complianceObligationsCs;
 | ||
|             this.gvOperateComplianceObligations.DataBind();
 | ||
|         }
 | ||
| 
 | ||
|         private void jerqueSaveComplianceObligationsCList()
 | ||
|         {
 | ||
|             complianceObligationsCs.Clear();
 | ||
|             JArray mergedData = gvOperateComplianceObligations.GetMergedData();
 | ||
|             foreach (JObject mergedRow in mergedData)
 | ||
|             {
 | ||
|                 string status = mergedRow.Value<string>("status");
 | ||
|                 JObject values = mergedRow.Value<JObject>("values");
 | ||
|                 int i = mergedRow.Value<int>("index");
 | ||
|                var hazardSort = new Model.Solution_CQMSConstructSolutionApprove_Item
 | ||
|                 {
 | ||
|                    Id = this.gvOperateComplianceObligations.Rows[i].DataKeys[0].ToString(),
 | ||
|                    SortId= i+1,
 | ||
|                    Chapter = values.Value<string>("Chapter").ToString(),
 | ||
|                    Amendment = values.Value<string>("Amendment").ToString(),
 | ||
|                    Proposer = CurrUser.UserId,
 | ||
|                    ProposerName= CurrUser.UserName,
 | ||
|                    Modification = values.Value<string>("Modification").ToString(),
 | ||
|                    ReviewerOpinion = values.Value<string>("ReviewerOpinion").ToString(),
 | ||
|                    IsAccept = values.Value<string>("IsAccept").ToString(),
 | ||
|                };
 | ||
|                 complianceObligationsCs.Add(hazardSort);
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         private void jerqueSaveComplianceObligationsCListTbr()
 | ||
|         {
 | ||
|             complianceObligationsCs.Clear();
 | ||
|             JArray mergedData = gvOperateComplianceObligations.GetMergedData();
 | ||
|             foreach (JObject mergedRow in mergedData)
 | ||
|             {
 | ||
|                 string status = mergedRow.Value<string>("status");
 | ||
|                 JObject values = mergedRow.Value<JObject>("values");
 | ||
|                 int i = mergedRow.Value<int>("index");
 | ||
|                 var hazardSort = new Model.Solution_CQMSConstructSolutionApprove_Item
 | ||
|                 {
 | ||
|                     Id = this.gvOperateComplianceObligations.Rows[i].DataKeys[0].ToString(),
 | ||
|                     Modification = values.Value<string>("Modification").ToString(),
 | ||
|                    
 | ||
|                 };
 | ||
|                 complianceObligationsCs.Add(hazardSort);
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         private void jerqueSaveComplianceObligationsCListSpr()
 | ||
|         {
 | ||
|             complianceObligationsCs.Clear();
 | ||
|             JArray mergedData = gvOperateComplianceObligations.GetMergedData();
 | ||
|             foreach (JObject mergedRow in mergedData)
 | ||
|             {
 | ||
|                 string status = mergedRow.Value<string>("status");
 | ||
|                 JObject values = mergedRow.Value<JObject>("values");
 | ||
|                 int i = mergedRow.Value<int>("index");
 | ||
|                 var hazardSort = new Model.Solution_CQMSConstructSolutionApprove_Item
 | ||
|                 {
 | ||
|                     Id = this.gvOperateComplianceObligations.Rows[i].DataKeys[0].ToString(),
 | ||
|                     ReviewerOpinion= values.Value<string>("ReviewerOpinion").ToString(),
 | ||
|                     IsAccept = values.Value<string>("IsAccept").ToString(),
 | ||
| 
 | ||
|                 };
 | ||
|                 complianceObligationsCs.Add(hazardSort);
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         protected void gvOperateComplianceObligations_RowCommand(object sender, GridCommandEventArgs e)
 | ||
|         {
 | ||
|             jerqueSaveComplianceObligationsCList();
 | ||
|             string rowID = this.gvOperateComplianceObligations.DataKeys[e.RowIndex][0].ToString();
 | ||
|             if (e.CommandName == "Delete")
 | ||
|             {
 | ||
|                 foreach (var item in complianceObligationsCs)
 | ||
|                 {
 | ||
|                     if (item.Id == rowID)
 | ||
|                     {
 | ||
|                         complianceObligationsCs.Remove(item);
 | ||
|                         break;
 | ||
|                     }
 | ||
|                 }
 | ||
|                 gvOperateComplianceObligations.DataSource = complianceObligationsCs;
 | ||
|                 gvOperateComplianceObligations.DataBind();
 | ||
|                 ShowNotify("删除数据成功!", MessageBoxIcon.Success);
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 不同意的情况下显示
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void radChange(object sender, EventArgs e) {
 | ||
|                 //不同意的情况下
 | ||
|             if (rblIsAgree.SelectedValue == "false")
 | ||
|             {
 | ||
|                 if (isSendTrue)
 | ||
|                 { 
 | ||
|                     
 | ||
|                 }
 | ||
|                 else {
 | ||
|                     //显示
 | ||
|                     options.Hidden = false;
 | ||
|                     options1.Hidden = false;
 | ||
|                     //第一次
 | ||
|                     gvOperateComplianceObligations.AllColumns[4].Hidden = true;
 | ||
|                     gvOperateComplianceObligations.AllColumns[5].Hidden = true;
 | ||
|                     gvOperateComplianceObligations.AllColumns[6].Hidden = true;
 | ||
|                     gvOperateComplianceObligations.AllColumns[7].Hidden = true;
 | ||
|                 }
 | ||
|                    
 | ||
|             }
 | ||
|             else {
 | ||
|                 if (isSendTrue)
 | ||
|                 {
 | ||
| 
 | ||
|                 }
 | ||
|                 else {
 | ||
|                     //同意的情况下
 | ||
|                     options.Hidden = true;
 | ||
|                     options1.Hidden = true;
 | ||
|                 }
 | ||
|             }
 | ||
|         }
 | ||
|     }
 | ||
| } |