Beispiel #1
0
        void Actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            if (!DataEdit1.CheckDate())
            {
                e.Cancel = true;
                return;
            }

            WorkflowDataFields fields = WorkflowContext.Current.DataFields;
            string sWorkflowNo = fields["Title"].ToString();
            bool bIsReSubmit = false;
            if (e.Action.Equals("Submit"))
            {
                bIsReSubmit = true;
            }
            bool bIsSuccess = SetWorkflowBaseVariable(bIsReSubmit, sWorkflowNo);
            if (bIsSuccess)
            {
                SetListValue(sWorkflowNo);
            }
            else
            {
                e.Cancel = true;
                return;
            }
            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
Beispiel #2
0
        void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            if (e.Action.Equals("End", StringComparison.CurrentCultureIgnoreCase))
            {
                WorkflowContext.Current.DataFields["Status"] = "Cancelled";
                return;
            }
            string msg = DataForm1.Validate();
            if (!string.IsNullOrEmpty(msg))
            {
                DisplayMessage(msg);
                e.Cancel = true;
                return;
            }

            NameCollection buyingUsers = new NameCollection();
            buyingUsers.Add(DataForm1.BuyingUser);
               // WorkflowContext.Current.UpdateWorkflowVariable("BuyingApproveUsers", buyingUsers);
            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierReticketingBuyingApproveUsers, GetDelemanNameCollection(buyingUsers, Constants.CAModules.SupplierReTicketingCharge));

            WorkflowContext.Current.DataFields["BuyingUser"] = DataForm1.BuyingUser;
            WorkflowContext.Current.DataFields["FileName"] = DataForm1.Submit(); ;
            if (!string.IsNullOrEmpty(ctfComments.Value.ToString()))
            {
                WorkflowContext.Current.DataFields["Comments"] = string.Empty;
            }

            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
Beispiel #3
0
        void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            SPFieldUserValueCollection col = WorkFlowUtil.GetApproversValue();
            WorkflowContext.Current.DataFields["Approvers"] = col;

            WorkflowContext curContext = WorkflowContext.Current;
            if (curContext.Task.Step == "ReceptionistTask")
            {
                //两次confirm为同一个人
                if (SPContext.Current.ListItem["IsTheSame"]+""=="yes")
                {
                    //流程走完形成报表
                    GenerateReport();
                }
                //两次confirm为不同的人
                else if (string.IsNullOrEmpty(SPContext.Current.ListItem["TimesConfirm"] + ""))
                {
                    WorkflowContext.Current.DataFields["TimesConfirm"] = "SecondComfirm";
                }
                else if (SPContext.Current.ListItem["TimesConfirm"] + "" == "SecondComfirm")
                {
                    GenerateReport();
                }
            }
        }
        void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            if (e.Action.Equals("End", StringComparison.CurrentCultureIgnoreCase))
            {
                WorkflowContext.Current.DataFields["Status"] = "Cancelled";
                return;
            }
            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["Status"] = DataForm1.Status;

            WorkflowContext.Current.DataFields["Flag"] = "Submit";

            WorkflowContext.Current.DataFields["RequestStatus"] = "In Progress";
            string Head = WorkFlowUtil.GetEmployeeApproverInDept(DataForm1.Applicant, true, true).UserAccount;
            QuickFlow.NameCollection ManagerUser = new QuickFlow.NameCollection();
            if (!string.IsNullOrEmpty(Head))
            {
                ManagerUser.Add(Head);
                WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierCreationManager, GetDelemanNameCollection(ManagerUser, CAModules.NewSupplierCreation));
            }

            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
Beispiel #5
0
        void Actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            WorkflowDataFields fields = WorkflowContext.Current.DataFields;
            if (e.Action.Equals("Approve"))//Approve
            {
                if (WorkflowContext.Current.Step == "BD" || fields["IsSkipBD"].ToString() == "True")
                {
                    bool isAllSuccess = DataView1.UpdateToSAP();
                    if (isAllSuccess)
                    {
                        WorkflowContext context = WorkflowContext.Current;
                        context.UpdateWorkflowVariable("OSPActions", OSPCommon.End);

                        CompleteWorkflow();
                        SendNoticeMail("Approved");
                    }
                    else
                    {
                        e.Cancel = true;
                        return;
                    }
                }
            }
            else
            {
                CompleteWorkflow();
                SendNoticeMail("Rejected");
            }
            fields["Approvers"] = CurrentEmployee.DisplayName + "(" + CurrentEmployee.UserAccount + ")";
            SPUser ApplicantSPUser = SPContext.Current.Web.EnsureUser(CurrentEmployee.UserAccount);
            fields["ApproversSPUser"] = ApplicantSPUser;
        }
