コード例 #1
0
ファイル: NewForm.aspx.cs プロジェクト: porter1130/C-A
        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
            //                                             , this.DataForm.SupplierName
            //                                             , this.DataForm.Applicant.UserAccount);
            string taskTitle = string.Format("{0} {1}'s New Production Unit Creation needs approval"
                                                        , workflowNumber
                                                        , this.DataForm.Applicant.UserAccount);
            context.UpdateWorkflowVariable("CompleteTaskTitle", "Please complete New Production Unit Creation");
            context.UpdateWorkflowVariable("NextApproveTaskTitle", taskTitle);
            #endregion
            #region Set page URL for workflow
            var editURL = "/_Layouts/CA/WorkFlows/NewProductionUnitCreation/EditForm.aspx";
            var approveURL = "/_Layouts/CA/WorkFlows/NewProductionUnitCreation/ApproveForm.aspx";
            context.UpdateWorkflowVariable("CompleteTaskFormURL", editURL);
            context.UpdateWorkflowVariable("NextApproveTaskFormURL", approveURL);
            #endregion
            SendEmail("Submit");
            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
コード例 #2
0
ファイル: NewForm.aspx.cs プロジェクト: porter1130/C-A
        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);
        }
コード例 #3
0
ファイル: NewForm.aspx.cs プロジェクト: porter1130/C-A
        /// <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();
        }
