当前位置: 首页>>代码示例>>C#>>正文


C# NameCollection.JoinString方法代码示例

本文整理汇总了C#中NameCollection.JoinString方法的典型用法代码示例。如果您正苦于以下问题:C# NameCollection.JoinString方法的具体用法?C# NameCollection.JoinString怎么用?C# NameCollection.JoinString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NameCollection的用法示例。


在下文中一共展示了NameCollection.JoinString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StartWorkflowButton_Executing

        private void StartWorkflowButton_Executing(object sender, CancelEventArgs e)
        {
            string url = Request.UrlReferrer.ToString();
            if (!this.DataForm.SubmitStatus)
            {
                Response.Write("<script type=\"text/javascript\">alert('You are not in Buying Department .');window.location = '" + url + "';</script>");
                Response.End();
                e.Cancel = true;
                return;
            }
            WorkflowContext context = WorkflowContext.Current;
            WorkflowDataFields fields = WorkflowContext.Current.DataFields;
            var btn = sender as StartWorkflowButton;
            if (string.Equals(btn.Text, "Save", StringComparison.CurrentCultureIgnoreCase))
            {
                context.UpdateWorkflowVariable("IsSave", true);
                context.DataFields["Status"] = CAWorkflowStatus.Pending;
            }
            else
            {
                #region Set users for workflow
                Employee manager = WorkFlowUtil.GetApproverByLevelPAD(this.DataForm.Applicant);
                if (null == manager)
                {
                    Response.Write("<script type=\"text/javascript\">alert('The init error about applicant’s manager in the system.');window.location = '" + url + "';</script>");
                    Response.End();
                    e.Cancel = true;
                    return;
                }
                NameCollection DMMTask = new NameCollection();
                DMMTask.Add(manager.UserAccount);
                fields["CurrManager"] = manager.UserAccount;

                NameCollection wf_NTSC_QM = new NameCollection();
                //NameCollection wf_NTSC_QAD = new NameCollection();
                NameCollection wf_NTSC_SCM = new NameCollection();
                NameCollection wf_NTSC_SCMM = new NameCollection();
                List<string> qm = WorkFlowUtil.UserListInGroup(NewProductionUnitCreationConstants.wf_NTSC_QM);
                //List<string> qad = WorkFlowUtil.UserListInGroup(NewProductionUnitCreationConstants.wf_NTSC_QAD);
                List<string> scm = WorkFlowUtil.UserListInGroup(NewProductionUnitCreationConstants.wf_NTSC_SCM);
                List<string> scmm = WorkFlowUtil.UserListInGroup(NewProductionUnitCreationConstants.wf_NTSC_SCMM);
                System.Text.StringBuilder group = new System.Text.StringBuilder();
                if (qm.Count == 0)
                {
                    group.Append(" wf_NTSC_QM ");
                }
                //if (qad.Count == 0)
                //{
                //    group.Append(" wf_NTSC_QAD ");
                //}
                if (scm.Count == 0)
                {
                    group.Append(" wf_NTSC_SCM ");
                }
                if (scmm.Count == 0)
                {
                    group.Append(" wf_NTSC_SCMM ");
                }
                if (scm.Count == 0 || scmm.Count == 0 || qm.Count == 0)
                {
                    Response.Write("<script type=\"text/javascript\">alert('The init error about WorkflowPerson in the " + group.ToString() + "');window.location = '" + url + "';</script>");
                    Response.End();
                    e.Cancel = true;
                    return;
                }
                wf_NTSC_QM.AddRange(qm.ToArray());
                //wf_NTSC_QAD.AddRange(qad.ToArray());
                wf_NTSC_SCM.AddRange(scm.ToArray());
                wf_NTSC_SCMM.AddRange(scmm.ToArray());

                System.Text.StringBuilder strStepAndUsers = new System.Text.StringBuilder();
                strStepAndUsers.AppendFormat("{0}:{1};", "DMMTask", DMMTask.JoinString(","));
                strStepAndUsers.AppendFormat("{0}:{1};", "QMTask", wf_NTSC_QM.JoinString(","));
                //strStepAndUsers.AppendFormat("{0}:{1};", "QADTask", wf_NTSC_QAD.JoinString(","));
                strStepAndUsers.AppendFormat("{0}:{1};", "SCMTask", wf_NTSC_SCM.JoinString(","));
                strStepAndUsers.AppendFormat("{0}:{1};", "SCMConfirmTask", wf_NTSC_SCMM.JoinString(","));
                fields["WorkFlowStepsAndUsers"] = strStepAndUsers.ToString();

                context.UpdateWorkflowVariable("NextApproveTaskUsers", GetDelemanNameCollection(DMMTask, WorkFlowUtil.GetModuleIdByListName("New Production Unit Creation")));
                #endregion
                context.UpdateWorkflowVariable("IsSave", false);
                context.DataFields["Status"] = CAWorkflowStatus.InProgress;
            }
            #region Save the data
            string workflowNumber = CreateWorkflowNumber();
            fields["WorkFlowNumber"] = workflowNumber;
            fields["Applicant"] = this.DataForm.Applicant.UserAccount;
            fields["Department"] = this.DataForm.Applicant.Department;
            fields["ApplicantSPUser"] = NewProductionUnitCreation.EnsureUser(this.DataForm.Applicant.UserAccount);
            fields["SupplierName"] = this.DataForm.SupplierName;
            fields["SubDivision"] = this.DataForm.Applicant.Department;
            fields["SupplierNo"] = this.DataForm.SupplierNo;
            fields["PUNO"] = this.DataForm.PUNO;
            fields["ProductionUnitName"] = this.DataForm.ProductionUnitName;
            fields["IsMondial"] = this.DataForm.IsMondial == "Yes" ? true : false;
            fields["Reason"] = this.DataForm.Reason;
            #endregion
            #region Set title for workflow
            //string taskTitle = string.Format("{0} {1} {2}'s New Production Unit Creation needs approval"
            //                                             , workflowNumber
//.........这里部分代码省略.........
开发者ID:porter1130,项目名称:C-A,代码行数:101,代码来源:NewForm.aspx.cs

示例2: StartWorkflowButton1_Executing

        void StartWorkflowButton1_Executing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            StartWorkflowButton btnStart = sender as StartWorkflowButton;

            if (string.Equals(btnStart.Text, "Save", StringComparison.CurrentCultureIgnoreCase))
            {
                WorkflowContext.Current.UpdateWorkflowVariable("IsSave", true);
                DataForm1.Update();
                WorkflowContext.Current.DataFields["Status"] = "NonSubmit";
            }
            else
            {
                string msg = DataForm1.Validate();
                if (!string.IsNullOrEmpty(msg))
                {
                    DisplayMessage(msg);
                    e.Cancel = true;
                    return;
                }
                WorkflowContext.Current.DataFields["Status"] = "In Progress";
            }

            //WorkflowContext.Current.UpdateWorkflowVariable("DepartmentHead", WorkFlowUtil.GetUserInGroup("wf_BSSHead"));
            List<string> strGroupUser = WorkFlowUtil.UserListInGroup("wf_Finance_SR");
            if (strGroupUser.Count == 0)
            {
                //Don
                DisplayMessage("Unable to submit the application. There is no user in wf_Finance_SR. Please contact IT for further help.");
                e.Cancel = true;
                return;
            }
            NameCollection GroupUsers = new NameCollection();
            GroupUsers.AddRange(strGroupUser.ToArray());
            //WorkflowContext.Current.UpdateWorkflowVariable("FinanceTaskUsers", GroupUsers);

            System.Text.StringBuilder strStepAndUsers = new System.Text.StringBuilder();
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierReinspectionDepartmentHeadApproval, WorkFlowUtil.GetUserInGroup("wf_BSSHead"));
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierReinspectionFinanceTask, GroupUsers.JoinString(","));
            WorkflowContext.Current.DataFields["WorkFlowStepsAndUsers"] = strStepAndUsers.ToString();

            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierReinspectionDepartmentHead, GetDelemanNameCollection(new NameCollection(WorkFlowUtil.GetUserInGroup("wf_BSSHead")), Constants.CAModules.SupplierReInspectionCharge));
            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierReinspectionFinanceTaskUsers, GetDelemanNameCollection(GroupUsers, Constants.CAModules.SupplierReInspectionCharge));

            WorkflowContext.Current.UpdateWorkflowVariable("DepartmentHeadTaskTitle", DataForm1.Applicant.DisplayName + "'s re-inspection request needs approval");
            WorkflowContext.Current.UpdateWorkflowVariable("FinanceUserTaskTitle", "Please complete re-inspection request for " + DataForm1.Applicant.DisplayName);
            this.WorkFlowNumber = CreateWorkFlowNumber();
            WorkflowContext.Current.DataFields["WorkflowNumber"] = this.WorkFlowNumber;
            DataForm1.WorkflowNumber = this.WorkFlowNumber;
            WorkflowContext.Current.DataFields["FileName"] = DataForm1.Submit();

            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