Beispiel #6
0
        void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            if (e.Action.Equals("End", StringComparison.CurrentCultureIgnoreCase))
            {
                WorkflowContext.Current.DataFields["Status"] = "Cancelled";
                return;
            }
            string msg = DataForm1.validateGeneralInfo();
            if (!string.IsNullOrEmpty(msg))
            {
                DisplayMessage(msg);
                e.Cancel = true;
                return;
            }
            WorkflowContext.Current.DataFields["FileName"] = DataForm1.Submit();
            if (!string.IsNullOrEmpty(ctfComments.Value.ToString()))
            {
                    WorkflowContext.Current.DataFields["Comments"] = string.Empty;
            }
            string strDeptNamemanger = "Construction";
            string strDeptNamemangerName = UserProfileUtil.GetDepartmentManager(strDeptNamemanger);
            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.StoreBudgetDepartmentHead, GetDelemanNameCollection(new QuickFlow.NameCollection(strDeptNamemangerName), Constants.CAModules.NewStoreBudgetApplication));

            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
Beispiel #7
0
        void Actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            if (e.Action.Equals("Reject"))
            {
                CompleteWorkflow(CAWorkflowStatus.Rejected);
                //SendNoticeMail(CAWorkflowStatus.Rejected);
                return;
            }

            if (WorkflowContext.Current.Step == "DMMApprove")
            {
                DataView1.UpdateItemApproveStatus();
                CompleteWorkflow(CAWorkflowStatus.InProgress);
            }
            else//BDApprove 最后一步审批
            {
                bool isAllSuccess = DataView1.UpdateToSAP();
                if (isAllSuccess)
                {
                    CompleteWorkflow( CAWorkflowStatus.Completed);
                    //SendNoticeMail("Approved");
                }
                else
                {
                    e.Cancel = true;
                    return;
                }
            }
            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
Beispiel #8
0
 void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
 {
     if (WorkflowContext.Current.Step.ToString() == "BSSTeam")
     {
         string strStatus = DataForm1.Status.ToString();
         if (strStatus != "Factory Assessment Failed" && strStatus != "Contract Signed & System Setup OK")
         {
             e.Cancel = true;
             Page.RegisterStartupScript("msg", "<script>alert('Can not confirm with selected status!')</script>");
             ((HtmlTableRow)DataForm1.FindControl("trShow")).Style.Add("display", "");
             ((HtmlTableRow)DataForm1.FindControl("updateList")).Style.Add("display", "");
             return;
         }
         else
         {
             SPListItem item = SPContext.Current.ListItem;
             WorkflowContext.Current.DataFields["StatusList"] = item["StatusList"] + "<br>" + DataForm1.Status.ToString() + "     " + DateTime.Now.ToString("yyyy-MM-dd");
         }
     }
     WorkflowContext.Current.DataFields["Flag"] = "Approve";
     if (WorkflowContext.Current.Step == "BSSTeam" && e.Action == "Confirm")
     {
         WorkflowContext.Current.DataFields["RequestStatus"] = "Completed";
     }
     else
     {
         WorkflowContext.Current.DataFields["RequestStatus"] = "In Progress";
     }
     SPFieldUserValueCollection col = WorkFlowUtil.GetApproversValue();
     WorkflowContext.Current.DataFields["Approvers"] = col;
 }