コード例 #4
0
ファイル: NewForm.aspx.cs プロジェクト: porter1130/C-A
        void StartWorkflowButton1_Executing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            StartWorkflowButton btn = sender as StartWorkflowButton;
            if (string.Equals(btn.Text, "Save", StringComparison.CurrentCultureIgnoreCase))
            {
                WorkflowContext.Current.UpdateWorkflowVariable("IsSave", true);
                WorkflowContext.Current.DataFields["Flag"] = "Save";
                WorkflowContext.Current.DataFields["Status"] = "NonSubmit";
            }
            else
            {
                WorkflowContext.Current.UpdateWorkflowVariable("IsSave", false);
                WorkflowContext.Current.DataFields["Flag"] = "Submit";
                WorkflowContext.Current.DataFields["Status"] = "In Progress";
            }
            //string strDepartment = DataForm1.Applicant.Department;
            //string strConstructionHeader = @"ca\ztao";
            //string strConstruction = @"ca\ztao";
            //string strDepartmentHeader = @"ca\ztao";
            //string strStoreOperationTeam = @"ca\ztao";
            //string strCFO = @"ca\ztao";

            //组开始
            string strConstructionHeadAccount = UserProfileUtil.GetDepartmentManager("Construction");
            //List<string> lst = WorkFlowUtil.UserListInGroup("ConstructionHeadGroup");
            NameCollection ConstructionHead = new NameCollection();
            //ConstructionHead.AddRange(lst.ToArray());
            ConstructionHead.Add(strConstructionHeadAccount);
            //ConstructionHead.Add(@"ca\caix");

            NameCollection ConstructionUser = new NameCollection();
            List<string> lst = WorkFlowUtil.UserListInGroup("wf_Construction");
            ConstructionUser.AddRange(lst.ToArray());
            //ConstructionUser.Add(strConstruction);

            string department = string.Empty;
            if (DataForm1.Applicant.Department.Contains(';'))
                department = DataForm1.Applicant.Department.Substring(0, DataForm1.Applicant.Department.IndexOf(';')+1);
            else
                department = DataForm1.Applicant.Department;

            string departmentManager = UserProfileUtil.GetDepartmentManager(department);
            if (string.IsNullOrEmpty(departmentManager))
            {
                //Don
                DisplayMessage("Unable to submit the application. There is no department manager defined. Please contact IT for further help.");
                e.Cancel = true;
                return;
            }
            NameCollection DepartmentHead = new NameCollection();
            //lst = WorkFlowUtil.UserListInGroup("DepartmentHeadGroup");
            //DepartmentHead.AddRange(lst.ToArray());
            //DepartmentHead.Add(strDepartmentHeader);
            DepartmentHead.Add(departmentManager);

            NameCollection StoreOperationTeamUser = new NameCollection();
            try
            {
                //lst = WorkFlowUtil.UserListInGroup("wf_StoreOperationTeam");
                //StoreOperationTeamUser.AddRange(lst.ToArray());
                //SPListItemCollection coll = GetSPColl("Stores", "Cost Center", DataForm1.CostCenter, 1);
                //StoreOperationTeamUser.Add(new SPFieldLookupValue(coll[0]["Owner"] + "").LookupValue);
                string strStoreOperations = UserProfileUtil.GetDepartmentManager("Store Operations");
                StoreOperationTeamUser.Add(strStoreOperations);
            }
            catch { }

            //StoreOperationTeamUser.Add(strStoreOperationTeam);

            NameCollection CFOUser = new NameCollection();
            lst = WorkFlowUtil.UserListInGroup("wf_CFO");
            CFOUser.AddRange(lst.ToArray());
            //CFOUser.Add(strCFO);
            //组结束

            //WorkflowContext.Current.UpdateWorkflowVariable("DepartmentHeadAccount", DepartmentHead);
            //WorkflowContext.Current.UpdateWorkflowVariable("ConstructionAccount", ConstructionUser);
            //WorkflowContext.Current.UpdateWorkflowVariable("ConstructionHeadAccount", ConstructionHead);
            //WorkflowContext.Current.UpdateWorkflowVariable("StoreOperationTeamAccount", StoreOperationTeamUser);
            //WorkflowContext.Current.UpdateWorkflowVariable("CFOAccount", CFOUser);

            //设置工作流步骤及对应原始审批人
            System.Text.StringBuilder strStepAndUsers = new System.Text.StringBuilder();
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.ConstructionPurchasingConstructionHead, DepartmentHead.JoinString(","));
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.ConstructionPurchasingConstruction, ConstructionUser.JoinString(","));
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.ConstructionPurchasingConstructionHeadAgain, ConstructionHead.JoinString(","));
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.ConstructionPurchasingDepartmentHead, DepartmentHead.JoinString(","));
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.ConstructionPurchasingStoreOperationTeam, StoreOperationTeamUser.JoinString(","));
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.ConstructionPurchasingCFO, CFOUser.JoinString(","));
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.ConstructionPurchasingPlacesTheOrder, ConstructionUser.JoinString(","));
            WorkflowContext.Current.DataFields["WorkFlowStepsAndUsers"] = strStepAndUsers.ToString();

            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.ConstructionPurchasingDepartmentHeadAccount, GetDelemanNameCollection(DepartmentHead, Constants.CAModules.ConstructionPurchasingRequest));
            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.ConstructionPurchasingConstructionAccount, GetDelemanNameCollection(ConstructionUser, Constants.CAModules.ConstructionPurchasingRequest));
            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.ConstructionPurchasingConstructionHeadAccount, GetDelemanNameCollection(ConstructionHead, Constants.CAModules.ConstructionPurchasingRequest));
            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.ConstructionPurchasingStoreOperationTeamAccount, GetDelemanNameCollection(StoreOperationTeamUser, Constants.CAModules.ConstructionPurchasingRequest));
            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.ConstructionPurchasingCFOAccount, GetDelemanNameCollection(CFOUser, Constants.CAModules.ConstructionPurchasingRequest));

            WorkflowContext.Current.UpdateWorkflowVariable("isSameUser", Common.IsSameUser(DepartmentHead, StoreOperationTeamUser, CFOUser));
            WorkflowContext.Current.UpdateWorkflowVariable("IsFixedAsset", DataForm1.RequestType == "Capex" ? "FixedAsset" : DataForm1.RequestType);

            //修改TaskTitle
            WorkflowContext.Current.UpdateWorkflowVariable("ConstructionHeadTitle", DataForm1.Applicant.DisplayName + "'s construction purchasing request needs approval");
            WorkflowContext.Current.UpdateWorkflowVariable("ConstructionTitle", DataForm1.Applicant.DisplayName + "'s construction purchasing request needs supplies other information");
            WorkflowContext.Current.UpdateWorkflowVariable("DepartmentHeadTitle", DataForm1.Applicant.DisplayName + "'s construction purchasing request needs approval");
            WorkflowContext.Current.UpdateWorkflowVariable("StoreOperationTeamTitle", DataForm1.Applicant.DisplayName + "'s construction purchasing request needs approval");
            WorkflowContext.Current.UpdateWorkflowVariable("CFOTitle", DataForm1.Applicant.DisplayName + "'s construction purchasing request needs approval");
            WorkflowContext.Current.UpdateWorkflowVariable("UpdateTaskTitle", "Please complete construction purchasing request for " + DataForm1.Applicant.DisplayName);
            WorkflowContext.Current.UpdateWorkflowVariable("PlacesTheOrderTitle", DataForm1.Applicant.DisplayName + "'s construction purchasing request needs places the order");
            WorkflowContext.Current.UpdateWorkflowVariable("OrderHandoverTitle", DataForm1.Applicant.DisplayName + "'s construction purchasing request needs order handover");
            //修改结束

            this.WorkFlowNumber = CreateWorkFlowNumber();
            WorkflowContext.Current.DataFields["WorkFlowNumber"] = this.WorkFlowNumber;
            WorkflowContext.Current.DataFields["ApplyDept"] = DataForm1.Applicant.Department;
            WorkflowContext.Current.DataFields["ApplyDate"] = DataForm1.ApplyDate;
            WorkflowContext.Current.DataFields["ApplyUser"] = this.DataForm1.Applicant.UserAccount;
            WorkflowContext.Current.DataFields["RequestType"] = this.DataForm1.RequestType;
            WorkflowContext.Current.DataFields["BudgetApproved"] = this.DataForm1.BudgetApproved;
            WorkflowContext.Current.DataFields["CurrencyType"] = this.DataForm1.CurrencyType;
            WorkflowContext.Current.DataFields["CostCenter"] = this.DataForm1.CostCenter;
            WorkflowContext.Current.DataFields["BudgetValue"] = this.DataForm1.BudgetValue;
            WorkflowContext.Current.DataFields["ProduceandDeliveryDate"] = this.DataForm1.ProduceandDeliveryDate;

            WorkflowContext.Current.DataFields["Installation"] = this.DataForm1.Installation;
            WorkflowContext.Current.DataFields["Freight"] = this.DataForm1.Freight;
            WorkflowContext.Current.DataFields["Packaging"] = this.DataForm1.Packaging;

            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