开发者ID:porter1130,项目名称:C-A,代码行数:52,代码来源:NewForm.aspx.cs

示例3: UpdateWorkFlowDataFields

        /// <summary>
        /// 更新工作流相关list中字段数据
        /// </summary>
        /// <param name="dpTaskUsers">部门领导</param>
        /// <param name="isSave">是否为保存数据状态</param>
        private void UpdateWorkFlowDataFields(NameCollection dpTaskUsers, bool isSave)
        {
            WorkflowContext.Current.DataFields["Status"] = isSave ? CAWorkflowStatus.Pending :
                                                                     CAWorkflowStatus.InProgress;
            WorkflowContext.Current.DataFields["WorkFlowNumber"] = CreateWorkflowNumber();
            WorkflowContext.Current.DataFields["Applicant"] = CurrentEmployee.DisplayName +
                                                              "(" + CurrentEmployee.UserAccount + ")";
            WorkflowContext.Current.DataFields["DepartmentVal"] = CurrentEmployee.Department;
            WorkflowContext.Current.DataFields["Manager"] = dpTaskUsers.Count > 0 ? dpTaskUsers[0] : "";
            //Update varivable.(Payment term less than 30 days required CFO's special approval)
            WorkflowContext.Current.DataFields["PaymentTerm"] = DataForm1.PaymentTerm;

            var DepartmentHeadTaskUsers = new NameCollection();
            var MDMTaskUsers = new NameCollection();
            var CFOTaskUsers = new NameCollection();

            string department = CurrentEmployee.Department;
            DepartmentHeadTaskUsers.Add(UserProfileUtil.GetDepartmentManager(department));

            List<string> lst = WorkFlowUtil.UserListInGroup("wf_CFO");
            CFOTaskUsers.AddRange(lst.ToArray());

            lst = WorkFlowUtil.UserListInGroup("wf_Finance_MDM");
            MDMTaskUsers.AddRange(lst.ToArray());

            //WorkflowContext.Current.UpdateWorkflowVariable("DepartmentHeadTaskUsers", DepartmentHeadTaskUsers);
            //WorkflowContext.Current.UpdateWorkflowVariable("MDMTaskUsers", MDMTaskUsers);
            //WorkflowContext.Current.UpdateWorkflowVariable("CFOTaskUsers", CFOTaskUsers);

            System.Text.StringBuilder strStepAndUsers = new System.Text.StringBuilder();
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierSetupMaintenanceDepartmentHeadTask, DepartmentHeadTaskUsers.JoinString(","));
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierSetupMaintenanceMDMTask, MDMTaskUsers.JoinString(","));
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierSetupMaintenanceCFOTask, CFOTaskUsers.JoinString(","));
            WorkflowContext.Current.DataFields["WorkFlowStepsAndUsers"] = strStepAndUsers.ToString();
        }