Beispiel #9
0
        void Actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            if (e.Action.Equals("Approve"))//审批通过
            {
                WorkflowDataFields fields = WorkflowContext.Current.DataFields;
                decimal TotalCost = GetTotalCost();
                if (TotalCost == 0)
                {
                    DisplayMessage("Rate or Cost error!");
                    e.Cancel = true;
                    return;
                }

                string levelType = "Contract Approval Limits";
                string sCurrentManager = CurrentEmployee.UserAccount;
                var quota = WorkFlowUtil.GetQuota(CurrentEmployee.UserAccount, levelType);///得到当前审批人的审批金额

                WorkflowContext context = WorkflowContext.Current;
                if (TotalCost > quota)///当前审批者不够审批此金额。
                {
                    context.UpdateWorkflowVariable("IsApproveAgin", true);//

                    NameCollection manager = new NameCollection();
                    Employee managerEmp = WorkFlowUtil.GetNextApprover(sCurrentManager);
                    if (managerEmp == null && !WorkflowPerson.IsCEO(sCurrentManager))
                    {
                        DisplayMessage("The manager is not set in the system.");
                        e.Cancel = true;
                        return;
                    }
                    manager.Add(managerEmp.UserAccount);

                    string sDelePerson = WorkFlowUtil.GetDeleman(managerEmp.UserAccount, WorkFlowUtil.GetModuleIdByListName("PurchaseRequestGeneral")); //查找代理人
                    if (sDelePerson != null)
                    {
                        manager.Add(sDelePerson);
                    }
                    context.UpdateWorkflowVariable("ApproveUsers", manager);
                }
                else//进入到财务审批
                {
                    context.UpdateWorkflowVariable("IsApproveAgin", false);//
                }

                fields["Approvers"] = ReturnAllApprovers(sCurrentManager);
                fields["ApproversSPUser"] = ReturnAllApproversSP("ApproversSPUser", sCurrentManager);
            }
            else
            {
                WorkflowContext context = WorkflowContext.Current;
                WorkflowDataFields fields = WorkflowContext.Current.DataFields;
                string sWorkflowNo = fields["Title"].ToString();
                context.UpdateWorkflowVariable("EditTitle", "Please resubmit Purchase Ruequest-General:" + sWorkflowNo);//
            }
            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
Beispiel #10
0
        void btnSave_Click(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            //SaveForm();
            string strNews = this.formFieldBody.Value+"";

            SPListItem item = SPContext.Current.List.GetItemById(SPContext.Current.ListItem.ID);
            item["Title"] = this.txtTitle.Text.Trim();
            //item["Body"] = this.FCKeditor1.Value.Trim();

            var fileName = "";

            //added by wsq 2010-07-15
            if (this.FileUpload1.HasFile)
            {
                fileName = this.FileUpload1.FileName.ToLower();
                var fileBytes = this.FileUpload1.FileBytes;

                if (fileName.EndsWith(".doc") || fileName.EndsWith(".docx"))
                {
                    string tmppath = "/tmpfiles/" + item.ParentList.ID+"-"+ item.RecurrenceID + "/";
                    string mappath = Server.MapPath(tmppath);

                    Directory.CreateDirectory(mappath);
                    try
                    {
                        using (FileStream nFile = new FileStream(mappath + fileName, FileMode.Create))
                        {
                            nFile.Seek(0, SeekOrigin.Begin);
                            nFile.Write(fileBytes, 0, fileBytes.Length);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }

                    Util.WordToHtml(mappath, fileName, tmppath + fileName);
                }
                else if (!fileName.EndsWith(".pdf"))
                {
                    base.Script.Alert("only word or pdf file can be uploaded.");

                    e.Cancel = true;
                    return;
                }

                item.Attachments.Add(fileName, fileBytes);
                item.Web.AllowUnsafeUpdates = true;
                item.Update();
            }

            GoRedirect();
        }
Beispiel #11
0
        void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            //SPFieldUserValueCollection col = WorkFlowUtil.GetApproversValue();
            //WorkflowContext.Current.DataFields["Approvers"] = col;
            AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, WorkFlowStep.SupplierReinspectionApprovers, WorkFlowStep.SupplierReinspectionApproverLoginName);

            List<string> strGroupUser = WorkFlowUtil.UserListInGroup("wf_Finance_SR");
            QuickFlow.NameCollection GroupUsers = new QuickFlow.NameCollection();
            GroupUsers.AddRange(strGroupUser.ToArray());
            WorkflowContext.Current.UpdateWorkflowVariable(WorkFlowStep.SupplierReinspectionFinanceTaskUsers, GetDelemanNameCollection(GroupUsers, Constants.CAModules.SupplierReInspectionCharge));

            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