コード例 #5
0
ファイル: EditForm.aspx.cs プロジェクト: porter1130/C-A
        /// <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();
        }
コード例 #6
0
ファイル: NewForm.aspx.cs プロジェクト: porter1130/C-A
        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);
        }
コード例 #7
0
ファイル: ApproveForm.aspx.cs プロジェクト: porter1130/C-A
        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);
                        fields["Status"] = CAWorkflowStatus.Completed;
                        SendEmail("Approve");
                        //    this.Page.ClientScript.RegisterStartupScript(typeof(DataEdit), "alert", "<script type=\"text/javascript\">alert('Post success! ');</script>");
                        //}
                        //else
                        //{
                        //    context.UpdateWorkflowVariable("PostSAPResult", false);
                        //    this.Page.ClientScript.RegisterStartupScript(typeof(DataEdit), "alert", "<script type=\"text/javascript\">alert('Post failed! ');</script>");
                        //}
                        if (IsExistSAP(fields["WorkflowNumber"].ToString()))
                        {
                            AddCashAdvanceSAP(fields);
                        }
                    }
                    else
                    {
                        fields["Status"] = CAWorkflowStatus.Rejected;
                        context.UpdateWorkflowVariable("CompleteTaskTitle", "Please resubmit Cash Advance Request");
                        SendEmail("Reject");
                    }
                    AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceApprovers, CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceApproversLoginName);
                    break;
                case "FinaceApprove":
                    if (e.Action.Equals("Reject", StringComparison.CurrentCultureIgnoreCase)
                        && this.DataForm1.CashAdvanceType != "Urgent")
                    {
                        fields["Status"] = CAWorkflowStatus.Rejected;
                        context.UpdateWorkflowVariable("CompleteTaskTitle", "Please resubmit Cash Advance Request");
                        SendEmail("Reject");
                    }
                    else
                    {
                        if (e.Action.Equals("Reject", StringComparison.CurrentCultureIgnoreCase))
                        {
                            fields["CashAdvanceType"] = "Normal";
                        }
                        NameCollection wfFinaceConfirm1 = WorkFlowUtil.GetUsersInGroup("wf_FinanceConfirm");
                        WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceNextApproveTaskUsers, GetDelemanNameCollection(wfFinaceConfirm1, Constants.CAModules.CashAdvanceRequest));
                        fields["Status"] = CAWorkflowStatus.InProgress;
                        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());
                        context.UpdateWorkflowVariable("NextApproveTaskTitle", strNextTaskTitle);
                    }
                    AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceApprovers, CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceApproversLoginName);
                    break;
                case "FinaceConfirm":
                    if (e.Action.Equals("Confirm", StringComparison.CurrentCultureIgnoreCase))
                    {
                        //if (PostCashAdvanceToSAP(fields))
                        //{
                        context.UpdateWorkflowVariable("PostSAPResult", true);
                        fields["Status"] = CAWorkflowStatus.Completed;
                        SendEmail("Approve");
                        //    this.Page.ClientScript.RegisterStartupScript(typeof(DataEdit), "alert", "<script type=\"text/javascript\">alert('Post success! ');</script>");
                        //}
                        //else
                        //{
                        //    context.UpdateWorkflowVariable("PostSAPResult", false);
                        //    this.Page.ClientScript.RegisterStartupScript(typeof(DataEdit), "alert", "<script type=\"text/javascript\">alert('Post failed! ');</script>");
                        //}
                        if (IsExistSAP(fields["WorkflowNumber"].ToString()))
                        {
                            AddCashAdvanceSAP(fields);
                        }
                    }
                    else
                    {
                        fields["Status"] = CAWorkflowStatus.Rejected;
                        context.UpdateWorkflowVariable("CompleteTaskTitle", "Please resubmit Cash Advance Request");
                        SendEmail("Reject");
                    }
                    AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceApprovers, CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceApproversLoginName);
                    break;
                case "CompleteTask":
                    var managerEmp1 = WorkFlowUtil.GetNextApprover(CurrentEmployee);
                    NameCollection manager1 = new NameCollection();
                    manager1.Add(managerEmp1.UserAccount);
                    WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceNextApproveTaskUsers, GetDelemanNameCollection(manager1, Constants.CAModules.CashAdvanceRequest));
                    context.UpdateWorkflowVariable("IsContinue", true);
                    break;
            }
            WorkFlowUtil.UpdateWorkflowPath(context);
        }