开发者ID:porter1130,项目名称:C-A,代码行数:40,代码来源:NewForm.aspx.cs

示例4: UpdateWorkFlowDataFields

        /// <summary>
        /// 更新工作流相关list中字段数据
        /// </summary>
        /// <param name="dpTaskUsers">部门领导</param>
        private void UpdateWorkFlowDataFields(NameCollection dpTaskUsers)
        {
            WorkflowContext.Current.DataFields["Status"] = CAWorkflowStatus.InProgress;
            WorkflowContext.Current.DataFields["Manager"] = dpTaskUsers.Count > 0 ? dpTaskUsers[0] : "";

            var DepartmentManagerTaskUsers = new NameCollection();
            var FinanceAnalystTaskUsers = new NameCollection();
            var CFOTaskUsers = new NameCollection();

            DepartmentManagerTaskUsers.Add(UserProfileUtil.GetDepartmentManager(CurrentEmployee.Department));

            List<string> lst = WorkFlowUtil.UserListInGroup("wf_CFO");
            CFOTaskUsers.AddRange(lst.ToArray());

            lst = WorkFlowUtil.UserListInGroup("wf_FinanceAnalyst_IO");
            FinanceAnalystTaskUsers.AddRange(lst.ToArray());
            //WorkflowContext.Current.UpdateWorkflowVariable("FinanceAnalystTaskUsers", FinanceAnalystTaskUsers);
            //WorkflowContext.Current.UpdateWorkflowVariable("CFOTaskUsers", CFOTaskUsers);
            //WorkflowContext.Current.UpdateWorkflowVariable("DepartmentManagerTaskUsers", DepartmentManagerTaskUsers);

            System.Text.StringBuilder strStepAndUsers = new System.Text.StringBuilder();
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.InternalOrderMaintenanceDepartmentManagerTask, DepartmentManagerTaskUsers.JoinString(","));
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.InternalOrderMaintenanceCFOTask, CFOTaskUsers.JoinString(","));
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.InternalOrderMaintenanceFinanceAnalystTask, FinanceAnalystTaskUsers.JoinString(","));
            WorkflowContext.Current.DataFields["WorkFlowStepsAndUsers"] = strStepAndUsers.ToString();
        }