Beispiel #12
0
        void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            SPFieldUserValueCollection col = WorkFlowUtil.GetApproversValue();
            WorkflowContext.Current.DataFields["Approvers"] = col;

            if (WorkflowContext.Current.Task.Step == "FinanceTask")
            {
                WorkflowContext.Current.DataFields["Status"] = "Completed";
            }
            else
            {
                WorkflowContext.Current.DataFields["Status"] = "In Progress";
            }
        }
Beispiel #13
0
        void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            WorkflowContext curContext = WorkflowContext.Current;
            WorkflowDataFields fields = curContext.DataFields;

            SPWeb web = SPContext.Current.Web;
            SPUser curuser = web.CurrentUser;

            var now = DateTime.Now;

            switch (WorkflowContext.Current.Task.Step)
            {
                case "ManagementTask":
                    if (e.Action == "Approve")
                    {
                        fields["ManagementStatus"] = "approved";
                        fields["HrStatus"] = "pending";
                    }
                    else if (e.Action == "Reject")
                    {
                        fields["ManagementStatus"] = "rejected";
                        fields["FlowStatus"] = "completed";
                    }

                    fields["ManagementActedBy"] = curuser.LoginName;
                    fields["ManagementActedAt"] = now;
                    break;
                case "HrTask":
                    if (e.Action == "Confirm")
                    {
                        fields["HrStatus"] = "confirmed";
                        fields["ItStatus"] = "pending";
                    }

                    fields["HrActedBy"] = curuser.LoginName;
                    fields["HrActedAt"] = now;
                    break;
                case "ItTask":
                    if (e.Action == "Confirm")
                    {
                        fields["ItStatus"] = "confirmed";
                        fields["FlowStatus"] = "completed";
                    }

                    fields["ItActedBy"] = curuser.LoginName;
                    fields["ItActedAt"] = now;
                    break;

            }
        }
Beispiel #14
0
 void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
 {
     if (e.Action.Equals("End", StringComparison.CurrentCultureIgnoreCase))
     {
         WorkflowContext.Current.DataFields["Status"] = "Cancelled";
         return;
     }
     string msg = DataForm1.Validate();
     if (!string.IsNullOrEmpty(msg))
     {
         DisplayMessage(msg);
         e.Cancel = true;
         return;
     }
     WorkflowContext.Current.DataFields["FileName"] = DataForm1.Submit();
     WorkflowContext.Current.DataFields["Status"] = "In Progress";
 }
        void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            if (e.Action.Equals("End", StringComparison.CurrentCultureIgnoreCase))
            {
                WorkflowContext.Current.DataFields["Status"] = "Cancelled";
                return;
            }
            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["Status"] = DataForm1.Status;

            WorkflowContext.Current.DataFields["Flag"] = "Submit";

            WorkflowContext.Current.DataFields["RequestStatus"] = "In Progress";
        }
Beispiel #16
0
        void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            string msg = DataForm1.Validate();
            if (!string.IsNullOrEmpty(msg))
            {
                DisplayMessage(msg);
                e.Cancel = true;
                return;
            }
            if (!string.IsNullOrEmpty(ctfComments.Value.ToString()))
            {
                WorkflowContext.Current.DataFields["Comments"] = string.Empty;
            }
            WorkflowContext.Current.DataFields["Status"] = "Completed";

            SPFieldUserValueCollection col = WorkFlowUtil.GetApproversValue();
            WorkflowContext.Current.DataFields["Approvers"] = col;
        }
Beispiel #17
0
        void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            string msg = DataForm1.validatePODetailsUpdate();
            if (!string.IsNullOrEmpty(msg))
            {
                DisplayMessage(msg);
                e.Cancel = true;
                return;
            }
            if (!string.IsNullOrEmpty(ctfComments.Value.ToString()))
            {
                WorkflowContext.Current.DataFields["Comments"] = string.Empty;
            }
            WorkflowContext.Current.DataFields["Status"] = "Completed";

            //SPFieldUserValueCollection col = WorkFlowUtil.GetApproversValue();
            //WorkflowContext.Current.DataFields["Approvers"] = col;
            AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, WorkFlowStep.SupplierReticketingApprovers, WorkFlowStep.SupplierReticketingApproverLoginName);
        }