コード例 #8
0
ファイル: NewForm.aspx.cs プロジェクト: porter1130/C-A
        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));
        }
コード例 #9
0
ファイル: NewForm.aspx.cs プロジェクト: porter1130/C-A
        void StartWorkflowButton1_Executing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            bool flag = IsCanSubmit();
            if (!flag)
            {
                ScriptManager.RegisterStartupScript(this,this.GetType(),"msg", "alert('You do not belong to Buying .');",true);
                e.Cancel = true;
                return;
            }
            StartWorkflowButton btn = sender as StartWorkflowButton;
            if (string.Equals(btn.Text, "Save", StringComparison.CurrentCultureIgnoreCase))
            {
                WorkflowContext.Current.UpdateWorkflowVariable("IsSave", true);
                WorkflowContext.Current.DataFields["Flag"] = "Save";
                WorkflowContext.Current.DataFields["RequestStatus"] = "NonSubmit";
            }
            else
            {
                WorkflowContext.Current.UpdateWorkflowVariable("IsSave", false);
                WorkflowContext.Current.DataFields["Flag"] = "Submit";
                WorkflowContext.Current.DataFields["RequestStatus"] = "In Progress";
            }
            string strDepartment = DataForm1.Applicant.Department;
            //string strManager = @"ca\ztao";
            //string strDirector = @"ca\ztao";
            //string strHead = @"ca\ztao";
            //string strBBSTeam = @"ca\ztao";
            string strMondial = this.DataForm1.IsMondia;
            //组开始
            //List<string> lst = WorkFlowUtil.UserListInGroup("DivisionManagerGroup");
            string Head = WorkFlowUtil.GetEmployeeApproverInDept(DataForm1.Applicant, true, true).UserAccount;
            NameCollection ManagerUser = new NameCollection();
            NameCollection DirectorUser = new NameCollection();
            bool isHeadOne = false;
            bool isHeadTwo = false;
            if (!string.IsNullOrEmpty(Head))
            {
                isHeadOne = true;
                ManagerUser.Add(Head);
                Employee employee = WorkFlowUtil.GetEmployeeApproverInDept(WorkFlowUtil.GetEmployeeApproverInDept(DataForm1.Applicant, true, true), true, false);
                if (employee != null)
                {
                    string strhead = employee.UserAccount;
                    if (!string.IsNullOrEmpty(strhead))
                    {
                        isHeadTwo = true;
                        DirectorUser.Add(strhead);
                    }
                }
            }

            //lst = WorkFlowUtil.UserListInGroup("BuyingDirectorGroup");
            //DirectorUser.AddRange(lst.ToArray());
            //DirectorUser.Add(strDirector);
            NameCollection HeadUser = new NameCollection();
            List<string> lst = WorkFlowUtil.UserListInGroup("wf_CommercialHead");
            HeadUser.AddRange(lst.ToArray());
            //HeadUser.Add(strHeader);
            NameCollection BBSTeamUser = new NameCollection();
            lst = WorkFlowUtil.UserListInGroup("wf_BSSTeam");
            BBSTeamUser.AddRange(lst.ToArray());
            //BBSTeamUser.Add(strBBSTeam);
            //组结束

            //WorkflowContext.Current.UpdateWorkflowVariable("Manager", ManagerUser);
            //WorkflowContext.Current.UpdateWorkflowVariable("BuyDirector", DirectorUser);
            //WorkflowContext.Current.UpdateWorkflowVariable("Header", HeadUser);
            //WorkflowContext.Current.UpdateWorkflowVariable("BBSTeamAccount", BBSTeamUser);

            //设置工作流步骤及对应原始审批人
            System.Text.StringBuilder strStepAndUsers = new System.Text.StringBuilder();
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierCreationDivisionManagerApprove, ManagerUser.JoinString(","));
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierCreationBuyingDirector, DirectorUser.JoinString(","));
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierCreationCommercialHeader, HeadUser.JoinString(","));
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierCreationBSSTeam, BBSTeamUser.JoinString(","));
            WorkflowContext.Current.DataFields["WorkFlowStepsAndUsers"] = strStepAndUsers.ToString();
            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierCreationManager, GetDelemanNameCollection(ManagerUser, Constants.CAModules.NewSupplierCreation));
            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierCreationBuyDirector, GetDelemanNameCollection(DirectorUser, Constants.CAModules.NewSupplierCreation));
            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierCreationHeader, GetDelemanNameCollection(HeadUser, Constants.CAModules.NewSupplierCreation));
            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierCreationBBSTeamAccount, GetDelemanNameCollection(BBSTeamUser, Constants.CAModules.NewSupplierCreation));

            WorkflowContext.Current.UpdateWorkflowVariable("Mondial", strMondial);
            WorkflowContext.Current.UpdateWorkflowVariable("isHeadOne", isHeadOne);
            WorkflowContext.Current.UpdateWorkflowVariable("isHeadTwo", isHeadTwo);

            //修改TaskTitle
            WorkflowContext.Current.UpdateWorkflowVariable("ManagerTitle", DataForm1.Applicant.DisplayName + "'s New Trade Supplier Creation request needs approval");
            WorkflowContext.Current.UpdateWorkflowVariable("DirectorTitle", DataForm1.Applicant.DisplayName + "'s New Trade Supplier Creation request needs approval");
            WorkflowContext.Current.UpdateWorkflowVariable("HeaderTitle", DataForm1.Applicant.DisplayName + "'s New Trade Supplier Creation request needs approval");
            WorkflowContext.Current.UpdateWorkflowVariable("BBSTeamTitle", DataForm1.Applicant.DisplayName + "'s New Trade Supplier Creation request needs confirm");
            WorkflowContext.Current.UpdateWorkflowVariable("TaskUpdateTitle", "Please complete New Trade Supplier Creation request for " + DataForm1.Applicant.DisplayName);
            //修改结束

            this.WorkFlowNumber = CreateWorkFlowNumber();
            WorkflowContext.Current.DataFields["WorkFlowNumber"] = this.WorkFlowNumber;
            WorkflowContext.Current.DataFields["UserName"] = DataForm1.Applicant.UserAccount;
            WorkflowContext.Current.DataFields["Supplier"] = DataForm1.Supplier;
            WorkflowContext.Current.DataFields["SubDivision"] = DataForm1.SubDivision;
            WorkflowContext.Current.DataFields["IsMondial"] = DataForm1.IsMondia;
            //WorkflowContext.Current.DataFields["Upload"] = DataForm1.UploadFile;
            WorkflowContext.Current.DataFields["Status"] = DataForm1.Status;

            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
