/// <summary>
    /// 初始化发起部门
    /// </summary>
    private void InitStartDeptment()
    {
        if (!IsPostBack)
        {
            Department deptInfo           = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(_BPMContext.CurrentUser.MainDeptId);
            BFPmsUserRoleDepartment bfurd = new BFPmsUserRoleDepartment();
            Pkurg.PWorld.Entities.TList <Department> deptInfo2 = bfurd.GetDeptListByEmployeeCodeAndRoleName(_BPMContext.CurrentPWordUser.EmployeeCode, "部门成员");

            ddlDepartName.Items.Add(new ListItem()
            {
                Text  = deptInfo.Remark,
                Value = deptInfo.DepartCode
            });
            //初始化发起人所属“部门成员”的部门
            //首先初始化发起人所在部门,然后在加上发起人所属“部门成员”的部门,需要去重
            //解决了一个系统的bug[有个人,他的所在部门A“部门成员”为空,他是部门B的“部门成员“,部门A没有会签部门,部门B有,
            //初始化会签部门时,默认初始化他的所在部门A,发起部门初始化成部门B,这样导致他发流程没有会签部门可以勾选]
            foreach (Department DeptItem in deptInfo2)
            {
                if (deptInfo.DepartCode != DeptItem.DepartCode)
                {
                    ListItem item = new ListItem()
                    {
                        Text  = DeptItem.Remark,
                        Value = DeptItem.DepartCode
                    };
                    ddlDepartName.Items.Add(item);
                }
            }
        }
    }
Exemple #2
0
    /// <summary>
    /// 页面初始化
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            InitStartDeptment();

            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                WorkFlowInstance info = new WF_WorkFlowInstance().GetWorkFlowInstanceById(Request.QueryString["id"]);
                FormId = info.FormId;
                InitFormData();
                SetUserControlInstance();
            }
            else
            {
                string     StartDeptId = ddlDepartName.SelectedItem.Value;
                Department deptInfo    = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(StartDeptId);
                Countersign1.CounterSignDeptId = StartDeptId;
                FormId = string.Empty;
            }
            InitCheckBoxList();
            InitLeader();
            InitForm();
        }
    }
Exemple #3
0
    /// <summary>
    /// 初始化经办部门
    /// </summary>
    private void InitStartDeptment()
    {
        if (!IsPostBack)
        {
            Department deptInfo           = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(_BPMContext.CurrentUser.MainDeptId);
            BFPmsUserRoleDepartment bfurd = new BFPmsUserRoleDepartment();
            Pkurg.PWorld.Entities.TList <Department> deptInfo2 = bfurd.GetDeptListByEmployeeCodeAndRoleName(_BPMContext.CurrentPWordUser.EmployeeCode, "部门成员");

            //初始化发起人所属“部门成员”的部门,若为空则初始化发起人所在部门
            foreach (Department DeptItem in deptInfo2)
            {
                ddlDepartName.Items.Add(new ListItem()
                {
                    Text  = DeptItem.Remark,
                    Value = DeptItem.DepartCode
                });
            }
            if (deptInfo2.Count == 0)
            {
                ddlDepartName.Items.Add(new ListItem()
                {
                    Text  = deptInfo.Remark,
                    Value = deptInfo.DepartCode
                });
            }
        }
    }
    protected void InitDepartName()
    {
        Department deptInfo           = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(_BPMContext.CurrentUser.MainDeptId);
        BFPmsUserRoleDepartment bfurd = new BFPmsUserRoleDepartment();

        Pkurg.PWorld.Entities.TList <Department> deptInfo2 = bfurd.GetDeptListByEmployeeCodeAndRoleName(_BPMContext.CurrentPWordUser.EmployeeCode, "部门成员");

        ddlDepartName.Items.Add(new ListItem()
        {
            Text  = deptInfo.Remark,
            Value = deptInfo.DepartCode
        });

        foreach (Department deptItem in deptInfo2)
        {
            if (deptInfo.DepartCode != deptItem.DepartCode)
            {
                ListItem item = new ListItem()
                {
                    Text  = deptItem.Remark,
                    Value = deptItem.DepartCode
                };
                ddlDepartName.Items.Add(item);
            }
        }
    }
    /// <summary>
    /// 页面初始化
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        //防止二次提交
        ScriptManager.RegisterOnSubmitStatement(Page, typeof(Page), "Go_disabled", "disabledButton('lbAgree');disabledButton('lbReject');disabledButton('lbSubmit');");
        ScriptManager.RegisterStartupScript(Page, typeof(Page), "Clear_disabled", "enableButton('lbAgree');enableButton('lbReject');enableButton('lbSubmit');", true);

        if (!IsPostBack)
        {
            //初始化起始部门
            InitStartDeptment();

            string instId = Request.QueryString["id"];
            if (string.IsNullOrEmpty(instId))
            {
                //得到表单编号
                FormId = BPMHelp.GetSerialNumber("RWSP_");
                //得到起始部门列表
                StartDeptId = ddlDepartName.SelectedItem.Value;
                Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(StartDeptId);
                //根据登录名得到申请时间
                tbDateTime.Text = DateTime.Now.ToString();
            }
            else
            {
                WorkFlowInstance info = new WF_WorkFlowInstance().GetWorkFlowInstanceById(instId);
                FormId = info.FormId;
                //根据FormId初始化表单数据
                InitFormData(FormId);
                //设置用户控制实例
                SetUserControlInstance();
            }

            if (ddlDepartName.SelectedItem.Text.Contains("开封"))
            {
                cblFirstLevel.Visible = true;
            }

            //根据发起部门来判断是属于集团还是子公司
            if (StartDeptId.Contains("S363"))
            {
                cblIsImpowerProject.Visible = false;
                lbIsImpowerProject.Visible  = false;
                zbcgOpinion.Visible         = false;
                fwOpinion.Visible           = false;
            }
            else
            {
                cblIsImpowerProject.Visible = true;
                lbIsImpowerProject.Visible  = true;
                zbcgOpinion.Visible         = true;
                fwOpinion.Visible           = true;
            }
        }
    }
Exemple #6
0
    /// <summary>
    /// 页面初始化[页面第一次加载时就需要根据当前登录用户自动填写申请人,电话,日期,表单编号等内容]
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        //防止二次提交
        ScriptManager.RegisterOnSubmitStatement(Page, typeof(Page), "Go_disabled", "disabledButton('lbAgree');disabledButton('lbReject');disabledButton('lbSubmit');");
        ScriptManager.RegisterStartupScript(Page, typeof(Page), "Clear_disabled", "enableButton('lbAgree');enableButton('lbReject');enableButton('lbSubmit');", true);

        if (!IsPostBack)
        {
            //初始化起始部门
            InitStartDeptment();

            string instId = Request.QueryString["id"];
            if (string.IsNullOrEmpty(instId))
            {
                //得到表单编号
                FormId = BPMHelp.GetSerialNumber("ZBXQ_");
                //得到起始部门列表
                StartDeptId = ddlDepartName.SelectedItem.Value;
                Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(StartDeptId);
                //根据登录名得到申请人的姓名,电话,以及当前时间
                tbDateTime.Text = DateTime.Now.ToString();
                tbUserName.Text = _BPMContext.CurrentPWordUser.EmployeeName;
                if (_BPMContext.CurrentPWordUser.MobilePhone == null)
                {
                    tbMobile.Text = "";
                }
                else
                {
                    tbMobile.Text = _BPMContext.CurrentPWordUser.MobilePhone;
                }

                tbReportCode.Text = FormId;
            }
            else
            {
                WorkFlowInstance info = new WF_WorkFlowInstance().GetWorkFlowInstanceById(instId);
                FormId = info.FormId;
                //根据FormId初始化表单数据
                InitFormData(FormId);
                //设置用户控制实例
                SetUserControlInstance();
            }

            //InitcbGroupRealateDept();

            if (ddlDepartName.SelectedItem.Text.Contains("开封"))
            {
                cblFirstLevel.Visible       = true;
                cblFirstLevel.SelectedIndex = 0;
            }
        }
    }