Beispiel #18
0
        void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            if (e.Action.Equals("End", StringComparison.CurrentCultureIgnoreCase))
            {
                WorkflowContext.Current.DataFields["Status"] = "Cancelled";
                return;
            }
            string msg = DataForm1.Validate();
            if (!string.IsNullOrEmpty(msg))
            {
                DisplayMessage(msg);
                e.Cancel = true;
                return;
            }
            WorkflowContext.Current.DataFields["FileName"] = DataForm1.Submit();
            WorkflowContext.Current.DataFields["Status"] = "In Progress";
            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierReinspectionDepartmentHead, GetDelemanNameCollection(new QuickFlow.NameCollection(WorkFlowUtil.GetUserInGroup("wf_BSSHead")), Constants.CAModules.SupplierReInspectionCharge));

            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
Beispiel #19
0
        void Actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            WorkflowDataFields fields = WorkflowContext.Current.DataFields;
            if (!e.Action.Equals("Approve"))//审批拒绝
            {
                WorkflowContext context = WorkflowContext.Current;
                SendNoticeMail("Rejected");
                fields["Status"] = CAWorkflowStatus.Completed;
            }
            else if (WorkflowContext.Current.Step == "BD" || (WorkflowContext.Current.Step == "DMM"&&fields["IsSkipBD"].AsString() == "True"))
            {
                SendMMCNoticeMail();
            }
            else if (WorkflowContext.Current.Step == "MMCBBS")
            {
                WorkflowContext context = WorkflowContext.Current;
                NameCollection nc = new NameCollection();
                if (WorkFlowUtil.IsInGroup(CurrentEmployee.UserAccount, "wf_BSS"))
                {
                    // DeleteTask(fields["ID"].AsString(), "wf_BSS");
                    nc = GetApproverInGroup("wf_ACC");
                }
                else if (WorkFlowUtil.IsInGroup(CurrentEmployee.UserAccount, "wf_ACC"))
                {
                    //DeleteTask(fields["ID"].AsString(), "wf_MMC");
                    nc = GetApproverInGroup("wf_BSS");
                }
                context.UpdateWorkflowVariable("EndUsers", nc);
            }
            else if (WorkflowContext.Current.Step == "End")//是最后一步的最后一个人审批。
            {
                WorkflowContext context = WorkflowContext.Current;
                SendNoticeMail("Approved");
                fields["Status"] = CAWorkflowStatus.Completed;
            }

            string sCurrentManager = CurrentEmployee.UserAccount;
            fields["Approvers"] = ReturnAllApprovers(sCurrentManager);
            fields["ApproversSPUser"] = ReturnAllApproversSP("ApproversSPUser", sCurrentManager);
            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
Beispiel #20
0
        void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            //SPFieldUserValueCollection col = WorkFlowUtil.GetApproversValue();
            //WorkflowContext.Current.DataFields["Approvers"] = col;
            //添加审批人
            AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, WorkFlowStep.SupplierReticketingApprovers, WorkFlowStep.SupplierReticketingApproverLoginName);
            switch (WorkflowContext.Current.Task.Step)
            {
                case WorkFlowStep.SupplierReticketingBuyingApprove:
                    WorkflowContext.Current.UpdateWorkflowVariable(WorkFlowStep.SupplierReticketingDepartmentHead, GetDelemanNameCollection(new NameCollection(WorkFlowUtil.GetUserInGroup("wf_BSSHead")), Constants.CAModules.SupplierReTicketingCharge));
                    break;
                case WorkFlowStep.SupplierReticketingDepartmentHeadApproval:
                    List<string> strGroupUser = WorkFlowUtil.UserListInGroup("wf_Finance_SR");
                    NameCollection GroupUsers = new NameCollection();
                    GroupUsers.AddRange(strGroupUser.ToArray());
                    WorkflowContext.Current.UpdateWorkflowVariable(WorkFlowStep.SupplierReticketingFinanceTaskUsers, GetDelemanNameCollection(GroupUsers, Constants.CAModules.SupplierReTicketingCharge));
                    break;
            }

            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