コード例 #10
0
ファイル: NewForm.aspx.cs プロジェクト: porter1130/C-A
        /// <summary>
        /// 更新工作流相关list中字段数据
        /// </summary>
        /// <param name="dpTaskUsers">部门领导</param>
        /// <param name="isSave">是否为保存数据状态</param>
        private void UpdateWorkFlowDataFields(NameCollection dpTaskUsers, bool isSave)
        {
            double lastValue = DataForm1.GetLastValue(WorkflowContext.Current.DataFields["Order Number"].ToString());
            WorkflowContext.Current.DataFields["Last Value"] = lastValue;
            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["Department"] = CurrentEmployee.Department;
            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();
        }
コード例 #11
0
ファイル: NewForm.aspx.cs プロジェクト: porter1130/C-A
        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);
            }
            else
            {
                WorkflowContext.Current.UpdateWorkflowVariable("IsSave", false);

                string msg = DataForm1.validateGeneralInfo();
                if (!string.IsNullOrEmpty(msg))
                {
                    DisplayMessage(msg);
                    e.Cancel = true;
                    return;
                }
                WorkflowContext.Current.DataFields["Status"] = "In Progress";
            }

            //long Intamount = Convert.ToInt64(this.DataForm1.amount);

            float amount = string.IsNullOrEmpty(DataForm1.amount) ? 0 : Convert.ToSingle(DataForm1.amount);

            //string deptHead = WorkFlowUtil.GetEmployeeApprover(DataForm1.Applicant).UserAccount;
            //WorkflowContext.Current.UpdateWorkflowVariable("DepartmentHead", deptHead);

            string strDeptNamemanger = "Construction";
            string strDeptNamemangerName = UserProfileUtil.GetDepartmentManager(strDeptNamemanger);
            //1
            //WorkflowContext.Current.UpdateWorkflowVariable("DepartmentHead", strDeptNamemangerName);

            string CFOName = WorkFlowUtil.GetUserInGroup("wf_CFO");
            //2
            //WorkflowContext.Current.UpdateWorkflowVariable("CFOApprovalUser", CFOName);

            //WorkflowContext.Current.UpdateWorkflowVariable("Amount", Intamount);
            WorkflowContext.Current.UpdateWorkflowVariable("Amount", amount);

            string CEOName = WorkFlowUtil.GetUserInGroup("wf_CEO");
            //3
            //WorkflowContext.Current.UpdateWorkflowVariable("CEOApprovalUser", CEOName);

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

            System.Text.StringBuilder strStepAndUsers = new System.Text.StringBuilder();
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.StoreBudgetConstructionHeadApproval, strDeptNamemangerName);
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.StoreBudgetCFOApproval, CFOName);
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.StoreBudgetCEOApproval, CEOName);
            strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.StoreBudgetFinanceTask, GroupUsers.JoinString(","));
            WorkflowContext.Current.DataFields["WorkFlowStepsAndUsers"] = strStepAndUsers.ToString();

            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.StoreBudgetDepartmentHead, GetDelemanNameCollection(new NameCollection(strDeptNamemangerName), Constants.CAModules.NewStoreBudgetApplication));
            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.StoreBudgetCFOApprovalUser, GetDelemanNameCollection(new NameCollection(CFOName), Constants.CAModules.NewStoreBudgetApplication));
            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.StoreBudgetCEOApprovalUser, GetDelemanNameCollection(new NameCollection(CEOName), Constants.CAModules.NewStoreBudgetApplication));
            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.StoreBudgetFinanceTaskUsers, GetDelemanNameCollection(GroupUsers, Constants.CAModules.NewStoreBudgetApplication));

            WorkflowContext.Current.UpdateWorkflowVariable("DepartmentHeadTaskTitle", DataForm1.Applicant.DisplayName + "'s New Store Construction Budget request needs approval");
            WorkflowContext.Current.UpdateWorkflowVariable("CFOApprovalTaskTitle", DataForm1.Applicant.DisplayName + "'s New Store Construction Budget request needs approval");
            WorkflowContext.Current.UpdateWorkflowVariable("CEOApprovalTaskTitle", DataForm1.Applicant.DisplayName + "'s New Store Construction Budget request needs approval");
            WorkflowContext.Current.UpdateWorkflowVariable("FinanceUserTaskTitle", "Please complete New Store Construction Budget 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);
        }