开发者ID:porter1130,项目名称:C-A,代码行数:30,代码来源:EditForm.aspx.cs

示例5: StartWorkFlowButton_Executing

        private void StartWorkFlowButton_Executing(object sender, CancelEventArgs e)
        {
            WorkflowContext context = WorkflowContext.Current;
            WorkflowDataFields fields = WorkflowContext.Current.DataFields;

            var btn = sender as StartWorkflowButton;
            //save AdvanceRequestWF
            if (string.Equals(btn.Text, "Save", StringComparison.CurrentCultureIgnoreCase))
            {
                context.UpdateWorkflowVariable("IsSave", true);
                context.UpdateWorkflowVariable("CompleteTaskTitle", "Please complete Cash Advance Request");
                fields["Status"] = CAWorkflowStatus.Pending;
            }
            //submit AdvanceRequestWF
            if (string.Equals(btn.Text, "Submit", StringComparison.CurrentCultureIgnoreCase))
            {
                //get next approver
                string errorMsg = this.DataForm1.CheckInfo();
                if (errorMsg.IsNotNullOrWhitespace())
                {
                    DisplayMessage(errorMsg);
                    e.Cancel = true;
                    return;
                }
                var managerEmp = WorkFlowUtil.GetNextApprover(this.DataForm1.Applicant);
                if (managerEmp == null)
                {
                    if (!WorkflowPerson.IsCEO(this.DataForm1.Applicant.UserAccount))
                    {
                        DisplayMessage("The manager is not set in the system.");
                        e.Cancel = true;
                        return;
                    }
                    else
                    {
                        List<string> cfos = WorkflowPerson.GetCFO();
                        if (cfos.Count == 0)
                        {
                            DisplayMessage("The init error about WorkflowPerson in the system.");
                            e.Cancel = true;
                            return;
                        }
                        managerEmp = CA.SharePoint.UserProfileUtil.GetEmployeeEx(cfos[0]);
                    }
                }
                NameCollection manager = new NameCollection();
                manager.Add(managerEmp.UserAccount);
                fields["CurrManager"] = managerEmp.UserAccount;
                NameCollection wfCFO = WorkFlowUtil.GetUsersInGroup("wf_Finace_FC");
                NameCollection wfFinaceConfirm = WorkFlowUtil.GetUsersInGroup("wf_FinanceConfirm");

                System.Text.StringBuilder strStepAndUsers = new System.Text.StringBuilder();
                if (wfCFO.Contains(CurrentEmployee.UserAccount) && this.DataForm1.CashAdvanceType == "Urgent")
                {
                    WorkflowContext.Current.UpdateWorkflowVariable("IsFinance", true);

                }
                else
                {
                    WorkflowContext.Current.UpdateWorkflowVariable("IsFinance", false);
                }

                strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceNextApproveTask, manager.JoinString(","));
                strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceFinaceApprove, wfCFO.JoinString(","));
                strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceFinaceConfirmEnd, wfFinaceConfirm.JoinString(","));
                strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceFinaceConfirm, wfFinaceConfirm.JoinString(","));
                WorkflowContext.Current.DataFields["WorkFlowStepsAndUsers"] = strStepAndUsers.ToString();
                WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceNextApproveTaskUsers, GetDelemanNameCollection(manager, Constants.CAModules.CashAdvanceRequest));
                context.UpdateWorkflowVariable("IsContinue", true);
                //string strNextTaskTitle = string.Format("{0}'s Cash Advance Request needs approval", this.DataForm1.Applicant.DisplayName);
                //context.UpdateWorkflowVariable("NextApproveTaskTitle", strNextTaskTitle);
                context.UpdateWorkflowVariable("IsSave", false);
                context.UpdateWorkflowVariable("IsUrgent", false);
                if (this.DataForm1.CashAdvanceType == "Urgent")
                {
                    context.UpdateWorkflowVariable("IsUrgent", true);
                }
                fields["Status"] = CAWorkflowStatus.InProgress;
                SendEmail("Submit");
            }
            var editURL = "/_Layouts/CA/WorkFlows/CashAdvanceRequest/EditForm.aspx";
            var approveURL = "/_Layouts/CA/WorkFlows/CashAdvanceRequest/ApproveForm.aspx";
            context.UpdateWorkflowVariable("CompleteTaskFormURL", editURL);
            context.UpdateWorkflowVariable("NextApproveTaskFormURL", approveURL);
            DataBindFields(fields);
            string strNextTaskTitle = string.Format("{0} {1} {2}'s Cash Advance Request", fields["WorkflowNumber"].AsString(), this.DataForm1.Amount, this.DataForm1.Applicant.DisplayName);
            context.UpdateWorkflowVariable("NextApproveTaskTitle", strNextTaskTitle);

            WorkFlowUtil.UpdateWorkflowPath(context);
        }