Beispiel #21
0
 void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
 {
     if (e.Action.Equals("End", StringComparison.CurrentCultureIgnoreCase))
     {
         WorkflowContext.Current.DataFields["Status"] = "Cancelled";
         return;
     }
     string msg = DataForm1.Validate();
     if (!string.IsNullOrEmpty(msg))
     {
         DisplayMessage(msg);
         e.Cancel = true;
         return;
     }
     NameCollection buyingUsers = new NameCollection();
     buyingUsers.Add(DataForm1.BuyingUser);
     WorkflowContext.Current.UpdateWorkflowVariable("BuyingApproveUsers", buyingUsers);
     WorkflowContext.Current.DataFields["BuyingUser"] = DataForm1.BuyingUser;
     WorkflowContext.Current.DataFields["FileName"] = DataForm1.Submit();
     WorkflowContext.Current.DataFields["Status"] = "In Progress";
 }
        void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            if (e.Action.Equals("End", StringComparison.CurrentCultureIgnoreCase))
            {
                WorkflowContext.Current.DataFields["Status"] = "Cancelled";

                SPListItem item = SPContext.Current.ListItem;

                ISharePointService sps = ServiceFactory.GetSharePointService(true);
                SPList listBalance = sps.GetList(CAWorkFlowConstants.ListName.LeaveBalance.ToString());
                QueryField field = new QueryField("Employee");
                QueryField field2 = new QueryField("Year");

                int year = DateTime.Parse(item["DateFrom"] + "").Year;

                //根据field来查询
                SPListItemCollection items = sps.Query(listBalance, field.Equal(this.DataForm1.ApplicantName) && field2.Equal(year), 1);

                //审批submit后 在balance表中扣除所请的天数
                SPListItem itemBalance = items[0];

                return;
            }
            bool IsSick = this.DataForm1.IsSickLeave;

            WorkflowContext.Current.UpdateWorkflowVariable("IsSickLeave", IsSick);

            string deptHead = WorkFlowUtil.GetEmployeeApprover(this.CurrentEmployee).UserAccount;
            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.TimeOffDepartmentHeadAccount, GetDelemanNameCollection(new NameCollection(deptHead), Constants.CAModules.LeaveApplication));
            string strNextTaskUrl = @"_Layouts/CA/WorkFlows/TimeOff2/EditForm.aspx";
            string strNextTaskTitle = string.Format("{0}'s leave application needs approval", SPContext.Current.Web.CurrentUser.Name);
            WorkflowContext.Current.UpdateWorkflowVariable("NextTaskUrl", strNextTaskUrl);
            WorkflowContext.Current.UpdateWorkflowVariable("NextTaskTitle", strNextTaskTitle);

            WorkflowContext.Current.DataFields["IsSave"] = 0;
            WorkflowContext.Current.DataFields["EmployeeID"] = this.DataForm1.EmployeeNo;
            WorkflowContext.Current.DataFields["Status"] = "In Progress";

            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
Beispiel #23
0
 void Actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
 {
     if (e.Action.Equals("Submit"))
     {
         bool isSuccess = RunWorkflow(true);
         if (!isSuccess)
         {
             e.Cancel = true;
             return;
         }
     }
     else //save
     {
         bool isSuccess = RunWorkflow(false);
         if (!isSuccess)
         {
             e.Cancel = true;
             return;
         }
     }
     WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
 }
Beispiel #24
0
        void Actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            if (e.Action.Equals("Confirm"))//审批通过
            {
                WorkflowDataFields fields = WorkflowContext.Current.DataFields;
                fields["Status"] = CAWorkflowStatus.Completed;

                string sCurrentManager = CurrentEmployee.UserAccount;
                fields["Approvers"] = ReturnAllApprovers(sCurrentManager);
                fields["ApproversSPUser"] = ReturnAllApproversSP("ApproversSPUser", sCurrentManager);

                SendNoticeMail("Approved");
            }
            else
            {
                WorkflowContext context = WorkflowContext.Current;
                WorkflowDataFields fields = WorkflowContext.Current.DataFields;
                string sWorkflowNo = fields["Title"].ToString();
                context.UpdateWorkflowVariable("EditTitle", "Please resubmit Purchase Ruequest-General:" + sWorkflowNo);//
                SendNoticeMail("Rejected");
            }
        }
Beispiel #25
0
        void Actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            if (e.Action.Equals("Approve"))
            {

                bool isAllSuccess = DataView1.UpdateToSAP();
                if (isAllSuccess)
                {
                    CompleteWorkflow();
                    SendNoticeMail("Approved");
                }
                else
                {
                    e.Cancel = true;
                    return;
                }
            }
            else
            {
                CompleteWorkflow();
                SendNoticeMail("Rejected");
            }
        }