Exemple #7
0
    /// <summary>
    /// 保存流程实例
    /// </summary>
    /// <returns></returns>
    private string SaveWorkFlowInstance()
    {
        string startDeptName = "";

        if (string.IsNullOrWhiteSpace(StartDeptId))
        {
            StartDeptId   = CurrentEmployee.DepartCode;
            startDeptName = CurrentEmployee.DepartName;
        }
        else
        {
            Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(StartDeptId);
            if (deptInfo != null)
            {
                startDeptName = deptInfo.Remark;
            }
        }

        WorkFlowInstance workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(FormId);

        if (workFlowInstance == null)
        {
            workFlowInstance                  = new WorkFlowInstance();
            workFlowInstance.InstanceId       = Guid.NewGuid().ToString();
            workFlowInstance.CreateAtTime     = DateTime.Now;
            workFlowInstance.AppId            = AppID;
            workFlowInstance.FormId           = FormId;
            workFlowInstance.CreateDeptCode   = StartDeptId;// CurrentEmployee.DepartCode;
            workFlowInstance.CreateDeptName   = startDeptName;
            workFlowInstance.CreateByUserCode = CurrentEmployee.EmployeeCode;
            workFlowInstance.CreateByUserName = CurrentEmployee.EmployeeName;
            workFlowInstance.FormTitle        = GetFormTitle();
            workFlowInstance.WfStatus         = "0";
            wf_WorkFlowInstance.AddWorkFlowInstance(workFlowInstance);

            SaveWorkItem(workFlowInstance.InstanceId);
            _BPMContext.ProcID = workFlowInstance.InstanceId;
        }
        else
        {
            workFlowInstance.CreateDeptCode   = StartDeptId;
            workFlowInstance.CreateDeptName   = startDeptName;
            workFlowInstance.UpdateByUserCode = CurrentEmployee.EmployeeCode;
            workFlowInstance.UpdateByUserName = CurrentEmployee.EmployeeName;
            workFlowInstance.FormTitle        = GetFormTitle();
            wf_WorkFlowInstance.UpdateWorkFlowInstance(workFlowInstance);
        }

        return(workFlowInstance == null ? "" : workFlowInstance.InstanceId);
    }
    //private void InintData()
    //{
    //    string methodName = "InintData";
    //    Logger.Write(this.GetType(), EnumLogLevel.Info, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.IN);
    //    try
    //    {
    //        InitFormData();
    //        if (instructionOfPkurg != null)
    //        {
    //            tbDepartName.Text = instructionOfPkurg.DeptName;
    //            WorkFlowInstance workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(instructionOfPkurg.FormId);
    //            AddSign1.ProcId = workFlowInstance.InstanceId;
    //            #region 审批意见框
    //            ApproveOpinionUCDeptleader.InstanceId = workFlowInstance.InstanceId;
    //            ApproveOpinionUCRealateDept.InstanceId = workFlowInstance.InstanceId;
    //            ApproveOpinionUCLeader.InstanceId = workFlowInstance.InstanceId;
    //            ApproveOpinionUCCEO.InstanceId = workFlowInstance.InstanceId;

    //            if (ApproveOpinionUCDeptleader.CurrentNodeName == nodeName.Value)
    //            {
    //                ApproveOpinionUCDeptleader.CurrentNode = true;
    //            }

    //            if (ApproveOpinionUCRealateDept.CurrentNodeName == nodeName.Value)
    //            {
    //                ApproveOpinionUCRealateDept.CurrentNode = true;
    //            }

    //            if (ApproveOpinionUCLeader.CurrentNodeName == nodeName.Value)
    //            {
    //                ApproveOpinionUCLeader.CurrentNode = true;
    //            }

    //            if (ApproveOpinionUCCEO.CurrentNodeName == nodeName.Value)
    //            {
    //                ApproveOpinionUCCEO.CurrentNode = true;
    //            }
    //            #endregion

    //            //查询已经添加的附件
    //            //UploadFilesUC1.BindAttachmentListByCode(ViewState["FormID"].ToString());
    //            UploadAttachments1.ProcId = workFlowInstance.InstanceId;
    //        }

    //    }
    //    catch (Exception ex)
    //    {

    //        Logger.Write(this.GetType(), EnumLogLevel.Fatal, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.Exception + ":" + string.Format("Exception={0}", ex));
    //        throw ex;
    //    }
    //    Logger.Write(this.GetType(), EnumLogLevel.Info, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.OUT);
    //}

    /// <summary>
    /// 加载表单
    /// </summary>
    private void InitFormData()
    {
        try
        {
            InstructionInfo formDataInfo = Instruction.GetInstructionInfo(FormId);
            Department      deptInfo     = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(formDataInfo.StartDeptId);
            tbDepartName.Text  = deptInfo.Remark;
            cbChairman.Checked = formDataInfo.IsCheckedChairman == 1;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Exemple #9
0
    /// <summary>
    /// 获取发起部门数据源
    /// 部门名称:Remark
    /// Code:DepartCode
    /// </summary>
    /// <returns></returns>
    protected List <Department> GetStartDeptmentDataSource()
    {
        List <Department>       deptments = new List <Department>();
        Department              deptInfo  = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(_BPMContext.CurrentUser.MainDeptId);
        BFPmsUserRoleDepartment bfurd     = new BFPmsUserRoleDepartment();

        Pkurg.PWorld.Entities.TList <Department> deptInfo2 = bfurd.GetDeptListByEmployeeCodeAndRoleName(_BPMContext.CurrentPWordUser.EmployeeCode, "部门成员");
        deptments.AddRange(deptInfo2);
        if (deptInfo2.Exists(x => x.DepartCode == deptInfo.DepartCode))
        {
            deptInfo2.Remove(deptInfo);
        }
        deptments.Insert(0, deptInfo);
        return(deptments);
    }
Exemple #10
0
    protected override void OnPreLoad(EventArgs e)
    {
        base.OnPreLoad(e);

        if (_BPMContext.ProcInst != null)
        {
            FormId      = _BPMContext.ProcInst.FormId;
            StartDeptId = _BPMContext.ProcInst.StartDeptCode;
            Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(StartDeptId);
            if (deptInfo != null)
            {
                StartDeptName = deptInfo.Remark;
            }
        }
    }
Exemple #11
0
 /// <summary>
 /// 对已保存的表单,从数据库中加载表单数据
 /// </summary>
 protected void InitFormData()
 {
     try
     {
         var info = BizContext.ERP_ContractFinalAccount.FirstOrDefault(x => x.FormID == FormId);
         if (info != null)
         {
             Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(info.StartDeptId);
             lbDeptName.Text = deptInfo.Remark;
             StartDeptId     = info.StartDeptId;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
    private void BindFormData()
    {
        try
        {
            InstructionOfPKURGIInfo obj = Eitems.Get(ViewState["FormID"].ToString());

            lbIsReport.Text = string.IsNullOrEmpty(obj.RelatedFormID) ? "0" : "1";
            if (lbIsReport.Text == "0")
            {
                ListItem item = ddlDepartName.Items.FindByValue(obj.DeptCode);
                if (item != null)
                {
                    ddlDepartName.SelectedIndex = ddlDepartName.Items.IndexOf(item);
                }
            }
            else
            {
                ddlDepartName.Items.Clear();
                string     CompanyCode = BPMHelp.GetCompanyCodeByDeptID(obj.DeptCode);
                Department deptInfo    = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(CompanyCode);

                ListItem item = new ListItem {
                    Text = deptInfo.DepartName, Value = CompanyCode
                };
                ddlDepartName.Items.Add(item);
                ddlDepartName.Enabled = false;
            }
            tbReportCode.Text              = obj.FormID;
            tbUserName.Text                = obj.UserName;
            tbMobile.Text                  = obj.Mobile;
            tbTitle.Text                   = obj.Title;
            tbContent.Text                 = obj.Content;
            UpdatedTextBox.Value           = !string.IsNullOrEmpty(obj.DateTime) ? obj.DateTime : DateTime.Now.ToShortDateString();
            cblSecurityLevel.SelectedValue = obj.SecurityLevel != null?obj.SecurityLevel.ToString() : "-1";

            cblUrgenLevel.SelectedValue = obj.UrgenLevel != null?obj.UrgenLevel.ToString() : "-1";

            cbIsReport.Checked = obj.IsReport == "1" ? true : false;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Exemple #13
0
 /// <summary>
 /// 对已保存的表单,从数据库中加载表单数据
 /// </summary>
 protected void InitFormData()
 {
     try
     {
         SupplementalAgreementInfo info = SupplementalAgreement.GetModel(this.FormId);
         if (info != null)
         {
             Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(info.StartDeptId);
             lbDeptName.Text            = deptInfo.Remark;
             cbIsReportResource.Checked = info.IsReportToResource.Value == 1;
             cbIsReportFounder.Checked  = info.IsReportToFounder.Value == 1;
             StartDeptId = info.StartDeptId;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
    //private void InintData()
    //{
    //    string methodName = "InintData";
    //    Logger.Write(this.GetType(), EnumLogLevel.Info, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.IN);
    //    try
    //    {
    //        InitFormData();
    //        if (instructionOfPkurg != null)
    //        {
    //            tbDepartName.Text = instructionOfPkurg.DeptName;
    //            WorkFlowInstance workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(instructionOfPkurg.FormId);
    //            AddSign1.ProcId = workFlowInstance.InstanceId;
    //            #region 审批意见框
    //            ApproveOpinionUCDeptleader.InstanceId = workFlowInstance.InstanceId;
    //            ApproveOpinionUCRealateDept.InstanceId = workFlowInstance.InstanceId;
    //            ApproveOpinionUCLeader.InstanceId = workFlowInstance.InstanceId;
    //            ApproveOpinionUCCEO.InstanceId = workFlowInstance.InstanceId;

    //            if (ApproveOpinionUCDeptleader.CurrentNodeName == nodeName.Value)
    //            {
    //                ApproveOpinionUCDeptleader.CurrentNode = true;
    //            }

    //            if (ApproveOpinionUCRealateDept.CurrentNodeName == nodeName.Value)
    //            {
    //                ApproveOpinionUCRealateDept.CurrentNode = true;
    //            }

    //            if (ApproveOpinionUCLeader.CurrentNodeName == nodeName.Value)
    //            {
    //                ApproveOpinionUCLeader.CurrentNode = true;
    //            }

    //            if (ApproveOpinionUCCEO.CurrentNodeName == nodeName.Value)
    //            {
    //                ApproveOpinionUCCEO.CurrentNode = true;
    //            }
    //            #endregion

    //            //查询已经添加的附件
    //            //UploadFilesUC1.BindAttachmentListByCode(ViewState["FormID"].ToString());
    //            UploadAttachments1.ProcId = workFlowInstance.InstanceId;
    //        }

    //    }
    //    catch (Exception ex)
    //    {

    //        Logger.Write(this.GetType(), EnumLogLevel.Fatal, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.Exception + ":" + string.Format("Exception={0}", ex));
    //        throw ex;
    //    }
    //    Logger.Write(this.GetType(), EnumLogLevel.Info, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.OUT);
    //}

    /// <summary>
    /// 加载表单
    /// </summary>
    private void InitFormData()
    {
        try
        {
            PaymentApplicationInfo formDataInfo = PaymentApplication.GetPaymentApplicationInfo(FormId);
            if (formDataInfo.IsOverContract == 1)
            {
                cblisoverCotract.Checked = true;
            }
            else
            {
                cblisoverCotract.Checked = false;
            }
            Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(formDataInfo.StartDeptId);
            tbDepartName.Text  = deptInfo.Remark;
            cbChairman.Checked = formDataInfo.IsCheckedChairman == 1;

            if (formDataInfo.StartDeptId.Contains("S972"))
            {
                lbPresident.Text = "总经理意见:";
            }
            else
            {
                lbPresident.Text = "总裁意见:";
            }
            //LoadRelationPerson(formDataInfo.StartDeptId);
            //cbRelatonUsers.Visible = cbPayer.Checked;
            //if (!string.IsNullOrEmpty(formDataInfo.LeadersSelected))
            //{
            //    string[] cbDatas = formDataInfo.LeadersSelected.Split(',');
            //    foreach (var cbItem in cbDatas)
            //    {
            //        ListItem listItem = cbRelatonUsers.Items.FindByValue(cbItem);
            //        listItem.Selected = true;
            //    }
            //}
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Exemple #15
0
    private void LoadRelationPerson()
    {
        StringBuilder           showUsers = new StringBuilder();
        BFPmsUserRoleDepartment bfurd     = new BFPmsUserRoleDepartment();

        cbRelatonUsers.Items.Clear();
        if (ddlDepartName.Items.Count == 0)
        {
            //showUsers.Append("没有配置相关角色");
            //cbPayer.Enabled = false;
        }
        else
        {
            string     startDeptId = ddlDepartName.SelectedItem.Value;
            Department deptInfo    = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(startDeptId);
            string     CompanyCode = BPMHelp.GetCompanyCodeByDeptID(startDeptId);
            DataTable  dtDept      = bfurd.GetSelectRoleUser(CompanyCode, "付款申请工程师");
            if (dtDept != null && dtDept.Rows.Count != 0)
            {
                foreach (DataRow rowItem in dtDept.Rows)//EmployeeCode
                {
                    //showUsers.AppendFormat("{0},", rowItem["EmployeeName"].ToString());

                    cbRelatonUsers.Items.Add(new ListItem()
                    {
                        Text  = rowItem["EmployeeName"].ToString(),
                        Value = rowItem["LoginName"].ToString()
                    });
                }
                // showUsers.Append("选择相关人员意见");
                //cbPayer.Enabled = true;
                //cbPayer.Text = string.Format("相关人员({0})", showUsers.ToString().Trim(','));
                //return;
            }
            else
            {
                // showUsers.Append("没有配置相关角色");
                // cbPayer.Enabled = false;
            }
        }
        // cbPayer.Text = showUsers.ToString();
    }
    /// <summary>
    /// 加载表单
    /// </summary>
    private void InitFormData()
    {
        try
        {
            ContractApprovalInfo info = ContractApproval.GetModel(FormId);
            if (info != null)
            {
                Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(info.StartDeptId);
                ddlDepartName.Text = deptInfo.Remark;

                cblisoverCotract.Checked   = info.IsOverContract.Value == 1;
                cbIsReportResource.Checked = info.IsReportToResource.Value == 1;
                cbIsReportFounder.Checked  = info.IsReportToFounder.Value == 1;
            }
            ///加载业务数据
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    private void InintData()
    {
        string methodName = "InintData";

        try
        {
            WorkFlowInstance Instance = wf_WorkFlowInstance.GetWorkFlowInstanceById(ViewState["InstanceID"].ToString());
            InstructionInfo  item     = Instruction.GetInstructionInfoByInstanceId(ViewState["InstanceID"].ToString());
            if (item != null)
            {
                InstructionInfo info     = Instruction.GetInstructionInfo(Instance.FormId);
                Department      deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(info.StartDeptId);
                ddlDepartName.Text = deptInfo.Remark;
                cbChairman.Checked = info.IsCheckedChairman == 1;
            }

            FlowRelated1.ProcId       = ViewState["InstanceID"].ToString();
            Countersign1.ProcId       = ViewState["InstanceID"].ToString();
            UploadAttachments1.ProcId = ViewState["InstanceID"].ToString();

            ApproveOpinionUCDeptleader.InstanceId  = ViewState["InstanceID"].ToString();
            ApproveOpinionUCRealateDept.InstanceId = ViewState["InstanceID"].ToString();
            ApproveOpinionUCLeader.InstanceId      = ViewState["InstanceID"].ToString();
            ApproveOpinionUCCEO.InstanceId         = ViewState["InstanceID"].ToString();
            ApproveOpinionUC1.InstanceId           = ViewState["InstanceID"].ToString();
            ApproveOpinionUC2.InstanceId           = ViewState["InstanceID"].ToString();
            ApproveOpinionUC22.InstanceId          = ViewState["InstanceID"].ToString();
            ApproveOpinionUC3.InstanceId           = ViewState["InstanceID"].ToString();
            ApproveOpinionUC4.InstanceId           = ViewState["InstanceID"].ToString();
            Option_10.InstanceId = ViewState["InstanceID"].ToString();
            Option_11.InstanceId = ViewState["InstanceID"].ToString();
        }
        catch (Exception ex)
        {
            Logger.Write(this.GetType(), EnumLogLevel.Fatal, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.Exception + ":" + string.Format("Exception={0}", ex));
            throw ex;
        }
        Logger.Write(this.GetType(), EnumLogLevel.Info, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.OUT);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            InitStartDeptment();
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                WorkFlowInstance info = new WF_WorkFlowInstance().GetWorkFlowInstanceById(Request.QueryString["id"]);
                FormId = info.FormId;
                InitFormData();
                //Countersign1.CounterSignDeptId = info.CreateDeptCode;
                SetUserControlInstance();
            }
            else
            {
                string erpFormId   = HttpContext.Current.Request["erpFormId"];
                string erpFormType = HttpContext.Current.Request["erpFormType"];

                if (string.IsNullOrEmpty(erpFormId) || string.IsNullOrEmpty(erpFormType))
                {
                    //参数错误
                    ExceptionHander.GoToErrorPage();
                    return;
                }
                if (Pkurg.PWorldBPM.Business.BIZ.ERP.ERP_Common.IsExsitRunFlow(Request["erpFormId"], ERP_WF_T_Name.ERP_Instruction))
                {
                    ERP_CallbackResultType resultType = new ContractApproval_Service().NotifyStartAdvance(Request["erpFormId"], true);
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", "alert('" + ConstString.RepeatAlertTip_BPM + "'); window.opener=null;window.open('', '_self', '');window.close();", true);
                    return;
                }
                FormId = BPMHelp.GetSerialNumber("ERP_QS_");
                string     StartDeptId = ddlDepartName.SelectedItem.Value;
                Department deptInfo    = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(StartDeptId);
                Countersign1.CounterSignDeptId = StartDeptId;
            }
            InitLeader();
        }
    }
 /// <summary>
 /// 对已保存的表单,从数据库中加载表单数据
 /// </summary>
 protected void InitFormData()
 {
     try
     {
         ///加载业务数据
         var info = BizContext.HR_EmployeeLeft.FirstOrDefault(x => x.FormID == FormId);
         if (info != null)
         {
             Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(info.DeptID);
             StartDeptId              = info.DeptID;
             tbEmployeeName.Text      = info.EmployeeName;
             tbDept.Text              = info.DeptName;
             tbPosition.Text          = info.Position;
             tbLeftType.SelectedValue = info.LeftType;
             cbIsActiveLeft.Checked   = bool.Parse(info.IsInitiativeLeft);
             TextBox1.Text            = info.Handover ?? "";
             TextBox2.Text            = info.Recipient ?? "";
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #20
0
    //protected override void OnPreRender(EventArgs e)
    //{
    //        base.OnPreRender(e);
    //        try
    //        {
    //            WorklistItem taskItem = WorkflowHelper.GetWorklistItemWithSN(_BPMContext.Sn, _BPMContext.CurrentUser.LoginId);

    //        }
    //        catch (Exception)
    //        {
    //            //hf_OpId.Value = "-1";
    //        }
    //}

    protected override void OnPreLoad(EventArgs e)
    {
        base.OnPreLoad(e);

        ///审批界面显示
        if (!string.IsNullOrEmpty(Request.QueryString["sn"]))
        {
        }
        else
        {
            ExceptionHander.GoToErrorPage("该审批环节已结束", null);
        }

        if (_BPMContext.ProcInst != null)
        {
            FormId      = _BPMContext.ProcInst.FormId;
            StartDeptId = _BPMContext.ProcInst.StartDeptCode;
            Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(StartDeptId);
            if (deptInfo != null)
            {
                StartDeptName = deptInfo.DepartName;
            }
        }
    }
    /// <summary>
    /// 设置流程参数
    /// </summary>
    /// <returns></returns>
    private NameValueCollection SetWFParams()
    {
        string startDeptId = ddlDepartName.SelectedItem.Value;

        NameValueCollection dataFields = new NameValueCollection();
        Department          deptInfo   = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(startDeptId);
        string CompanyCode             = BPMHelp.GetCompanyCodeByDeptID(startDeptId);

        bool          flag               = true;                //标记datafields内的变量是否均赋值
        List <string> ApproverList       = new List <string>(); //所有参与审批的用户列表
        StringBuilder leaders            = new StringBuilder(); //相关部门主管助理总裁
        StringBuilder Viceleaders        = new StringBuilder(); //相关部门主管副总裁
        StringBuilder deptsofGroup       = new StringBuilder(); //集团相关部门
        StringBuilder leaderofgroup      = new StringBuilder(); //集团主管部门部门负责人
        StringBuilder AssistantPresident = new StringBuilder(); //集团主管部门主管助理总裁
        StringBuilder VicePresident      = new StringBuilder(); //集团主管部门主管副总裁

        //验证部分步骤的审批人是否尚未配置
        if (string.IsNullOrEmpty(GetRoleUsers(deptInfo.DepartCode, "部门负责人")))
        {
            flag = false;
            Alert(Page, "发起部门负责人尚未配置!");
        }
        List <string> countersigns = Countersign1.Result.Split(',').ToList();

        foreach (var item in countersigns)
        {
            if (!string.IsNullOrEmpty(item))
            {
                if (string.IsNullOrEmpty(GetRoleUsers(item, "部门负责人")))
                {
                    flag = false;
                    Department countetDept = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(item);
                    Alert(Page, countetDept.Remark + "部门负责人尚未配置!");
                }
            }
        }
        if (string.IsNullOrEmpty(GetRoleUsers(CompanyCode, "总裁")))
        {
            flag = false;
            Alert(Page, "公司总裁尚未配置!");
        }
        if (string.IsNullOrEmpty(GetRoleUsers(PKURGICode, "总裁")))
        {
            flag = false;
            Alert(Page, "集团CEO尚未配置!");
        }

        countersigns.Add(startDeptId);
        foreach (var item in countersigns)
        {
            string leadersTmp = GetRoleUsers(item, "主管助理总裁");
            if (!leaders.ToString().Contains(leadersTmp))
            {
                leaders.AppendFormat("{0},", leadersTmp);
            }
            string ViceleadersTmp = GetRoleUsers(item, "主管副总裁");
            if (!Viceleaders.ToString().Contains(ViceleadersTmp))
            {
                Viceleaders.AppendFormat("{0},", ViceleadersTmp);
            }
            string deptsofGroupTmp = GetRoleDepts(item, "集团主管部门");
            if (!deptsofGroup.ToString().Contains(deptsofGroupTmp))
            {
                deptsofGroup.AppendFormat("{0},", deptsofGroupTmp);
            }
        }
        ///集团人员
        string IsReport = HttpContext.Current.Request["isReport"];

        if (IsReport == "Y")
        {
            dataFields.Add("CEOGroup", FilterDataField2(GetRoleUsers(PKURGICode, "总裁")));
            foreach (var item in deptsofGroup.ToString().Trim(',').Split(','))
            {
                string leaderofgroupTmp = GetRoleUsers(item, "部门负责人");
                if (!leaderofgroup.ToString().Contains(leaderofgroupTmp))
                {
                    leaderofgroup.AppendFormat("{0},", leaderofgroupTmp);
                }
                string AssistantPresidentTmp = GetRoleUsers(item, "主管助理总裁");
                if (!AssistantPresident.ToString().Contains(AssistantPresidentTmp))
                {
                    AssistantPresident.AppendFormat("{0},", AssistantPresidentTmp);
                }
                string VicePresidentTmp = GetRoleUsers(item, "主管副总裁");
                if (!VicePresident.ToString().Contains(VicePresidentTmp))
                {
                    VicePresident.AppendFormat("{0},", VicePresidentTmp);
                }
            }
            dataFields.Add("VicePresident", FilterDataField2(VicePresident));
            dataFields.Add("AssistantPresident", FilterDataField2(AssistantPresident));
            dataFields.Add("leadersofgroup", FilterDataField2(leaderofgroup));
        }
        //城市公司审批人员
        string LeaderTemp = string.Empty;

        if (cbChairman.Checked)
        {
            dataFields.Add("chairman", FilterDataField2(GetRoleUsers(CompanyCode, "董事长")));
        }
        else
        {
            dataFields.Add("chairman", "noapprovers");
        }

        dataFields.Add("CEO", FilterDataField2(GetRoleUsers(CompanyCode, "总裁")));
        dataFields.Add("StandingViceCEO", FilterDataField2(GetRoleUsers(CompanyCode, "常务副总裁")));
        dataFields.Add("Viceleaders", FilterDataField2(Viceleaders));
        dataFields.Add("leaders", FilterDataField2(leaders));
        dataFields.Add("CounterSignUsers", (Countersign1.GetCounterSignUsers()));
        dataFields.Add("DeptManager", GetRoleUsers(deptInfo.DepartCode, "部门负责人"));

        dataFields.Add("IsReport", IsReport == "Y" ? "1" : "0");
        dataFields.Add("IsPass", "1");

        if (!flag)
        {
            dataFields = null;
        }
        return(dataFields);
    }
Exemple #22
0
    /// <summary>
    /// 设置流程参数
    /// </summary>
    /// <returns></returns>
    private NameValueCollection SetWFParams()
    {
        //存储过程的四个参数

        string startDeptId = ddlDepartName.SelectedItem.Value;
        //部门【条件1】
        string startDeptName = ddlDepartName.SelectedItem.Text;
        //定义合同类型的取值
        // string erpFormType = HttpContext.Current.Request["erpFormType"];
        //根据formTitle中的第七位取两位得到合同类型【条件2】
        string type = PaymentApplication_Common.GetErpFormTitle(this).Substring(5, 2);
        //得到金额amount,需要先判断改单子是打开拟稿的还是新打开的,根据ID来判断是哪一类【条件3】
        string amounts = null;

        //用info和_BPMContext.ProcID是否为空来判断是打开的拟稿还是新打开的有什么区别

        //如果为null或者为空时,则为新打开的页面,新打开页面的amount值
        if (_BPMContext.ProcID == null || _BPMContext.ProcID == "")
        {
            amounts = HttpContext.Current.Request["amount"];
        }
        //如果不为null,则为打开的拟稿
        else
        {
            PaymentApplicationInfo info = PaymentApplication.GetPaymentApplicationInfo(FormId);
            amounts = info.Amount;
        }
        //是否在计划内【条件4】
        string isInPlan = cblIsInPan.SelectedItem.Value;



        NameValueCollection dataFields = new NameValueCollection();
        Department          deptInfo   = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(startDeptId);
        string CompanyCode             = BPMHelp.GetCompanyCodeByDeptID(StartDeptId);

        StringBuilder firstFieldBuilder = new StringBuilder();

        foreach (ListItem item in cbRelatonUsers.Items)
        {
            if (item.Selected)
            {
                firstFieldBuilder.AppendFormat("K2:Founder\\{0},", item.Value);
            }
        }
        string firstField = firstFieldBuilder.ToString().Trim(',');

        dataFields.Add("RelatedPersonnel", !string.IsNullOrEmpty(firstField) ? firstField : "noapprovers");

        bool flag = true;//标记datafields内的变量是否均赋值

        //验证部分步骤的审批人是否尚未配置
        if (string.IsNullOrEmpty(GetRoleUsers(deptInfo.DepartCode, "部门负责人")))
        {
            flag = false;
            Alert(Page, "发起部门负责人尚未配置!");
        }
        List <string> countersigns = Countersign1.Result.Split(',').ToList();

        foreach (var item in countersigns)
        {
            if (!string.IsNullOrEmpty(item))
            {
                if (string.IsNullOrEmpty(GetRoleUsers(item, "部门负责人")))
                {
                    flag = false;
                    Alert(Page, item + "会签部门负责人尚未配置!");
                }
            }
        }
        string financialManagementDepartmentCode = BPMHelp.GetDeptIDByOtherIDAndName(deptInfo.DepartCode, "财务管理部");

        if (string.IsNullOrEmpty(financialManagementDepartmentCode))
        {
            flag = false;
            Alert(Page, "财务管理部尚未设置!");
        }
        else
        {
            string financialManagementDepartmentInfoManager = GetRoleUsers(financialManagementDepartmentCode, "部门负责人");
            if (string.IsNullOrEmpty(financialManagementDepartmentInfoManager))
            {
                flag = false;
                Alert(Page, "财务管理部门负责人尚未配置!");
            }
            //else
            //{
            //    if (string.IsNullOrEmpty(GetRoleUsers(financialManagementDepartmentInfo.DepartCode, "主管副总裁")))
            //    {
            //        flag = false;
            //        Alert(Page, "财务管理部门主管副总裁尚未配置!");
            //    }
            //}
        }
        if (string.IsNullOrEmpty(GetRoleUsers(CompanyCode, "总裁")))
        {
            flag = false;
            Alert(Page, "公司总裁尚未配置!");
        }
        if (string.IsNullOrEmpty(GetRoleUsers(PKURGICode, "总裁")))
        {
            flag = false;
            Alert(Page, "集团总裁尚未配置!");
        }
        StringBuilder leaders      = new StringBuilder();
        StringBuilder Viceleaders  = new StringBuilder();
        StringBuilder deptsofGroup = new StringBuilder();

        StringBuilder leaderofgroup      = new StringBuilder();
        StringBuilder AssistantPresident = new StringBuilder();
        StringBuilder VicePresident      = new StringBuilder();

        countersigns.Add(startDeptId);
        foreach (var item in countersigns)
        {
            string leadersTmp = GetRoleUsers(item, "主管助理总裁");
            if (!leaders.ToString().Contains(leadersTmp))
            {
                leaders.AppendFormat("{0},", leadersTmp);
            }
            string ViceleadersTmp = GetRoleUsers(item, "主管副总裁");
            if (!Viceleaders.ToString().Contains(ViceleadersTmp))
            {
                Viceleaders.AppendFormat("{0},", ViceleadersTmp);
            }
            string deptsofGroupTmp = GetRoleDepts(item, "集团主管部门");
            if (!deptsofGroup.ToString().Contains(deptsofGroupTmp))
            {
                deptsofGroup.AppendFormat("{0},", deptsofGroupTmp);
            }
        }

        //集团审批人员
        if (cblisoverCotract.Checked)
        {
            foreach (var item in deptsofGroup.ToString().Trim(',').Split(','))
            {
                string leaderofgroupTmp = GetRoleUsers(item, "部门负责人");
                if (!leaderofgroup.ToString().Contains(leaderofgroupTmp))
                {
                    leaderofgroup.AppendFormat("{0},", leaderofgroupTmp);
                }
                string AssistantPresidentTmp = GetRoleUsers(item, "主管助理总裁");
                if (!AssistantPresident.ToString().Contains(AssistantPresidentTmp))
                {
                    AssistantPresident.AppendFormat("{0},", AssistantPresidentTmp);
                }
                string VicePresidentTmp = GetRoleUsers(item, "主管副总裁");
                if (!VicePresident.ToString().Contains(VicePresidentTmp))
                {
                    VicePresident.AppendFormat("{0},", VicePresidentTmp);
                }
            }
            dataFields.Add("CEOGroup", FilterDataField2(GetRoleUsers(PKURGICode, "总裁")));
            dataFields.Add("VicePresident", FilterDataField2(VicePresident));
            dataFields.Add("AssistantPresident", FilterDataField2(AssistantPresident));
            dataFields.Add("leadersofgroup", FilterDataField2(leaderofgroup));
        }

        if (cbChairman.Checked)
        {
            dataFields.Add("chairman", FilterDataField2(GetRoleUsers(CompanyCode, "董事长")));
        }
        else
        {
            dataFields.Add("chairman", "noapprovers");
        }
        string CQCompanyCode = "S374";
        string CPDeptCode    = "S366-S976-S219";
        string JSDeptCode    = "S366-S976-S782";
        string SCKFDeptCode  = "S366-S976-S860";

        //如果是重庆公司或者是北京北大资源物业公司,则进行判断
        if (StartDeptId.Contains(CQCompanyCode) || StartDeptId.Contains(CPDeptCode) || StartDeptId.Contains(JSDeptCode) || StartDeptId.Contains(SCKFDeptCode))
        {
            //判断“分管副总裁”“分管财务副总裁”“总裁”需要审批还是不需要审批
            int grade = ERP_PaymentApplication_Grade.GetERP_PaymentApplication_GradeInfo(type, startDeptName, isInPlan, amounts);
            //如果grade为别的值,则抛出异常
            if (grade == -1)
            {
                //throw new InvalidDataException("输入的参数不正确!");
                grade = 111;
            }

            //分管财务副总裁审批
            dataFields.Add("financialManagementViceleaders", (grade - (grade / 100 * 100)) / 10 == 1 ? this.FilterDataField2(GetRoleUsers(financialManagementDepartmentCode, "主管副总裁")) : "noapprovers");
            //分管副总裁审批【因为总是会审批,所以不需要进行grade的判断】
            if ((grade / 100) == 1)
            {
                dataFields.Add("Viceleaders", this.FilterDataField2(Viceleaders));
                dataFields.Add("leaders", this.FilterDataField2(leaders));
            }
            //总裁审批
            dataFields.Add("CEO", (grade - (grade / 100 * 100) - ((grade - grade / 100 * 100) / 10 * 10)) == 1 ? this.FilterDataField2(GetRoleUsers(CompanyCode, "总裁")) : "noapprovers");
        }
        else
        {
            //分管财务副总裁审批
            dataFields.Add("financialManagementViceleaders", FilterDataField2(GetRoleUsers(financialManagementDepartmentCode, "主管副总裁")));
            //分管副总裁审批
            dataFields.Add("Viceleaders", this.FilterDataField2(Viceleaders));
            dataFields.Add("leaders", this.FilterDataField2(leaders));
            //总裁审批
            dataFields.Add("CEO", FilterDataField2(GetRoleUsers(CompanyCode, "总裁")));
        }

        dataFields.Add("StandingViceCEO", FilterDataField2(GetRoleUsers(CompanyCode, "常务副总裁")));


        dataFields.Add("financialManagement", FilterDataField2(GetRoleUsers(financialManagementDepartmentCode, "部门负责人")));
        dataFields.Add("CounterSignUsers", Countersign1.GetCounterSignUsers());
        dataFields.Add("DeptManager", GetRoleUsers(deptInfo.DepartCode, "部门负责人"));
        dataFields.Add("IsOverContract", cblisoverCotract.Checked ? "1" : "0");
        dataFields.Add("IsPass", "1");

        if (!flag)
        {
            dataFields = null;
        }
        return(dataFields);
    }
Exemple #23
0
    private void InintData()
    {
        string methodName = "InintData";

        try
        {
            WorkFlowInstance       Instance = wf_WorkFlowInstance.GetWorkFlowInstanceById(ViewState["InstanceID"].ToString());
            PaymentApplicationInfo item     = PaymentApplication.GetPaymentApplicationInfoByInstanceId(ViewState["InstanceID"].ToString());
            if (item != null)
            {
                PaymentApplicationInfo info     = PaymentApplication.GetPaymentApplicationInfo(Instance.FormId);
                Department             deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(info.StartDeptId);
                ddlDepartName.Text = deptInfo.Remark;

                cblisoverCotract.Checked = info.IsOverContract == 1;
                cbChairman.Checked       = info.IsCheckedChairman == 1;

                if (info.StartDeptId.Contains("S972"))
                {
                    lbPresident.Text = "总经理意见:";
                }
                else
                {
                    lbPresident.Text = "总裁意见:";
                }
                //LoadRelationPerson(info.StartDeptId);
                //cbRelatonUsers.Visible = cbPayer.Checked;
                //cbRelatonUsers.Enabled = false;
                //if (!string.IsNullOrEmpty(info.LeadersSelected))
                //{
                //    string[] cbDatas = info.LeadersSelected.Split(',');
                //    foreach (var cbItem in cbDatas)
                //    {
                //        ListItem listItem = cbRelatonUsers.Items.FindByValue(cbItem);
                //        listItem.Selected = true;
                //    }
                //}
            }

            FlowRelated1.ProcId       = ViewState["InstanceID"].ToString();
            Countersign1.ProcId       = ViewState["InstanceID"].ToString();
            UploadAttachments1.ProcId = ViewState["InstanceID"].ToString();

            ApproveOpinionUCDeptleader.InstanceId  = ViewState["InstanceID"].ToString();
            ApproveOpinionUCRealateDept.InstanceId = ViewState["InstanceID"].ToString();
            ApproveOpinionUCLeader.InstanceId      = ViewState["InstanceID"].ToString();
            Option_4.InstanceId           = ViewState["InstanceID"].ToString();
            ApproveOpinionUC1.InstanceId  = ViewState["InstanceID"].ToString();
            ApproveOpinionUC2.InstanceId  = ViewState["InstanceID"].ToString();
            ApproveOpinionUC22.InstanceId = ViewState["InstanceID"].ToString();
            ApproveOpinionUC3.InstanceId  = ViewState["InstanceID"].ToString();
            Option_0.InstanceId           = ViewState["InstanceID"].ToString();
            ApproveOpinionUC4.InstanceId  = ViewState["InstanceID"].ToString();
            Option_10.InstanceId          = ViewState["InstanceID"].ToString();
            Option_11.InstanceId          = ViewState["InstanceID"].ToString();
            Option_12.InstanceId          = ViewState["InstanceID"].ToString();
            Option_13.InstanceId          = ViewState["InstanceID"].ToString();
        }
        catch (Exception ex)
        {
            Logger.Write(this.GetType(), EnumLogLevel.Fatal, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.Exception + ":" + string.Format("Exception={0}", ex));
            throw ex;
        }
        Logger.Write(this.GetType(), EnumLogLevel.Info, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.OUT);
    }
    /// <summary>
    /// 设置流程参数
    /// </summary>
    /// <returns></returns>
    private NameValueCollection SetWFParams()
    {
        NameValueCollection dataFields = new NameValueCollection();

        BFPmsUserRoleDepartment bfurd = new BFPmsUserRoleDepartment();

        //动态获取待定
        string     startDeptId = ddlDepartName.SelectedItem.Value;
        Department deptInfo    = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(startDeptId);
        string     CompanyCode = BPMHelp.GetCompanyCodeByDeptID(startDeptId);
        string     EDeptCode   = BPMHelp.GetDeptIDByOtherIDAndName(startDeptId, "工程管理部");
        string     FDeptCode   = BPMHelp.GetDeptIDByOtherIDAndName(startDeptId, "财务管理部");
        string     LADeptCode  = BPMHelp.GetDeptIDByOtherIDAndName(startDeptId, "法务部");

        DataTable DeptDirector       = bfurd.GetSelectRoleUser(startDeptId, "总监");
        DataTable DeptAssiManager    = bfurd.GetSelectRoleUser(startDeptId, "助理总经理");
        DataTable DeptManager        = bfurd.GetSelectRoleUser(startDeptId, "部门负责人");
        DataTable EngineeringAuditor = bfurd.GetSelectRoleUser(EDeptCode, "租赁合同审核员");
        DataTable EngineeringManager = bfurd.GetSelectRoleUser(EDeptCode, "部门负责人");
        DataTable FinanceAuditor     = bfurd.GetSelectRoleUser(FDeptCode, "租赁合同审核员");
        DataTable FinanceManager     = bfurd.GetSelectRoleUser(FDeptCode, "部门负责人");
        DataTable LAAuditor          = bfurd.GetSelectRoleUser(LADeptCode, "租赁合同审核员");
        DataTable LegalAffairManager = bfurd.GetSelectRoleUser(LADeptCode, "部门负责人");
        DataTable President          = bfurd.GetSelectRoleUser(CompanyCode, "总裁");

        DataTable GroupCREManager     = bfurd.GetSelectRoleUser(SYDCDeptCode, "部门负责人");
        DataTable GroupFinanceManager = bfurd.GetSelectRoleUser(CWDeptCode, "部门负责人");
        DataTable GroupLADirector     = bfurd.GetSelectRoleUser(FWDeptCode, "副总经理");
        DataTable GroupLAManager      = bfurd.GetSelectRoleUser(FWDeptCode, "部门负责人");
        DataTable GroupPresident      = bfurd.GetSelectRoleUser(PKURGICode, "总裁");

        List <string> VicePresidentList = new List <string>();
        List <string> GroupAPList       = new List <string>();
        List <string> GroupVPList       = new List <string>();

        VicePresidentList.Add(GetRoleUsers(EDeptCode, "主管副总裁"));
        if (!VicePresidentList.Contains(GetRoleUsers(FDeptCode, "主管副总裁")))
        {
            VicePresidentList.Add(GetRoleUsers(FDeptCode, "主管副总裁"));
        }
        if (!VicePresidentList.Contains(GetRoleUsers(LADeptCode, "主管副总裁")))
        {
            VicePresidentList.Add(GetRoleUsers(LADeptCode, "主管副总裁"));
        }
        GroupAPList.Add(GetRoleUsers(SYDCDeptCode, "主管助理总裁"));
        if (!GroupAPList.Contains(GetRoleUsers(CWDeptCode, "主管助理总裁")))
        {
            GroupAPList.Add(GetRoleUsers(CWDeptCode, "主管助理总裁"));
        }
        if (!GroupAPList.Contains(GetRoleUsers(FWDeptCode, "主管助理总裁")))
        {
            GroupAPList.Add(GetRoleUsers(FWDeptCode, "主管助理总裁"));
        }
        GroupVPList.Add(GetRoleUsers(SYDCDeptCode, "主管副总裁"));
        if (!GroupVPList.Contains(GetRoleUsers(CWDeptCode, "主管副总裁")))
        {
            GroupVPList.Add(GetRoleUsers(CWDeptCode, "主管副总裁"));
        }
        if (!GroupVPList.Contains(GetRoleUsers(FWDeptCode, "主管副总裁")))
        {
            GroupVPList.Add(GetRoleUsers(FWDeptCode, "主管副总裁"));
        }

        //绑定datafields
        bool flag = true;//标记datafields内的变量是否均赋值

        if (DeptDirector != null && DeptDirector.Rows.Count > 0)
        {
            dataFields.Add("DeptDirector", "K2:Founder\\" + DeptDirector.Rows[0]["LoginName"].ToString());
        }
        else
        {
            dataFields.Add("DeptDirector", "noapprovers");
        }
        if (DeptAssiManager != null && DeptAssiManager.Rows.Count > 0)
        {
            dataFields.Add("DeptAssiManager", "K2:Founder\\" + DeptAssiManager.Rows[0]["LoginName"].ToString());
        }
        else
        {
            dataFields.Add("DeptAssiManager", "noapprovers");
        }
        if (DeptManager != null && DeptManager.Rows.Count > 0)
        {
            dataFields.Add("DeptManager", "K2:Founder\\" + DeptManager.Rows[0]["LoginName"].ToString());
        }
        else
        {
            flag = false;
            Alert(Page, "您所在部门负责人尚未配置!");
        }
        if (EngineeringAuditor != null && EngineeringAuditor.Rows.Count > 0)
        {
            dataFields.Add("EngineeringAuditor", "K2:Founder\\" + EngineeringAuditor.Rows[0]["LoginName"].ToString());
        }
        else
        {
            dataFields.Add("EngineeringAuditor", "noapprovers");
        }
        if (EngineeringManager != null && EngineeringManager.Rows.Count > 0)
        {
            dataFields.Add("EngineeringManager", "K2:Founder\\" + EngineeringManager.Rows[0]["LoginName"].ToString());
        }
        else
        {
            flag = false;
            Alert(Page, "工程管理部负责人尚未配置!");
        }
        if (FinanceAuditor != null && FinanceAuditor.Rows.Count > 0)
        {
            dataFields.Add("FinanceAuditor", "K2:Founder\\" + FinanceAuditor.Rows[0]["LoginName"].ToString());
        }
        else
        {
            dataFields.Add("FinanceAuditor", "noapprovers");
        }
        if (FinanceManager != null && FinanceManager.Rows.Count > 0)
        {
            dataFields.Add("FinanceManager", "K2:Founder\\" + FinanceManager.Rows[0]["LoginName"].ToString());
        }
        else
        {
            flag = false;
            Alert(Page, "财务管理部负责人尚未配置!");
        }
        if (LAAuditor != null && LAAuditor.Rows.Count > 0)
        {
            dataFields.Add("LAAuditor", "K2:Founder\\" + LAAuditor.Rows[0]["LoginName"].ToString());
        }
        else
        {
            dataFields.Add("LAAuditor", "noapprovers");
        }
        if (LegalAffairManager != null && LegalAffairManager.Rows.Count > 0)
        {
            dataFields.Add("LegalAffairManager", "K2:Founder\\" + LegalAffairManager.Rows[0]["LoginName"].ToString());
        }
        else
        {
            flag = false;
            Alert(Page, "法务部负责人尚未配置!");
        }
        if (President != null && President.Rows.Count > 0)
        {
            dataFields.Add("President", "K2:Founder\\" + President.Rows[0]["LoginName"].ToString());
        }
        else
        {
            flag = false;
            Alert(Page, "公司总裁尚未配置!");
        }
        if (GroupCREManager != null && GroupCREManager.Rows.Count > 0)
        {
            dataFields.Add("GroupCREManager", "K2:Founder\\" + GroupCREManager.Rows[0]["LoginName"].ToString());
        }
        else
        {
            flag = false;
            Alert(Page, "集团商业地产管理部负责人尚未配置!");
        }
        if (GroupFinanceManager != null && GroupFinanceManager.Rows.Count > 0)
        {
            dataFields.Add("GroupFinanceManager", "K2:Founder\\" + GroupFinanceManager.Rows[0]["LoginName"].ToString());
        }
        else
        {
            flag = false;
            Alert(Page, "集团财务管理部负责人尚未配置!");
        }
        if (GroupLADirector != null && GroupLADirector.Rows.Count > 0)
        {
            dataFields.Add("GroupLADirector", "K2:Founder\\" + GroupLADirector.Rows[0]["LoginName"].ToString());
        }
        else
        {
            dataFields.Add("GroupLADirector", "noapprovers");
        }
        if (GroupLAManager != null && GroupLAManager.Rows.Count > 0)
        {
            dataFields.Add("GroupLAManager", "K2:Founder\\" + GroupLAManager.Rows[0]["LoginName"].ToString());
        }
        else
        {
            flag = false;
            Alert(Page, "集团法务部负责人尚未配置!");
        }
        if (GroupPresident != null && GroupPresident.Rows.Count > 0)
        {
            dataFields.Add("GroupPresident", "K2:Founder\\" + GroupPresident.Rows[0]["LoginName"].ToString());
        }
        else
        {
            flag = false;
            Alert(Page, "集团总裁尚未配置!");
        }
        dataFields.Add("VicePresident", FilterDataField2(VicePresidentList));
        dataFields.Add("GroupAP", FilterDataField2(GroupAPList));
        dataFields.Add("GroupVP", FilterDataField2(GroupVPList));

        dataFields.Add("BizType", tbBizType.Text.ToString());
        dataFields.Add("BizID", tbBizID.Text.ToString());
        if (cblModificationContract.SelectedIndex == 0 || cblSupplementContract.SelectedIndex == 0 || cblLesseeContract.SelectedIndex == 0 ||
            cblCompensationContract.SelectedIndex == 0 || cblDecorationContract.SelectedIndex == 0 || cblServiceContract.SelectedIndex == 0)
        {
            dataFields.Add("IsReport", "yes");
        }
        else
        {
            dataFields.Add("IsReport", tbApproveFlag.Text == "1" ? "yes" : "no");
        }
        if (!flag)
        {
            dataFields = null;
        }
        return(dataFields);
    }
Exemple #25
0
    /// <summary>
    /// 设置流程参数
    /// </summary>
    /// <returns></returns>
    private NameValueCollection SetWFParams()
    {
        NameValueCollection dataFields  = new NameValueCollection();
        XmlDocument         xmldoc      = new XmlDocument();
        XmlElement          xmleLeaders = xmldoc.CreateElement("Leaders");

        xmldoc.AppendChild(xmleLeaders);

        List <string> ApproverList = new List <string>();//所有参与审批的用户列表,用来避免重复审批,已存在用户不再传入
        string        GroupCode    = System.Configuration.ConfigurationManager.AppSettings["GroupCode"];
        string        startDeptId  = ddlDepartName.SelectedItem.Value;
        string        LeaderTemp   = string.Empty;
        bool          flag         = true;//标记

        if (string.IsNullOrEmpty(GetRoleUsers(startDeptId, "部门负责人")))
        {
            flag = false;
            Alert(Page, "发起部门负责人尚未配置!");
        }
        List <string> countersigns = Countersign1.Result.Split(',').ToList();

        foreach (var item in countersigns)
        {
            if (!string.IsNullOrEmpty(item))
            {
                if (string.IsNullOrEmpty(GetRoleUsers(item, "部门负责人")))
                {
                    flag = false;
                    Department countetDept = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(item);
                    Alert(Page, countetDept.Remark + "部门负责人尚未配置!");
                }
            }
        }
        if (string.IsNullOrEmpty(GetRoleUsers(GroupCode, "总裁")))
        {
            flag = false;
            Alert(Page, "集团CEO尚未配置!");
        }

        if (this.cbChairman.Checked)
        {
            LeaderTemp = FilterDataField2(GetRoleUsers(GroupCode, "董事长"));
            XmlElement xmleChairman = xmldoc.CreateElement("Chairman");
            xmleLeaders.AppendChild(xmleChairman);
            xmleChairman.SetAttribute("ID", LeaderTemp);
        }
        else
        {
            LeaderTemp = "noapprovers";
        }
        dataFields.Add("Chairman", LeaderTemp);
        if (1 == 1)
        {
            LeaderTemp = FilterDataField2(GetRoleUsers(GroupCode, "总裁"));
            XmlElement xmleCEO = xmldoc.CreateElement("CEO");
            xmleLeaders.AppendChild(xmleCEO);
            xmleCEO.SetAttribute("ID", LeaderTemp);
        }
        dataFields.Add("CEO", LeaderTemp);
        if (cblTopLeaders.SelectedIndex != -1)
        {
            LeaderTemp = string.Empty;
            XmlElement xmlTopLeaders = xmldoc.CreateElement("TopLeaders");
            xmleLeaders.AppendChild(xmlTopLeaders);

            for (int i = 0; i < cblTopLeaders.Items.Count; i++)
            {
                if (cblTopLeaders.Items[i].Selected && !ApproverList.Contains(cblTopLeaders.Items[i].Value))
                {
                    ApproverList.Add(cblTopLeaders.Items[i].Value);
                    LeaderTemp += cblTopLeaders.Items[i].Value + ",";
                }
            }
            xmlTopLeaders.SetAttribute("ID", LeaderTemp);
        }
        else
        {
            LeaderTemp = "noapprovers";
        }
        dataFields.Add("TopLeaders", LeaderTemp);
        if (!string.IsNullOrEmpty(Countersign1.Result))
        {
            LeaderTemp = FilterDataField2(Countersign1.GetCounterSignUsers());
            XmlElement xmleCountersign = xmldoc.CreateElement("Countersign");
            xmleLeaders.AppendChild(xmleCountersign);
            xmleCountersign.SetAttribute("ID", LeaderTemp);
        }
        else
        {
            LeaderTemp = string.Empty;
        }
        dataFields.Add("CounterSignUsers", LeaderTemp);
        if (1 == 1)
        {
            LeaderTemp = FilterDataField2(GetRoleUsers(startDeptId, "部门负责人"));
            XmlElement xmleDeptManager = xmldoc.CreateElement("DeptManager");
            xmleLeaders.AppendChild(xmleDeptManager);
            xmleDeptManager.SetAttribute("ID", LeaderTemp);
            dataFields.Add("DeptManager", LeaderTemp);
        }

        strApprovers = xmleLeaders.OuterXml;
        if (!flag)
        {
            dataFields = null;
        }
        return(dataFields);
    }
Exemple #26
0
    /// <summary>
    /// 绑定表单数据
    /// </summary>
    private void BindFormDate()
    {
        try
        {
            //根据formid得到合同表单数据
            ContractAuditOfEToGInfo obj = Eitems.Get(ViewState["FormID"].ToString());
            lbIsReport.Text = string.IsNullOrEmpty(obj.RelatedFormID) ? "0" : "1";
            if (lbIsReport.Text == "0")
            {
                ListItem item = ddlDepartName.Items.FindByValue(obj.DeptCode);
                if (item != null)
                {
                    ddlDepartName.SelectedIndex = ddlDepartName.Items.IndexOf(item);
                }
            }
            else
            {
                ddlDepartName.Items.Clear();
                string     CompanyCode = BPMHelp.GetCompanyCodeByDeptID(StartDeptId);
                Department deptInfo    = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(CompanyCode);

                ListItem item = new ListItem {
                    Text = deptInfo.DepartName, Value = CompanyCode
                };
                ddlDepartName.Items.Add(item);
                ddlDepartName.Enabled = false;
            }

            //保存数据
            tbReportCode.Text    = obj.FormID;
            tbUserName.Text      = obj.UserName;
            tbMobile.Text        = obj.Mobile;
            UpdatedTextBox.Value = obj.DateTime;
            //合同类型
            ListItem li1 = ddlContractType1.Items.FindByValue(obj.ContractType1);
            if (li1 != null)
            {
                li1.Selected = true;
            }
            ddlContractType2.DataSource     = ContractTypeInfosHelper.GetSecondContractTypeInfos(ddlContractType1.SelectedItem.Value);
            ddlContractType2.DataTextField  = "value";
            ddlContractType2.DataValueField = "key";
            ddlContractType2.DataBind();

            ListItem li2 = ddlContractType2.Items.FindByValue(obj.ContractType2);
            if (li2 != null)
            {
                li2.Selected = true;
            }
            if (ddlContractType2.SelectedItem != null)
            {
                ddlContractType3.DataSource     = ContractTypeInfosHelper.GetThirdContractTypeInfos(ddlContractType2.SelectedItem.Value);
                ddlContractType3.DataTextField  = "value";
                ddlContractType3.DataValueField = "key";
                ddlContractType3.DataBind();
                ListItem li3 = ddlContractType3.Items.FindByValue(obj.ContractType3);
                if (li3 != null)
                {
                    li3.Selected = true;
                }
            }

            tbContractSum.Text = obj.ContractSum;
            cblIsSupplementProtocol.SelectedValue = obj.IsSupplementProtocol;
            tbSupplementProtocol.Text             = obj.IsSupplementProtocolText;
            cblIsFormatContract.SelectedValue     = obj.IsFormatContract;
            cblIsNormText.SelectedValue           = obj.IsNormText;
            cblIsBidding.SelectedValue            = obj.IsBidding;
            cblIsEstateProject.SelectedValue      = obj.IsEstateProject;
            ddlEstateProjectName.SelectedValue    = obj.EstateProjectName;
            ddlEstateProjectNum.SelectedValue     = obj.EstateProjectNum;
            //合同主体
            ddlContractSubject.SelectedValue = obj.ContractSubject;
            tbContractSubject1.Text          = obj.ContractSubjectName2;
            tbContractSubject2.Text          = obj.ContractSubjectName3;
            tbContractSubject3.Text          = obj.ContractSubjectName4;

            tbContractTitle.Text           = obj.ContractTitle;
            tbContractContent.Text         = obj.ContractContent;
            cblSecurityLevel.SelectedIndex = int.Parse(obj.SecurityLevel.ToString());
            cblUrgenLevel.SelectedIndex    = int.Parse(obj.UrgenLevel.ToString());
            cbIsReport.Checked             = obj.IsReport == "1" ? true : false;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    /// <summary>
    /// 初始化表单数据 使用linq
    /// </summary>
    protected override void InitFormData()
    {
        try
        {
            ///加载业务数据
            ///通过formid得到表单信息
            Pkurg.PWorldBPM.Business.BIZ.OA_ContractOfWY info = BizContext.OA_ContractOfWY.FirstOrDefault(x => x.FormID == FormId);

            lbIsReport.Text = string.IsNullOrEmpty(info.RelatedFormID) ? "0" : "1";
            if (lbIsReport.Text == "0")
            {
                ListItem item = ddlDepartName.Items.FindByValue(info.DeptCode);
                if (item != null)
                {
                    ddlDepartName.SelectedIndex = ddlDepartName.Items.IndexOf(item);
                }
            }
            else
            {
                ddlDepartName.Items.Clear();
                string     CompanyCode = BPMHelp.GetCompanyCodeByDeptID(StartDeptId);
                Department deptInfo    = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(CompanyCode);

                ListItem item = new ListItem {
                    Text = deptInfo.DepartName, Value = CompanyCode
                };
                ddlDepartName.Items.Add(item);
                ddlDepartName.Enabled = false;
            }

            if (info != null)
            {
                ListItem selectedItem = ddlDepartName.Items.FindByValue(info.DeptCode);
                if (selectedItem != null)
                {
                    selectedItem.Selected = true;
                }
                StartDeptId = info.DeptCode;


                //读取已保存的数据
                tbReportCode.Text = info.FormID;
                cblSecurityLevel.SelectedIndex = int.Parse(info.SecurityLevel.ToString());
                cblUrgenLevel.SelectedIndex    = int.Parse(info.UrgenLevel.ToString());
                ddlDepartName.SelectedValue    = info.DeptName;
                tbDateTime.Text                  = info.DateTime;
                UpdatedTextBox.Value             = info.DateTime;
                tbUserName.Text                  = info.UserName;
                tbMobile.Text                    = info.Mobile;
                cblIsReportToWY.SelectedValue    = info.IsReportToWY;
                cblIsReportToGroup.SelectedValue = info.IsReportToGroup;
                //合同类型
                ListItem li1 = ddlContractType1.Items.FindByValue(info.ContractType1);
                if (li1 != null)
                {
                    li1.Selected = true;
                }
                ddlContractType2.DataSource     = ContractTypeInfosHelper.GetSecondContractTypeInfos1(ddlContractType1.SelectedItem.Value);
                ddlContractType2.DataTextField  = "value";
                ddlContractType2.DataValueField = "key";
                ddlContractType2.DataBind();

                ListItem li2 = ddlContractType2.Items.FindByValue(info.ContractType2);
                if (li2 != null)
                {
                    li2.Selected = true;
                }
                if (ddlContractType2.SelectedItem != null)
                {
                    ddlContractType3.DataSource     = ContractTypeInfosHelper.GetThirdContractTypeInfos1(ddlContractType2.SelectedItem.Value);
                    ddlContractType3.DataTextField  = "value";
                    ddlContractType3.DataValueField = "key";
                    ddlContractType3.DataBind();
                    ListItem li3 = ddlContractType3.Items.FindByValue(info.ContractType3);
                    if (li3 != null)
                    {
                        li3.Selected = true;
                    }
                }

                tbContractSum.Text = info.ContractSum;
                cblIsSupplementProtocol.SelectedValue = info.IsSupplementProtocol;
                tbSupplementProtocol.Text             = info.IsSupplementProtocolText;
                cblIsFormatContract.SelectedValue     = info.IsFormatContract;
                cblIsNormText.SelectedValue           = info.IsNormText;
                cblIsBidding.SelectedValue            = info.IsBidding;
                //合同主体
                ddlContractSubject.SelectedValue = info.ContractSubject;
                tbContractSubject1.Text          = info.ContractSubjectName2;
                tbContractSubject2.Text          = info.ContractSubjectName3;
                tbContractSubject3.Text          = info.ContractSubjectName4;

                tbContractTitle.Text   = info.ContractTitle;
                tbContractContent.Text = info.ContractContent;

                InitCheckBoxList(info.LeadersSelected);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Exemple #28
0
    /// <summary>
    /// 设置流程参数
    /// </summary>
    /// <returns></returns>
    private NameValueCollection SetWFParams()
    {
        NameValueCollection dataFields = new NameValueCollection();

        BFPmsUserRoleDepartment bfurd = new BFPmsUserRoleDepartment();

        //动态获取待定
        string     startDeptId = ddlDepartName.SelectedItem.Value;
        Department deptInfo    = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(startDeptId);
        string     CompanyCode = BPMHelp.GetCompanyCodeByDeptID(startDeptId);

        string ExecutiveDirector = string.Empty; //执行主任
        String Members           = string.Empty; //招标委员会成员
        String Director          = string.Empty; //招标委员会主任

        //验证部分步骤的审批人是否尚未配置
        bool flag = true;

        if (string.IsNullOrEmpty(GetRoleUsers(PKURGICode, "执行主任")))
        {
            flag = false;
            Alert(Page, "执行主任尚未配置!");
        }
        if (string.IsNullOrEmpty(GetRoleUsers(CompanyCode, "招标委员会成员")))
        {
            flag = false;
            Alert(Page, "公司招标委员会成员尚未配置!");
        }
        if (string.IsNullOrEmpty(GetRoleUsers(CompanyCode, "招标委员会主任")))
        {
            flag = false;
            Alert(Page, "公司招标委员会主任尚未配置!");
        }
        if (string.IsNullOrEmpty(GetRoleUsers(PKURGICode, "招标委员会成员")))
        {
            flag = false;
            Alert(Page, "集团招标委员会成员尚未配置!");
        }
        if (string.IsNullOrEmpty(GetRoleUsers(PKURGICode, "招标委员会主任")))
        {
            flag = false;
            Alert(Page, "集团招标委员会主任尚未配置!");
        }

        List <string> countersigns       = Countersign1.Result.Split(',').ToList();
        List <string> countersigns_group = Countersign_Group1.Result.Split(',').ToList();

        if ((CompanyCode != PKURGICode && cblIsAccreditByGroup.SelectedItem.Value == "1") || CompanyCode == PKURGICode)
        {
            ExecutiveDirector = GetRoleUsers(PKURGICode, "执行主任");
        }
        if (CompanyCode != PKURGICode && cblIsAccreditByGroup.SelectedIndex == 0)
        {
            Members  = GetRoleUsers(CompanyCode, cblFirstLevel.SelectedIndex == 0 ? "招标委员会成员(一级)" : "招标委员会成员");
            Director = GetRoleUsers(CompanyCode, "招标委员会主任");
        }
        if (CompanyCode != PKURGICode && cblIsAccreditByGroup.SelectedIndex == 1)
        {
            Members  = GetRoleUsers(PKURGICode, "招标委员会成员") + "," + GetRoleUsers(CompanyCode, "招标委员会主任");
            Director = GetRoleUsers(PKURGICode, "招标委员会主任");
        }
        if (CompanyCode == PKURGICode)
        {
            Members  = GetRoleUsers(PKURGICode, "招标委员会成员");
            Director = GetRoleUsers(PKURGICode, "招标委员会主任");
        }
        dataFields.Add("CounterSignUsers", FilterDataField(Countersign1.GetCounterSignUsers()));
        dataFields.Add("CounterSignUsers_Group", FilterDataField(Countersign_Group1.GetCounterSignUsers()));
        dataFields.Add("Members", FilterDataField(Members));
        dataFields.Add("Director", FilterDataField(Director));
        dataFields.Add("ExecutiveDirector", FilterDataField(ExecutiveDirector));

        //dataFields.Add("IsGroup", companyCode == "B04-D319"?"yes":"no");
        //dataFields.Add("IsReport", cblIsAccreditByGroup.SelectedIndex == 1?"yes":"no");
        dataFields.Add("IsPass", "1");
        if (!flag)
        {
            dataFields = null;
        }
        return(dataFields);
    }
    /// <summary>
    /// 设置流程参数
    /// </summary>
    /// <returns></returns>
    private NameValueCollection SetWFParams()
    {
        //常量DataField
        NameValueCollection dataFields = LoadConstDataField();

        if (dataFields == null)
        {
            dataFields = new NameValueCollection();
        }
        //用户DataField
        List <K2_DataFieldInfo> dfInfos = LoadUserDataField();

        dfInfos = dfInfos.OrderBy(x => x.OrderId).ToList();//排序

        #region 用户DataField
        List <string> userList = new List <string>();
        foreach (var item in dfInfos)
        {
            if (string.IsNullOrEmpty(item.Result))
            {
                if (string.IsNullOrEmpty(item.RoleName) || string.IsNullOrEmpty(item.Name))
                {
                    //参数错误
                    ExceptionHander.GoToErrorPage("K2DataFieldInfo信息不全");
                }
                if (string.IsNullOrEmpty(item.DeptCode) || string.IsNullOrEmpty(item.DeptCode.Trim(',')))
                {
                    dataFields.Add(item.Name, "noapprovers");
                    continue;
                }

                string        users = "";
                List <string> depts = item.DeptCode.Split(',').ToList();
                foreach (var csDeptId in depts)
                {
                    if (!string.IsNullOrEmpty(csDeptId))
                    {
                        foreach (var roleNameItem in item.RoleName.Split(',').ToList())
                        {
                            string currentUsers = Workflow_Common.GetRoleUsers(csDeptId, roleNameItem);
                            if (currentUsers == "noapprovers" && item.IsHaveToExsit)
                            {
                                Department counterDept = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(csDeptId);
                                Alert(counterDept.Remark + roleNameItem + "尚未配置!");
                                return(null);
                            }
                            else if (currentUsers != "noapprovers" && !users.Trim(',').Split(',').ToList().Contains(currentUsers))
                            {
                                users += "," + currentUsers;
                            }
                        }
                    }
                }
                users = users.Trim(',');
                if (string.IsNullOrEmpty(users))
                {
                    users = "noapprovers";
                }
                if (users != "noapprovers")
                {
                    List <string> currentUsers = users.Split(',').ToList();
                    users = users + ",";
                    currentUsers.ForEach(x =>
                    {
                        if (userList.Contains(x) && item.IsRepeatIgnore)
                        {
                            users = users.Replace(x + ",", "");
                        }

                        if (item.OrderId > 0)
                        {
                            userList.Add(x);///只有OrderId > 0的才参与去重(OrderId > 0的是去重范围)
                        }
                    });
                    if (string.IsNullOrEmpty(users.Trim(',')))
                    {
                        users = "noapprovers";
                    }
                }
                item.Result = users.Trim(',');
            }
        }
        foreach (var item in dfInfos)
        {
            dataFields.Add(item.Name, item.Result);
        }
        #endregion

        return(dataFields);
    }
    /// <summary>
    /// 设置流程参数
    /// </summary>
    /// <returns></returns>
    private NameValueCollection SetWFParams()
    {
        NameValueCollection dataFields = new NameValueCollection();

        BFPmsUserRoleDepartment bfurd = new BFPmsUserRoleDepartment();

        //动态获取待定
        string     startDeptId = ddlDepartName.SelectedItem.Value;
        Department deptInfo    = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(startDeptId);
        string     CompanyCode = BPMHelp.GetCompanyCodeByDeptID(startDeptId);

        DataTable DeptManager       = bfurd.GetSelectRoleUser(startDeptId, "部门负责人");
        DataTable CityCompanyLeader = bfurd.GetSelectRoleUser(CompanyCode, "集采城市公司负责人");
        DataTable JCFirstApproval   = bfurd.GetSelectRoleUser(CGDeptCode, "集采初审员");
        DataTable Designer          = bfurd.GetSelectRoleUser(YFSJDeptCode, "部门负责人");
        DataTable ProjectOperator   = bfurd.GetSelectRoleUser(XMYYDeptCode, "部门负责人");
        DataTable JCReApproval      = bfurd.GetSelectRoleUser(CGDeptCode, "集采复审员");
        DataTable Purchaser         = bfurd.GetSelectRoleUser(CGDeptCode, "部门负责人");
        DataTable COO             = bfurd.GetSelectRoleUser(XMYYDeptCode, "部门负责人");
        DataTable JCMakeOrder     = bfurd.GetSelectRoleUser(CGDeptCode, "集采初审员");
        DataTable JCFinalApproval = bfurd.GetSelectRoleUser(CGDeptCode, "集采复审员");

        //绑定datafields
        bool flag = true;//标记datafields内的变量是否均赋值

        if (string.IsNullOrEmpty(tbOrderType.Text.ToString()))
        {
            flag = false;
            Alert(Page, "订单类型不可为空");
        }
        else
        {
            dataFields.Add("OrderType", tbOrderType.Text.ToString());
        }
        if (string.IsNullOrEmpty(tbOrderID.Text.ToString()))
        {
            flag = false;
            Alert(Page, "订单编号不可为空");
        }
        else
        {
            dataFields.Add("OrderID", tbOrderID.Text.ToString());
        }
        //城市公司部门负责人
        if (DeptManager != null && DeptManager.Rows.Count > 0)
        {
            dataFields.Add("DeptManager", "K2:Founder\\" + DeptManager.Rows[0]["LoginName"].ToString());
        }
        else
        {
            flag = false;
            Alert(Page, "您所在部门负责人 尚未配置!");
        }

        if (string.IsNullOrEmpty(Countersign1.GetCounterSignUsers()))
        {
            flag = false;
            Alert(Page, "相关部门会签必须选择“合约审算部”!");
        }
        else
        {
            dataFields.Add("CounterSignUsers", Countersign1.GetCounterSignUsers());
        }
        //城市公司负责人
        if (CityCompanyLeader != null && CityCompanyLeader.Rows.Count > 0)
        {
            dataFields.Add("CityCompanyLeader", "K2:Founder\\" + CityCompanyLeader.Rows[0]["LoginName"].ToString());
        }
        else
        {
            flag = false;
            Alert(Page, "您所在公司负责人 尚未配置!");
        }

        //集采初审
        if (JCFirstApproval != null && JCFirstApproval.Rows.Count > 0)
        {
            dataFields.Add("JCFirstApproval", "K2:Founder\\" + JCFirstApproval.Rows[0]["LoginName"].ToString());
        }
        else
        {
            flag = false;
            Alert(Page, "集团采购管理部初审 尚未配置!");
        }

        //研发设计
        if (Designer != null && Designer.Rows.Count > 0)
        {
            dataFields.Add("Designer", "K2:Founder\\" + Designer.Rows[0]["LoginName"].ToString());
        }
        else
        {
            flag = false;
            Alert(Page, "集团研发设计部负责人 尚未配置!");
        }

        //项目运营
        if (ProjectOperator != null && ProjectOperator.Rows.Count > 0)
        {
            dataFields.Add("ProjectOperator", "K2:Founder\\" + ProjectOperator.Rows[0]["LoginName"].ToString());
        }
        else
        {
            flag = false;
            Alert(Page, "集团项目运营部负责人 尚未配置");
        }

        //集采复审
        if (JCReApproval != null && JCReApproval.Rows.Count > 0)
        {
            dataFields.Add("JCReApproval", "K2:Founder\\" + JCReApproval.Rows[0]["LoginName"].ToString());
        }
        else
        {
            flag = false;
            Alert(Page, "集团采购管理部复审 尚未配置!");
        }

        //采购负责人
        if (Purchaser != null && Purchaser.Rows.Count > 0)
        {
            dataFields.Add("Purchaser", "K2:Founder\\" + Purchaser.Rows[0]["LoginName"].ToString());
        }
        else
        {
            flag = false;
            Alert(Page, "集团采购管理部负责人 尚未配置!");
        }

        //COO
        if (COO != null && COO.Rows.Count > 0)
        {
            dataFields.Add("COO", "K2:Founder\\" + COO.Rows[0]["LoginName"].ToString());
        }
        else
        {
            flag = false;
            Alert(Page, "集团COO 尚未配置!");
        }

        //集采下单
        if (JCMakeOrder != null && JCMakeOrder.Rows.Count > 0)
        {
            dataFields.Add("JCMakeOrder", "K2:Founder\\" + JCMakeOrder.Rows[0]["LoginName"].ToString());
        }
        else
        {
            flag = false;
            Alert(Page, "集团采购管理部下单 尚未配置!");
        }

        //集采复核
        if (JCFinalApproval != null && JCFinalApproval.Rows.Count > 0)
        {
            dataFields.Add("JCFinalApproval", "K2:Founder\\" + JCFinalApproval.Rows[0]["LoginName"].ToString());
        }
        else
        {
            flag = false;
            Alert(Page, "集团采购管理部复审 尚未配置!");
        }
        if (!flag)
        {
            dataFields = null;
        }
        return(dataFields);
    }