开发者ID:porter1130,项目名称:C-A,代码行数:90,代码来源:NewForm.aspx.cs

示例6: Actions_ActionExecuting

        private void Actions_ActionExecuting(object sender, ActionEventArgs e)
        {
            WorkflowContext context = WorkflowContext.Current;
            WorkflowDataFields fields = WorkflowContext.Current.DataFields;
            switch (WorkflowContext.Current.Step)
            {

                case "NextApproveTask":
                    if (e.Action.Equals("Reject", StringComparison.CurrentCultureIgnoreCase)
                        && this.DataForm1.CashAdvanceType != "Urgent")
                    {
                        context.UpdateWorkflowVariable("IsUrgent", false);
                        WorkflowContext.Current.UpdateWorkflowVariable("IsContinue", false);
                        fields["Status"] = CAWorkflowStatus.Rejected;
                        context.UpdateWorkflowVariable("CompleteTaskTitle", "Please resubmit Cash Advance Request");
                        SendEmail("Reject");
                    }
                    else
                    {
                        string levelType = "Contract Approval Limits";
                        double total = Convert.ToDouble(fields["Amount"].ToString());
                        var quota = WorkFlowUtil.GetQuota(fields["CurrManager"].ToString(), levelType);
                        if (total > quota)
                        {
                            if (e.Action.Equals("Reject", StringComparison.CurrentCultureIgnoreCase))
                            {
                                context.UpdateWorkflowVariable("IsUrgent", true);
                                fields["CashAdvanceType"] = "Normal";
                                string strNextTaskTitle1 = string.Format("{0} {1} {2}'s Cash Advance Request", WorkflowContext.Current.DataFields["WorkflowNumber"].AsString(), WorkflowContext.Current.DataFields["Amount"].AsString(), WorkflowContext.Current.DataFields["Applicant"].AsString());
                                context.UpdateWorkflowVariable("NextApproveTaskTitle", strNextTaskTitle1);
                            }
                            var manager = new NameCollection();
                            var managerEmp = WorkFlowUtil.GetNextApprover(fields["CurrManager"].ToString());
                            if (managerEmp == null && !WorkflowPerson.IsCEO(fields["CurrManager"].ToString()))
                            {
                                DisplayMessage("The manager is not set in the system.");
                                e.Cancel = true;
                                return;
                            }
                            manager.Add(managerEmp.UserAccount);
                            fields["CurrManager"] = managerEmp.UserAccount;
                            NameCollection wfCFO = WorkFlowUtil.GetUsersInGroup("wf_Finace_FC");
                            NameCollection wfFinaceConfirm = WorkFlowUtil.GetUsersInGroup("wf_FinanceConfirm");
                            System.Text.StringBuilder strStepAndUsers = new System.Text.StringBuilder();
                            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceNextApproveTask, manager.JoinString(","));
                            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceFinaceApprove, wfCFO.JoinString(","));
                            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceFinaceConfirmEnd, wfFinaceConfirm.JoinString(","));
                            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceFinaceConfirm, wfFinaceConfirm.JoinString(","));
                            WorkflowContext.Current.DataFields["WorkFlowStepsAndUsers"] = strStepAndUsers.ToString();
                            WorkflowContext.Current.UpdateWorkflowVariable("IsContinue", true);
                            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceNextApproveTaskUsers, GetDelemanNameCollection(manager, Constants.CAModules.CashAdvanceRequest));
                        }
                        else
                        {
                            if (e.Action.Equals("Reject", StringComparison.CurrentCultureIgnoreCase))
                            {
                                context.UpdateWorkflowVariable("IsUrgent", true);
                                WorkflowContext.Current.UpdateWorkflowVariable("IsFinance", true);
                                fields["CashAdvanceType"] = "Normal";
                                string strNextTaskTitle2 = string.Format("{0} {1} {2}'s Cash Advance Request", WorkflowContext.Current.DataFields["WorkflowNumber"].AsString(), WorkflowContext.Current.DataFields["Amount"].AsString(), WorkflowContext.Current.DataFields["Applicant"].AsString());
                                context.UpdateWorkflowVariable("NextApproveTaskTitle", strNextTaskTitle2);
                            }
                            WorkflowContext.Current.UpdateWorkflowVariable("IsContinue", false);
                            NameCollection wfCFO1 = WorkFlowUtil.GetUsersInGroup("wf_Finace_FC");
                            string strNextTaskTitle = string.Format("{0} {1} {2}'s Cash Advance Request", WorkflowContext.Current.DataFields["WorkflowNumber"].AsString(), WorkflowContext.Current.DataFields["Amount"].AsString(), WorkflowContext.Current.DataFields["Applicant"].AsString());
                            if (!wfCFO1.Contains(WorkflowContext.Current.DataFields["Applicant"].ToString()) && this.DataForm1.CashAdvanceType == "Urgent")
                            {
                                NameCollection wfCFO2 = WorkFlowUtil.GetUsersInGroup("wf_Finace_FC");
                                WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceNextApproveTaskUsers, GetDelemanNameCollection(wfCFO2, Constants.CAModules.CashAdvanceRequest));
                            }
                            if (wfCFO1.Contains(WorkflowContext.Current.DataFields["Applicant"].ToString()) && this.DataForm1.CashAdvanceType == "Urgent")
                            {
                                NameCollection wfFinaceConfirm1 = WorkFlowUtil.GetUsersInGroup("wf_FinanceConfirm");
                                WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceNextApproveTaskUsers, GetDelemanNameCollection(wfFinaceConfirm1, Constants.CAModules.CashAdvanceRequest));

                                context.UpdateWorkflowVariable("NextApproveTaskTitle", strNextTaskTitle);
                            }
                            if (!wfCFO1.Contains(WorkflowContext.Current.DataFields["Applicant"].ToString()) && this.DataForm1.CashAdvanceType == "Normal")
                            {
                                NameCollection wfFinaceConfirm2 = WorkFlowUtil.GetUsersInGroup("wf_FinanceConfirm");
                                WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceNextApproveTaskUsers, GetDelemanNameCollection(wfFinaceConfirm2, Constants.CAModules.CashAdvanceRequest));
                                context.UpdateWorkflowVariable("NextApproveTaskTitle", strNextTaskTitle);
                            }
                            if (wfCFO1.Contains(WorkflowContext.Current.DataFields["Applicant"].ToString()) && this.DataForm1.CashAdvanceType == "Normal")
                            {
                                NameCollection wfFinaceConfirm2 = WorkFlowUtil.GetUsersInGroup("wf_FinanceConfirm");
                                WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceNextApproveTaskUsers, GetDelemanNameCollection(wfFinaceConfirm2, Constants.CAModules.CashAdvanceRequest));
                                context.UpdateWorkflowVariable("NextApproveTaskTitle", strNextTaskTitle);
                            }
                        }
                        fields["Status"] = CAWorkflowStatus.InProgress;
                    }
                    AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceApprovers, CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceApproversLoginName);
                    break;
                case "FinaceConfirmEnd":
                    if (e.Action.Equals("Confirm", StringComparison.CurrentCultureIgnoreCase))
                    {
                        //if (PostCashAdvanceToSAP(fields))
                        //{
                        context.UpdateWorkflowVariable("PostSAPResult", true);
//.........这里部分代码省略.........
开发者ID:porter1130,项目名称:C-A,代码行数:101,代码来源:ApproveForm.aspx.cs

示例7: SaveFormToWf

        void SaveFormToWf()
        {
            WorkflowContext curContext = WorkflowContext.Current;
            string passTo = DataForm1.PickedBy;
            //DateTime now = DateTime.Now;
            WorkflowDataFields fields = WorkflowContext.Current.DataFields;
            string taskTitle = SPContext.Current.Web.CurrentUser.Name + "'s Store Sampling";

            fields["Store Number"] = ((DropDownList)DataForm1.FindControl("ddlStoreNumber")).SelectedValue; //((TextBox)DataForm1.FindControl("txtStoreNumber")).Text;
            fields["Cost Center"] = string.Empty;

            fields["Issued to"] = ((DropDownList)DataForm1.FindControl("ddlIssuedTo")).SelectedValue;
            fields["Actual Quantity"] = ((TextBox)DataForm1.FindControl("txtActualQuantity")).Text;
            if (!string.IsNullOrEmpty(passTo))
            {
               // fields["Picked by"] = EnsureUser(passTo);
                fields["Picked by"] = web.SiteUsers[passTo];
            }
            fields["Picked Time"] = ((CADateTimeControl)DataForm1.FindControl("CADateTime1")).SelectedDate.ToShortDateString();

            DataForm1.WorkflowNumber = CreateWorkflowNumber();
            fields["WorkflowNumber"] = DataForm1.WorkflowNumber;
            fields["FileName"] = DataForm1.Submit();

            curContext.UpdateWorkflowVariable("StoreAdminSubmitTitle", "Please complete store sampling");
            curContext.UpdateWorkflowVariable("BuyerApproveTitle", taskTitle + " needs confirm");
            curContext.UpdateWorkflowVariable("StoreManagerApproveTitle", taskTitle + " needs approval");
            curContext.UpdateWorkflowVariable("AreaManagerApproveTitle", taskTitle + " needs approval");
            curContext.UpdateWorkflowVariable("BSSHeadGroupApproveTitle", taskTitle + " needs approval");
            curContext.UpdateWorkflowVariable("BSSTeamTitle", taskTitle + " needs approval");
            curContext.UpdateWorkflowVariable("FinanceGroupConfirmTitle", taskTitle + " needs confirm");

            ISharePointService sps = ServiceFactory.GetSharePointService(true, SPContext.Current.Site.RootWeb);
            SPList stores = sps.GetList("Stores");
            QueryField field = new QueryField("Store Number", false);

            System.Text.StringBuilder strStepAndUsers = new System.Text.StringBuilder();

            SPListItemCollection coll = sps.Query(stores, field.Equal(fields["Store Number"] + ""), 1);
            if (coll.Count > 0)
            {
                //2  、 3
                //curContext.UpdateWorkflowVariable("StoreManager", new SPFieldLookupValue(coll[0]["Manager"] + "").LookupValue);
                //curContext.UpdateWorkflowVariable("AreaManagerApproveUser", new SPFieldLookupValue(coll[0]["AreaManager"]+"").LookupValue);

                strStepAndUsers.AppendFormat("{0}:{1};", WorkFlowStep.StoreSamplingStoreManagerApprove, new SPFieldLookupValue(coll[0]["Manager"] + "").LookupValue);
                strStepAndUsers.AppendFormat("{0}:{1};", WorkFlowStep.StoreSamplingAreaManagerApprove, new SPFieldLookupValue(coll[0]["AreaManager"] + "").LookupValue);
                WorkflowContext.Current.UpdateWorkflowVariable(WorkFlowStep.StoreSamplingStoreManager, GetDelemanNameCollection(new NameCollection(new SPFieldLookupValue(coll[0]["Manager"] + "").LookupValue), Constants.CAModules.StoreSampling));
                WorkflowContext.Current.UpdateWorkflowVariable(WorkFlowStep.StoreSamplingAreaManagerApproveUser, GetDelemanNameCollection(new NameCollection(new SPFieldLookupValue(coll[0]["AreaManager"] + "").LookupValue), Constants.CAModules.StoreSampling));
            }
            else
            {
                return;
            }
            //1
               // curContext.UpdateWorkflowVariable("Buyer", passTo);
            //4
            //curContext.UpdateWorkflowVariable("BSSHeadGroup", "wf_BSSHead");

            NameCollection BBSTeamUser = new NameCollection();
            List<string> lst = WorkFlowUtil.UserListInGroup("wf_NSC");
            BBSTeamUser.AddRange(lst.ToArray());
            //5
               // curContext.UpdateWorkflowVariable("BSSTeamAccount", BBSTeamUser);
            //6
               // curContext.UpdateWorkflowVariable("FinanceGroup", "wf_Finance_SS");

            NameCollection bSSHead = WorkFlowUtil.GetUsersInGroup("wf_BSSHead");
            NameCollection finance_SS = WorkFlowUtil.GetUsersInGroup("wf_Finance_SS");
            strStepAndUsers.AppendFormat("{0}:{1};", WorkFlowStep.StoreSamplingBuyerApprove, passTo);
            strStepAndUsers.AppendFormat("{0}:{1};", WorkFlowStep.StoreSamplingBSSHeadApprove, bSSHead.JoinString(","));
            strStepAndUsers.AppendFormat("{0}:{1};", WorkFlowStep.StoreSamplingBSSTeamApprove, BBSTeamUser.JoinString(","));
            strStepAndUsers.AppendFormat("{0}:{1};", WorkFlowStep.StoreSamplingFinanceConfirm, finance_SS.JoinString(","));
            WorkflowContext.Current.DataFields["WorkFlowStepsAndUsers"] = strStepAndUsers.ToString();

            WorkflowContext.Current.UpdateWorkflowVariable(WorkFlowStep.StoreSamplingBuyer, GetDelemanNameCollection(new NameCollection(passTo), Constants.CAModules.StoreSampling));
            WorkflowContext.Current.UpdateWorkflowVariable(WorkFlowStep.StoreSamplingBSSHeadGroup, GetDelemanNameCollection(bSSHead, Constants.CAModules.StoreSampling));
            WorkflowContext.Current.UpdateWorkflowVariable(WorkFlowStep.StoreSamplingBSSTeamAccount, GetDelemanNameCollection(BBSTeamUser, Constants.CAModules.StoreSampling));
            WorkflowContext.Current.UpdateWorkflowVariable(WorkFlowStep.StoreSamplingFinanceGroup, GetDelemanNameCollection(finance_SS, Constants.CAModules.StoreSampling));
        }
开发者ID:porter1130,项目名称:C-A,代码行数:80,代码来源:NewForm.aspx.cs


注:本文中的NameCollection.JoinString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。