Beispiel #26
0
        void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            //SPFieldUserValueCollection col = WorkFlowUtil.GetApproversValue();
            //WorkflowContext.Current.DataFields["Approvers"] = col;
            AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, CA.WorkFlow.UI.Constants.WorkFlowStep.StoreBudgetApprovers, CA.WorkFlow.UI.Constants.WorkFlowStep.StoreBudgetApproverLoginName);
            if (WorkflowContext.Current.Task.Step == "FinanceTask")
            {
                WorkflowContext.Current.DataFields["Status"] = "Completed";
            }
            else
            {
                WorkflowContext.Current.DataFields["Status"] = "In Progress";
            }
            switch (WorkflowContext.Current.Task.Step)
            {
                case CA.WorkFlow.UI.Constants.WorkFlowStep.StoreBudgetConstructionHeadApproval:
                    string CFOName = WorkFlowUtil.GetUserInGroup("wf_CFO");
                    WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.StoreBudgetCFOApprovalUser, GetDelemanNameCollection(new QuickFlow.NameCollection(CFOName), Constants.CAModules.NewStoreBudgetApplication));
                    break;
                case CA.WorkFlow.UI.Constants.WorkFlowStep.StoreBudgetCFOApproval:
                    string CEOName = WorkFlowUtil.GetUserInGroup("wf_CEO");
                    WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.StoreBudgetCEOApprovalUser, GetDelemanNameCollection(new QuickFlow.NameCollection(CEOName), Constants.CAModules.NewStoreBudgetApplication));
                    List<string> strGroupUser = WorkFlowUtil.UserListInGroup("wf_Finance_BA");
                    QuickFlow.NameCollection GroupUsers = new QuickFlow.NameCollection();
                    GroupUsers.AddRange(strGroupUser.ToArray());
                    WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.StoreBudgetFinanceTaskUsers, GetDelemanNameCollection(GroupUsers, Constants.CAModules.NewStoreBudgetApplication));
                    break;
                case CA.WorkFlow.UI.Constants.WorkFlowStep.StoreBudgetCEOApproval:
                     List<string> strGroupUser1 = WorkFlowUtil.UserListInGroup("wf_Finance_BA");
                    QuickFlow.NameCollection GroupUsers1 = new QuickFlow.NameCollection();
                    GroupUsers1.AddRange(strGroupUser1.ToArray());
                    WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.StoreBudgetFinanceTaskUsers, GetDelemanNameCollection(GroupUsers1, Constants.CAModules.NewStoreBudgetApplication));
                    break;
            }

            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
Beispiel #27
0
        void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
        {
            if (WorkflowContext.ContextInitialized)
            {
                WorkflowContext curContext = WorkflowContext.Current;
                WorkflowDataFields fields = curContext.DataFields;
                fields["Status"] = "In Progress";

                switch (WorkflowContext.Current.Task.Step)
                {
                    case "ITAppManagerGroupSupplies":
                        var crNumber = ((TextBox)DataForm1.FindControl("txtChangeRequestNumber")).Text;
                        if (string.IsNullOrEmpty(crNumber))
                        {
                            base.Script.Alert("please supply a change request number.");
                            e.Cancel = true;
                            return;
                        }

                        fields["ChangeRequestNumber"] = crNumber;
                        PushToReport();
                        fields["Approvers"] = WorkFlowUtil.GetApproversValue();
                        break;
                    case "ITAppManagerSubmit":
                        fields["ChangeRequestNumber"] = ((TextBox)DataForm1.FindControl("txtChangeRequestNumber")).Text;
                        break;
                    case "EmployeeSubmit":
                        if (e.Action.Equals("End", StringComparison.CurrentCultureIgnoreCase))
                        {
                            WorkflowContext.Current.DataFields["Status"] = "Cancelled";
                            return;
                        }
                        if (string.IsNullOrEmpty(((TextBox)DataForm1.FindControl("txtSubject")).Text))
                        {
                            e.Cancel = true;
                            ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('Please supply a Subject .');", true);
                            return;
                        }

                        fields["Priority"] = ((DropDownList)DataForm1.FindControl("ddlPriority")).SelectedValue;
                        fields["Area"] = ((DropDownList)DataForm1.FindControl("ddlArea")).SelectedValue;
                        fields["System"] = ((DropDownList)DataForm1.FindControl("ddlSystem")).SelectedValue;
                        fields["RequirementType"] = ((DropDownList)DataForm1.FindControl("ddlRequirementType")).SelectedItem.Text;
                        fields["Subject"] = ((TextBox)DataForm1.FindControl("txtSubject")).Text;
                        fields["Description"] = ((TextBox)DataForm1.FindControl("txtDescription")).Text;
                        fields["BusinessLogic"] = ((TextBox)DataForm1.FindControl("txtBusinessLogic")).Text;

                        string isNew = "Yes";
                        if (((DropDownList)DataForm1.FindControl("ddlRequirementType")).SelectedValue == "Bug fix")
                        {
                            isNew = "No";
                        }
                        curContext.UpdateWorkflowVariable("IsRequestNew", isNew);
                        break;
                    case "BusinessManagerGroupApprove":
                        fields["Approvers"] = WorkFlowUtil.GetApproversValue();
                        break;
                    case "BusinessManagerGroupApprove2" :
                        if (e.Action == "Approve" && ((DropDownList)DataForm1.FindControl("ddlRequirementType")).SelectedValue == "Bug fix")
                        {
                            fields["Status"] = "Completed";
                        }
                        fields["Approvers"] = WorkFlowUtil.GetApproversValue();
                        break;
                    case "ITHeadApprove" :
                        fields["Approvers"] = WorkFlowUtil.GetApproversValue();
                        break;
                    case "ITHeadApprove2" :

                        if (e.Action == "Approve")
                        {
                            fields["Status"] = "Completed";
                            List<string> mailList = new List<string>();
                            List<SPUser> users = WorkFlowUtil.GetSPUsersInGroup("wf_ITApplicationManager");
                            foreach (SPUser user in users)
                            {
                                mailList.Add(user.Email);
                            }

                            StringDictionary dict = new StringDictionary();
                            dict.Add("to", string.Join(";", mailList.ToArray()));
                            dict.Add("subject", "Workflow Notification");

                            string mcontent = @"An IT change request has been approved. Please view the detail by clicking <a href='"
                                + SPContext.Current.Web.Url + "/_layouts/CA/WorkFlows/ChangeRequest/DisplayForm.aspx?List="
                                + SPContext.Current.ListId.ToString()
                                + "&ID="
                                + SPContext.Current.ListItem.ID
                                + "'>here</a>.";

                            SPUtility.SendEmail(SPContext.Current.Web, dict, mcontent);

                        }
                        fields["Approvers"] = WorkFlowUtil.GetApproversValue();
                        break;

                }
            }
        }
Beispiel #28
0
 /// <summary>
 /// 获得原始审批人和其创建的代理人
 /// </summary>
 /// <param name="approverNameCollection">原始审批人</param>
 /// <param name="modulesId">所属List模块ID</param>
 /// <returns></returns>
 public QuickFlow.NameCollection GetDelemanNameCollection(QuickFlow.NameCollection approverNameCollection, string modulesId)
 {
     QuickFlow.NameCollection delemanNameCollection = new QuickFlow.NameCollection();
     foreach (string approver in approverNameCollection)
     {
         if (approver.IsNotNullOrWhitespace())
         {
             delemanNameCollection.Add(approver);
             //一个模块只有一个代理
             var deleman = WorkFlowUtil.GetDeleman(approver, modulesId);
             if (null != deleman)
             {
                 delemanNameCollection.Add(deleman);
             }
         }
     }
     return delemanNameCollection;
 }
Beispiel #29
0
 private bool Validate(string action, QuickFlow.UI.Controls.ActionEventArgs e)
 {
     bool flag = true;
     if (!this.DataForm1.Validate(action))
     {
         DisplayMessage(this.DataForm1.MSG);
         e.Cancel = true;
         flag = false;
     }
     return flag;
 }
        internal static string SaveListFields(QuickFlow.Core.WorkflowDataFields fields, SPListItem item, List<string> fieldsList)
        {
            string department = fields["Department"].AsString();
            foreach (string s in fieldsList)
            {
                item[s] = fields[s].AsString();
            }

            item["WorkflowNumber"] = "SAP" + WorkFlowUtil.CreateWorkFlowNumber(WorkflowConfigName.TravelExpenseClaimForSAP).ToString("000000");
            item["TCWorkflowNumber"] = fields["WorkflowNumber"].AsString();

            return item["WorkflowNumber"].AsString();
        }