コード例 #12
0
ファイル: NewForm.aspx.cs プロジェクト: porter1130/C-A
        void StartWorkflowButton1_Executing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            StartWorkflowButton btn = sender as StartWorkflowButton;
            if (string.Equals(btn.Text, "Save", StringComparison.CurrentCultureIgnoreCase))
            {
                WorkflowContext.Current.UpdateWorkflowVariable("IsSave", true);
                WorkflowContext.Current.DataFields["Flag"] = "Save";
                WorkflowContext.Current.DataFields["Status"] = "NonSubmit";
            }
            else
            {
                string msg = DataForm1.Validate;
                if (!string.IsNullOrEmpty(msg))
                {
                    DisplayMessage(msg);
                    e.Cancel = true;
                    return;
                }
                WorkflowContext.Current.UpdateWorkflowVariable("IsSave", false);
                WorkflowContext.Current.DataFields["Flag"] = "Submit";
                WorkflowContext.Current.DataFields["Status"] = "In Progress";

                //string strDepartment = DataForm1.Applicant.Department;
                //string strManager = @"ca\ztao";
                //string strDirector = @"ca\ztao";
                //string strHeader = @"ca\ztao";
                //string strBBSTeam = @"ca\ztao";

                //组开始
                List<string> lst = WorkFlowUtil.UserListInGroup("wf_IT");
                if (lst.Count == 0)
                {
                    //Don
                    DisplayMessage("Unable to submit the application. There is no user in wf_IT group. Please contact IT for further help.");
                    e.Cancel = true;
                    return;
                }
                NameCollection ItMemberUser = new NameCollection();
                ItMemberUser.AddRange(lst.ToArray());
                //ItMemberUser.Add(strManager);

                //string department = string.Empty;
                //if (DataForm1.Department.Contains(';'))
                //    department = DataForm1.Department.Substring(0, DataForm1.Department.IndexOf(';') + 1);
                //else
                //    department = DataForm1.Department;

                Employee approver = WorkFlowUtil.GetEmployeeApprover(DataForm1.Applicant);
                if (approver == null)
                {
                    //Don
                    DisplayMessage("Unable to find an approver for the applicant. Please contact IT for further help.");
                    e.Cancel = true;
                    return;
                }

                NameCollection DepartHeadUser = new NameCollection();
                //lst = WorkFlowUtil.UserListInGroup("DepartmentHeadGroup");
                //DepartHeadUser.AddRange(lst.ToArray());
                DepartHeadUser.Add(approver.UserAccount);
                NameCollection ITHeadUser = new NameCollection();
                string strHRHeadAccount = UserProfileUtil.GetDepartmentManager("it");
                //lst = WorkFlowUtil.UserListInGroup("ITHead");
                //ITHeadUser.AddRange(lst.ToArray());
                ITHeadUser.Add(strHRHeadAccount);
                NameCollection CFOUser = new NameCollection();
                lst = WorkFlowUtil.UserListInGroup("wf_CFO");
                CFOUser.AddRange(lst.ToArray());
                //FOCOUser.Add(strBBSTeam);
                //组结束

                //WorkflowContext.Current.UpdateWorkflowVariable("ITMemberAccounts", ItMemberUser);
                //WorkflowContext.Current.UpdateWorkflowVariable("DepartHeaderAccounts", DepartHeadUser);
                //WorkflowContext.Current.UpdateWorkflowVariable("ITHeaderAccounts", ITHeadUser);
                //WorkflowContext.Current.UpdateWorkflowVariable("FOCOAccounts", CFOUser);

                System.Text.StringBuilder strStepAndUsers = new System.Text.StringBuilder();
                strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.ITRequestITMember, ItMemberUser.JoinString(","));
                strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.ITRequestDepartmentHeader, DepartHeadUser.JoinString(","));
                strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.ITRequestITHeader, ITHeadUser.JoinString(","));
                strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.ITRequestFOCO, CFOUser.JoinString(","));
                WorkflowContext.Current.DataFields["WorkFlowStepsAndUsers"] = strStepAndUsers.ToString();

                WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.ITRequestITMemberAccounts, GetDelemanNameCollection(ItMemberUser, Constants.CAModules.ItRequest));
                WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.ITRequestDepartHeaderAccounts, GetDelemanNameCollection(DepartHeadUser, Constants.CAModules.ItRequest));
                WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.ITRequestITHeaderAccounts, GetDelemanNameCollection(ITHeadUser, Constants.CAModules.ItRequest));
                WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.ITRequestFOCOAccounts, GetDelemanNameCollection(CFOUser, Constants.CAModules.ItRequest));

                WorkflowContext.Current.UpdateWorkflowVariable("IsFOCO", false);
            }

            //修改TaskTitle
            WorkflowContext.Current.UpdateWorkflowVariable("ITMemberTitle", DataForm1.Applicant.DisplayName + "'s IT request needs confirm");
            WorkflowContext.Current.UpdateWorkflowVariable("DepartmentHeaderTitle", DataForm1.Applicant.DisplayName + "'s IT request needs approval");
            WorkflowContext.Current.UpdateWorkflowVariable("ITHeaderTitle", DataForm1.Applicant.DisplayName + "'s IT request needs approval");
            WorkflowContext.Current.UpdateWorkflowVariable("FOCOTitle", DataForm1.Applicant.DisplayName + "'s IT request needs approval");
            WorkflowContext.Current.UpdateWorkflowVariable("UpdateTaskTitle", "Please complete IT request for " + DataForm1.Applicant.DisplayName);
            //修改结束

            this.WorkFlowNumber = CreateWorkFlowNumber();
            WorkflowContext.Current.DataFields["WorkFlowNumber"] = this.WorkFlowNumber;
            WorkflowContext.Current.DataFields["Name"] = DataForm1.Name;
            WorkflowContext.Current.DataFields["Department"] = DataForm1.Department;
            WorkflowContext.Current.DataFields["FOCOApprove"] = DataForm1.IsFOCO;
            WorkflowContext.Current.DataFields["ApplyDate"] = DataForm1.ApplyDate;
            WorkflowContext.Current.DataFields["AppliedUser"] = this.DataForm1.Applicant.UserAccount;
            WorkflowContext.Current.DataFields["ReasonforRequest"] = this.DataForm1.ReasonforRequest;

            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }