Example #1
0
        void TopicSolved(object sender, ActionEventArgs e)
        {
            uPowers.BusinessLogic.Action a = (uPowers.BusinessLogic.Action)sender;

                if (a.Alias == "TopicSolved") {

                    Comment c = new Comment(e.ItemId);

                    if (c != null) {
                        Topic t = new Topic(c.TopicId);

                        int answer = our.Data.SqlHelper.ExecuteScalar<int>("SELECT answer FROM forumTopics where id = @id", Data.SqlHelper.CreateParameter("@id", t.Id));

                        //if performer and author of the topic is the same... go ahead..

                        if (e.PerformerId == t.MemberId && answer == 0) {

                            //receiver of points is the comment author.
                            e.ReceiverId = c.MemberId;

                            //remove any previous votes by the author on this comment to ensure the solution is saved instead of just the vote
                            a.ClearVotes(e.PerformerId, e.ItemId);

                            //this uses a non-standard coloumn in the forum schema, so this is added manually..
                            our.Data.SqlHelper.ExecuteNonQuery("UPDATE forumTopics SET answer = @answer WHERE id = @id", Data.SqlHelper.CreateParameter("@id", t.Id), Data.SqlHelper.CreateParameter("@answer", c.Id));
                        }

                    }
                }
        }
Example #2
0
        void actions_ActionExecuting(object sender, ActionEventArgs e)
        {
            string strNextTaskUrl = @"_Layouts/CA/WorkFlows/ChoppingApplication/ApproveForm.aspx";
            string strNextTaskTitle = string.Format("{0}'s chopping application needs approval", new SPFieldLookupValue(SPContext.Current.ListItem["Created By"] + "").LookupValue);

            if (string.Equals(e.Action, "Reject", StringComparison.CurrentCultureIgnoreCase))
            {
                strNextTaskUrl = @"_Layouts/CA/WorkFlows/ChoppingApplication/ApplicantEditForm.aspx";
                strNextTaskTitle = "Please modify your chopping application";
            }

            WorkflowContext.Current.UpdateWorkflowVariable("NextTaskUrl", strNextTaskUrl);
            WorkflowContext.Current.UpdateWorkflowVariable("NextTaskTitle", strNextTaskTitle);

            if ((WorkflowContext.Current.Task.Step == DataForm.Constants.CEOApprove ||
                (WorkflowContext.Current.Task.Step==DataForm.Constants.LegalHeadApprove
                    && string.IsNullOrEmpty(this.DataForm1.CEOAccount) ))
                &&e.Action=="Approve")
            {
                WorkflowContext.Current.DataFields["Status"] = "Completed";
            }

            SPFieldUserValueCollection col = WorkFlowUtil.GetApproversValue();
            WorkflowContext.Current.DataFields["Approvers"] = col;
        }
Example #3
0
        void actions_ActionExecuting(object sender, ActionEventArgs e)
        {
            if (e.Action.Equals("End", StringComparison.CurrentCultureIgnoreCase))
            {
                WorkflowContext.Current.DataFields["Status"] = "Cancelled";
                return;
            }
            string strNextTaskUrl = @"_Layouts/CA/WorkFlows/ChoppingApplication/ApproveForm.aspx";
            string strNextTaskTitle = string.Format("{0}'s chopping application needs approve", new SPFieldLookupValue(SPContext.Current.ListItem["Created By"] + "").LookupValue);

            WorkflowContext.Current.UpdateWorkflowVariable("NextTaskUrl", strNextTaskUrl);
            WorkflowContext.Current.UpdateWorkflowVariable("NextTaskTitle", strNextTaskTitle);

            string LegalHead = UserProfileUtil.GetDepartmentManager("legal");
            string LegalCounsel = WorkFlowUtil.GetUserInGroup("wf_LegalCounsel");
            WorkflowContext.Current.UpdateWorkflowVariable("DepartHeadAccount", this.DataForm1.DeptManagerAccount);
            WorkflowContext.Current.UpdateWorkflowVariable("LegalCounselAccount", LegalCounsel);
            WorkflowContext.Current.UpdateWorkflowVariable("LegalHeadAccount", LegalHead);
            if (string.IsNullOrEmpty(DataForm1.CFCOAccount) && !string.IsNullOrEmpty(DataForm1.CFCO2Account))
            {
                WorkflowContext.Current.UpdateWorkflowVariable("CFCOAccount", this.DataForm1.CFCO2Account);
                WorkflowContext.Current.UpdateWorkflowVariable("ManagerAccount", this.DataForm1.CFCOAccount);
            }
            else
            {
                WorkflowContext.Current.UpdateWorkflowVariable("CFCOAccount", this.DataForm1.CFCOAccount);
                WorkflowContext.Current.UpdateWorkflowVariable("ManagerAccount", this.DataForm1.CFCO2Account);
            }
            WorkflowContext.Current.UpdateWorkflowVariable("ManagerAccount", this.DataForm1.CFCO2Account);

            WorkflowContext.Current.DataFields["Projects"] = this.DataForm1.Projects;
            WorkflowContext.Current.DataFields["Status"] = "In Progress";
        }
Example #4
0
        void TopicVote(object sender, ActionEventArgs e)
        {
            uPowers.BusinessLogic.Action a = (uPowers.BusinessLogic.Action)sender;

                if (a.Alias == "LikeTopic" || a.Alias == "DisLikeTopic") {
                    Topic t = new Topic(e.ItemId);
                    e.ReceiverId = t.MemberId;
                 }
        }
Example #5
0
        private void Actions_ActionExecuting(object sender, ActionEventArgs e)
        {
            WorkflowDataFields fields = WorkflowContext.Current.DataFields;
            if (e.Action.Equals("Save", StringComparison.CurrentCultureIgnoreCase))
            {
                WorkflowContext.Current.UpdateWorkflowVariable("isSave", true);
                fields["Status"] = CAWorkflowStatus.Pending;
                WorkflowContext.Current.UpdateWorkflowVariable("completeTaskT", "PAD Change Request needs to Submit");

                WorkflowContext.Current.UpdateWorkflowVariable("editUrl", "/_Layouts/CA/WorkFlows/PADChangeRequest/EditForm.aspx");
            }
            else
            {
                if (Convert.ToDateTime(fields["CurrentPAD"].ToString()) < Convert.ToDateTime(fields["NewPAD"].ToString()))
                {
                    if (sapcommonpad.SapUpdatePAD(fields["PONumber"].ToString(), Convert.ToDateTime(fields["NewPAD"].ToString()).ToString("yyyy-MM-dd")))
                    {
                        WorkflowContext.Current.UpdateWorkflowVariable("isSave", false);
                        WorkflowContext.Current.UpdateWorkflowVariable("isSubmit", true);
                        WorkflowContext.Current.UpdateWorkflowVariable("updateResult", true);
                        WorkflowContext.Current.UpdateWorkflowVariable("isFree", true);
                        fields["Status"] = CAWorkflowStatus.Completed;
                    }
                    else
                    {
                        DisplayMessage("更新SAP数据失败,请联系IT人员或稍后提交.Error:" + sapcommonpad.ErrorMsg);
                        e.Cancel = true;
                        return;
                    }
                }
                else
                {
                    QuickFlow.NameCollection ApproveUser = new QuickFlow.NameCollection();
                    var applicant = WorkFlowUtil.GetApplicantAccount(WorkflowContext.Current.DataFields["Applicant"].ToString());

                    var managerEmp = WorkFlowUtil.GetApproverByLevelPAD(UserProfileUtil.GetEmployeeEx(applicant));
                    //// ApproveUser.Add("ca\\function.head2");
                    ApproveUser.Add(managerEmp.UserAccount);
                    var deleman = WorkFlowUtil.GetDeleman(managerEmp.UserAccount, "127");
                    if (deleman != null)
                    {
                        ApproveUser.Add(deleman);
                        //fields["Delegates"] = deleman;
                    }
                    WorkflowContext.Current.UpdateWorkflowVariable("isSave", false);
                    WorkflowContext.Current.UpdateWorkflowVariable("isSubmit", true);
                    WorkflowContext.Current.UpdateWorkflowVariable("isFree", false);
                    WorkflowContext.Current.UpdateWorkflowVariable("firstApproveUser", ApproveUser);
                    WorkflowContext.Current.UpdateWorkflowVariable("ManagerApproveT", "PAD Change Request needs to Approve");
                    WorkflowContext.Current.UpdateWorkflowVariable("approveUrl", "/_Layouts/CA/WorkFlows/PADChangeRequest/ApproveForm.aspx");
                    fields["Status"] = CAWorkflowStatus.InProgress;
                }
            }

            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
        void Action_BeforePerform(object sender, ActionEventArgs e)
        {
            uPowers.BusinessLogic.Action a = (uPowers.BusinessLogic.Action)sender;

            if (a.Alias == "ExternalVote")
            {
                var memberId = uPowers.BusinessLogic.Data.SqlHelper.ExecuteScalar<int>("SELECT memberId FROM externalUrls WHERE (@id = id)", uPowers.BusinessLogic.Data.SqlHelper.CreateParameter("@id", e.ItemId));
                e.ReceiverId = memberId;
            }
        }
Example #7
0
        void CommentScoring(object sender, ActionEventArgs e)
        {
            uPowers.BusinessLogic.Action a = (uPowers.BusinessLogic.Action)sender;

            if (a.Alias == "LikeComment" || a.Alias == "DisLikeComment" || a.Alias == "TopicSolved") {

                int score = uPowers.Library.Xslt.Score(e.ItemId, a.DataBaseTable);

                //we then add the sum of the total score to the
                our.Data.SqlHelper.ExecuteNonQuery("UPDATE forumComments SET score = @score WHERE id = @id", Data.SqlHelper.CreateParameter("@id", e.ItemId), Data.SqlHelper.CreateParameter("@score", score));
            }
        }
Example #8
0
        void TopicScoring(object sender, ActionEventArgs e)
        {
            if (!e.Cancel) {
                uPowers.BusinessLogic.Action a = (uPowers.BusinessLogic.Action)sender;

                if (a.Alias == "LikeTopic" || a.Alias == "DisLikeTopic") {
                    int topicScore = uPowers.Library.Xslt.Score(e.ItemId, a.DataBaseTable);

                    //this uses a non-standard coloumn in the forum schema, so this is added manually..
                    our.Data.SqlHelper.ExecuteNonQuery("UPDATE forumTopics SET score = @score WHERE id = @id", Data.SqlHelper.CreateParameter("@id", e.ItemId), Data.SqlHelper.CreateParameter("@score", topicScore));
                }
            }
        }
        void ProjectVote(object sender, ActionEventArgs e)
        {
            uPowers.BusinessLogic.Action a = (uPowers.BusinessLogic.Action)sender;

            if (a.Alias == "ProjectUp" || a.Alias == "ProjectDown") {

                Document d = new Document(e.ItemId);

                e.ReceiverId = (int)d.getProperty("owner").Value;

                e.ExtraReceivers = Utills.GetProjectContributors(d.Id);
            }
        }
Example #10
0
        void CommentVote(object sender, ActionEventArgs e)
        {
            uPowers.BusinessLogic.Action a = (uPowers.BusinessLogic.Action)sender;

            if (a.Alias == "LikeComment" || a.Alias == "DisLikeComment") {
                Comment c = new Comment(e.ItemId);
                if (c != null) {
                    e.ReceiverId = c.MemberId;
                }
            } else if (a.Alias == "TopicSolved") {
                Topic t = Topic.GetTopic(new Comment(e.ItemId).TopicId);
                bool hasAnswer = (our.Data.SqlHelper.ExecuteScalar<int>("SELECT answer FROM forumTopics where id = @id", Data.SqlHelper.CreateParameter("@id", t.Id)) > 0);

                e.Cancel = hasAnswer;
            }
        }
        void Action_AfterPerform(object sender, ActionEventArgs e)
        {
            uPowers.BusinessLogic.Action a = (uPowers.BusinessLogic.Action)sender;

            if (a.Alias == "ProjectUp")
            {
                Document d = new Document(e.ItemId);

                if (d.getProperty("approved").Value != null &&
                     d.getProperty("approved").Value.ToString() != "1" &&
                     uPowers.Library.Xslt.Score(d.Id, "powersProject") >= 15)
                {
                    //set approved flag
                    d.getProperty("approved").Value = true;

                    d.Save();
                    d.Publish(new umbraco.BusinessLogic.User(0));

                    umbraco.library.UpdateDocumentCache(d.Id);
                    umbraco.library.RefreshContent();
                }
            }
        }
Example #12
0
        private void Actions_ActionExecuting(object sender, ActionEventArgs e)
        {
            WorkflowContext context = WorkflowContext.Current;
            WorkflowDataFields fields = WorkflowContext.Current.DataFields;

            switch (e.Action)
            {
                case "Confirm":
                    fields["Status"] = CAWorkflowStatus.Completed;
                    break;
                case "Reject":
                    fields["Status"] = CAWorkflowStatus.Rejected;

                    context.UpdateWorkflowVariable("ConfirmTaskUsers", TravelExpenseClaimForSAPCommon.GetTaskUsersWithoutDeleman(WorkflowGroupName.WF_Accountants));
                    context.UpdateWorkflowVariable("ConfirmTaskTitle", "Please resubmit Travel Expense Claim for SAP");

                    break;
                default:
                    break;
            }

            WorkFlowUtil.UpdateWorkflowPath(context);
        }
Example #13
0
        void actions_ActionExecuting(object sender, ActionEventArgs e)
        {
            string strNextTaskUrl = @"_Layouts/CA/WorkFlows/ChoppingApplication2/ApproveForm.aspx";
            string strNextTaskTitle = string.Format("{0}'s chopping application needs approval", new SPFieldLookupValue(SPContext.Current.ListItem["Created By"] + "").LookupValue);

            if (string.Equals(e.Action, "Reject", StringComparison.CurrentCultureIgnoreCase))
            {
                strNextTaskUrl = @"_Layouts/CA/WorkFlows/ChoppingApplication2/ApplicantEditForm.aspx";
                strNextTaskTitle = "Please modify your chopping application";
            }

            WorkflowContext.Current.UpdateWorkflowVariable("NextTaskUrl", strNextTaskUrl);
            WorkflowContext.Current.UpdateWorkflowVariable("NextTaskTitle", strNextTaskTitle);

            if ((WorkflowContext.Current.Task.Step == DataForm.Constants.CEOApprove ||
                (WorkflowContext.Current.Task.Step == DataForm.Constants.LegalHeadApprove
                    && string.IsNullOrEmpty(this.DataForm1.CEOAccount)))
                && e.Action == "Approve")
            {
                WorkflowContext.Current.DataFields["Status"] = "Completed";
            }

            //SPFieldUserValueCollection col = WorkFlowUtil.GetApproversValue();
            //WorkflowContext.Current.DataFields["Approvers"] = col;
            AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, CA.WorkFlow.UI.Constants.WorkFlowStep.ChoppingApprovers, CA.WorkFlow.UI.Constants.WorkFlowStep.ChoppingApproverLoginName);
            //switch (WorkflowContext.Current.Task.Step)
            //{
            //    case CA.WorkFlow.UI.Constants.WorkFlowStep.ChoppingDepartHeadApprove:
            //        if (string.IsNullOrEmpty(DataForm1.CFCOAccount) && !string.IsNullOrEmpty(DataForm1.CFCO2Account))
            //        {
            //            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.ChoppingCFCOAccount, GetDelemanNameCollection(new NameCollection(this.DataForm1.CFCO2Account), Constants.CAModules.ChoppingApplication));
            //        }
            //        else
            //        {
            //            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.ChoppingCFCOAccount, GetDelemanNameCollection(new NameCollection(this.DataForm1.CFCOAccount), Constants.CAModules.ChoppingApplication));
            //        }
            //        string LegalCounsel = WorkFlowUtil.GetUserInGroup("wf_LegalCounsel");
            //        WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.ChoppingLegalCounselAccount, GetDelemanNameCollection(new NameCollection(LegalCounsel), Constants.CAModules.ChoppingApplication));
            //        break;
            //    case CA.WorkFlow.UI.Constants.WorkFlowStep.ChoppingCFCOApprove:
            //        if (string.IsNullOrEmpty(DataForm1.CFCOAccount) && !string.IsNullOrEmpty(DataForm1.CFCO2Account))
            //        {
            //            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.ChoppingManagerAccount, GetDelemanNameCollection(new NameCollection(this.DataForm1.CFCOAccount), Constants.CAModules.ChoppingApplication));
            //        }
            //        else
            //        {
            //            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.ChoppingManagerAccount, GetDelemanNameCollection(new NameCollection(this.DataForm1.CFCO2Account), Constants.CAModules.ChoppingApplication));
            //        }
            //        string LegalCounsel1 = WorkFlowUtil.GetUserInGroup("wf_LegalCounsel");
            //        WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.ChoppingLegalCounselAccount, GetDelemanNameCollection(new NameCollection(LegalCounsel1), Constants.CAModules.ChoppingApplication));
            //        break;
            //    case CA.WorkFlow.UI.Constants.WorkFlowStep.ChoppingLegalApprove:
            //        //OtherLegalApprove 无
            //        string LegalHead = UserProfileUtil.GetDepartmentManager("legal");
            //        WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.ChoppingLegalHeadAccount, GetDelemanNameCollection(new NameCollection(LegalHead), Constants.CAModules.ChoppingApplication));
            //        break;
            //    case CA.WorkFlow.UI.Constants.WorkFlowStep.ChoppingLegalHeadApprovet:
            //        WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.ChoppingCEOAccount, GetDelemanNameCollection(new NameCollection(this.DataForm1.CEOAccount), Constants.CAModules.ChoppingApplication));
            //        break;
            //    case CA.WorkFlow.UI.Constants.WorkFlowStep.ChoppingManagerApprove:
            //        string LegalCounsel2 = WorkFlowUtil.GetUserInGroup("wf_LegalCounsel");
            //        WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.ChoppingLegalCounselAccount, GetDelemanNameCollection(new NameCollection(LegalCounsel2), Constants.CAModules.ChoppingApplication));
            //        break;
            //    case CA.WorkFlow.UI.Constants.WorkFlowStep.ChoppingOtherLegalApprove:
            //        string LegalHead1 = UserProfileUtil.GetDepartmentManager("legal");
            //        WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.ChoppingLegalHeadAccount, GetDelemanNameCollection(new NameCollection(LegalHead1), Constants.CAModules.ChoppingApplication));
            //        break;
            //}

            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
Example #14
0
        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("Approve", StringComparison.CurrentCultureIgnoreCase))
                    {
                        var levelType = "Payment Approval Limits";
                        string totalnum = fields["ApproveAmount"].ToString();
                        double total = Convert.ToDouble(totalnum);
                        var quota = WorkFlowUtil.GetQuota(fields["CurrManager"].ToString(), levelType);
                        if (total > quota)
                        {
                            #region Set users for workflow
                            //Modify task users
                            var managerEmp = WorkFlowUtil.GetNextApprover(fields["CurrManager"].ToString());

                            //if it's CEO
                            if (managerEmp == null)
                            {
                                List<string> ceos = WorkflowPerson.GetCEO();
                                if (ceos.Count == 0)
                                {
                                    DisplayMessage("The init error about WorkflowPerson in the system.");
                                    e.Cancel = true;
                                    return;
                                }
                                managerEmp = UserProfileUtil.GetEmployeeEx(ceos[0]);
                            }

                            //Get Task users include deleman
                            NameCollection manager = new NameCollection();
                            manager.Add(managerEmp.UserAccount);
                            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.CreditCardClaimNextApproveTaskUsers, GetDelemanNameCollection(manager, Constants.CAModules.CreditCardClaim));
                            #endregion

                            fields["CurrManager"] = managerEmp.UserAccount;

                            //context.UpdateWorkflowVariable("NextApproveTaskUsers", manager);
                            context.UpdateWorkflowVariable("IsContinue", true);
                        }
                        else
                        {
                            NameCollection wfCFO = WorkFlowUtil.GetUsersInGroup("wf_FinanceConfirm_CreditCard");
                            WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.CreditCardClaimConfirmTaskUsers, GetDelemanNameCollection(wfCFO, Constants.CAModules.CreditCardClaim));
                            context.UpdateWorkflowVariable("IsContinue", false);
                            //fields["NoticeResult"] = "2";
                        }
                    }
                    else
                    {
                        fields["Status"] = CAWorkflowStatus.Rejected;
                        context.UpdateWorkflowVariable("CompleteTaskTitle", "Please resubmit Credit Card Claim");
                        context.UpdateWorkflowVariable("IsContinue", false);
                        SendEmail("Reject");
                    }
                    AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, CA.WorkFlow.UI.Constants.WorkFlowStep.CreditCardClaimApproversPerson, CA.WorkFlow.UI.Constants.WorkFlowStep.CreditCardClaimClaimApprovers);
                    break;
                case "ConfirmTask":
                    if (e.Action == "Confirm")
                    {
                        fields["Status"] = CAWorkflowStatus.Completed;
                        fields["ReasonsResult"] = "0";
                        if (fields["RMBSummaryExpenseType"].ToString().Length > 2 || fields["USDSummaryExpenseType"].ToString().Length > 2)
                        {
                            if (IsExistSAP(fields["WorkflowNumber"].ToString()))
                            {
                                AddExpenseClaimSAPWorkFlow(fields);
                            }
                        }
                        //SendEmail("Approve");
                    }
                    if (e.Action == "Reject")
                    {
                        fields["Status"] = CAWorkflowStatus.Rejected;
                        this.DataForm1.SavePendingForm();
                        context.UpdateWorkflowVariable("CompleteTaskTitle", "Please resubmit Credit Card Claim");
                        SendEmail("Reject");
                    }
                    if (e.Action == "Pending")
                    {
                        //if (fields["NoticeResult"].ToString()=="2")
                        //{
                        //    fields["NoticeResult"] = "0";
                        //}
                        fields["Status"] = CAWorkflowStatus.Pending;
                        this.DataForm1.SavePendingForm();
                        NameCollection wfCFO1 = WorkFlowUtil.GetUsersInGroup("wf_FinanceConfirm_CreditCard");
                        WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.CreditCardClaimConfirmTaskUsers, GetDelemanNameCollection(wfCFO1, Constants.CAModules.CreditCardClaim));
                        SendEmail("Pending");
                    }

                    AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, CA.WorkFlow.UI.Constants.WorkFlowStep.CreditCardClaimApproversPerson, CA.WorkFlow.UI.Constants.WorkFlowStep.CreditCardClaimClaimApprovers);
                    break;
            }

            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
Example #15
0
        private void Actions_ActionExecuting(object sender, ActionEventArgs e)
        {
            SapCommonPADChangeRequest sapcommonpad = new SapCommonPADChangeRequest();
            WorkflowDataFields fields = WorkflowContext.Current.DataFields;
            string sWorkflowNumber = fields["Title"].ToString();
            switch (WorkflowContext.Current.Step)
            {
                case "ManagerApprove":
                    if (e.Action.Equals("Approve", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ///现审请者的manager为4,则结束流程
                        ///现审请者的manager为5,现审请者的manager的manager为4以上,则结束

                        bool isNeedBD = true;

                        Employee eCurrManager=UserProfileUtil.GetEmployeeEx(fields["CurrManager"].ToString());
                        int iCurrLevel = SapCommonPADChangeRequest.GetLevel(eCurrManager.JobLevel);

                        if (iCurrLevel == 4)//当前审批者的级别为4,不需要审批
                        {
                            isNeedBD = false;
                        }
                        else////当前审请者的级别为5
                        {
                           // QuickFlow.NameCollection BDMApprover = new QuickFlow.NameCollection();
                            Employee eBD = WorkFlowUtil.GetNextApprover(eCurrManager);
                            if (null == eBD)//当前审批者没有manager,不需要审批
                            {
                                isNeedBD = false;
                            }
                            else
                            {
                                int iLevel = SapCommonPADChangeRequest.GetLevel(eBD.JobLevel.AsString());
                                if (iLevel != 4)////当前审批者的manager不为4,不需要审批
                                {
                                    isNeedBD = false;
                                }

                            }
                        }
                        if (!isNeedBD)//不需要下一级审批
                        {
                            if (UpdateToSAP(sWorkflowNumber))
                            {
                                WorkflowContext.Current.UpdateWorkflowVariable("isOnlyApp", true);
                                WorkflowContext.Current.UpdateWorkflowVariable("updateResult", true);

                                //fields["CurrManager"] = WorkFlowUtil.GetApproverByLevelPAD(UserProfileUtil.GetEmployeeEx(WorkFlowUtil.GetApplicantAccount(WorkflowContext.Current.DataFields["Applicant"].ToString()))).UserAccount;
                                fields["Approvers"] = ReturnAllApprovers(fields["CurrManager"].ToString());
                                fields["ApproversSPUser"] = ReturnAllApproversSP("ApproversSPUser", fields["CurrManager"].ToString());
                                if (!SPContext.Current.Web.CurrentUser.LoginName.Equals(fields["CurrManager"].ToString(), StringComparison.CurrentCultureIgnoreCase))
                                {
                                    fields["ApproversSPUser"] = ReturnAllApproversSP("ApproversSPUser", SPContext.Current.Web.CurrentUser.LoginName);
                                }

                                fields["Status"] = CAWorkflowStatus.Completed;
                                SendNoticeMail("approved");
                            }
                            else
                            {
                                //DisplayMessage("更新SAP数据失败,请联系IT人员或稍后审批.Error:" + sapcommonpad.ErrorMsg.Replace("'", "‘").Replace("\\n", "  "));
                                e.Cancel = true;
                                return;
                            }
                        }
                        else///需要经过SuperManagerApprove审批
                        {
                            QuickFlow.NameCollection SuperApproveUser = new QuickFlow.NameCollection();
                            //var applicant = WorkFlowUtil.GetApplicantAccount(WorkflowContext.Current.DataFields["Applicant"].ToString());
                            Employee supmanagerEmp = WorkFlowUtil.GetNextApprover(eCurrManager);// WorkFlowUtil.GetApproverIgnoreRight(WorkFlowUtil.GetApproverByLevelPAD(UserProfileUtil.GetEmployeeEx(applicant)));

                            if (supmanagerEmp == null)
                            {
                                DisplayMessage("此用户没有Level-4级审批用户,无法提交");
                                e.Cancel = true;
                                return;
                            }
                            SuperApproveUser.Add(supmanagerEmp.UserAccount);
                            var deleman = WorkFlowUtil.GetDeleman(supmanagerEmp.UserAccount, "127");
                            if (deleman != null)
                            {
                                SuperApproveUser.Add(deleman);
                            }
                            WorkflowContext.Current.UpdateWorkflowVariable("isOnlyApp", false);
                            WorkflowContext.Current.UpdateWorkflowVariable("secApproveU", SuperApproveUser);
                            WorkflowContext.Current.UpdateWorkflowVariable("SuperManagerT", "PAD Change Request needs to Approve");
                            WorkflowContext.Current.UpdateWorkflowVariable("approveUrl", "/_Layouts/CA/WorkFlows/PADChangeRequest/BatchApproveForm.aspx");

                            fields["Approvers"] = ReturnAllApprovers(fields["CurrManager"].ToString());
                            fields["ApproversSPUser"] = ReturnAllApproversSP("ApproversSPUser", fields["CurrManager"].ToString());
                            if (!SPContext.Current.Web.CurrentUser.LoginName.Equals(fields["CurrManager"].ToString(), StringComparison.CurrentCultureIgnoreCase))
                            {
                                fields["ApproversSPUser"] = ReturnAllApproversSP("ApproversSPUser", SPContext.Current.Web.CurrentUser.LoginName);
                            }
                            UpdateItemApprove();
                            fields["Status"] = CAWorkflowStatus.InProgress;
                            fields["CurrManager"] = supmanagerEmp.UserAccount;// WorkFlowUtil.GetApproverByLevelPAD(UserProfileUtil.GetEmployeeEx(WorkFlowUtil.GetApplicantAccount(WorkflowContext.Current.DataFields["Applicant"].ToString()))).UserAccount;
                        }
                    }
                    else//Reject
                    {
                        UpdateItemReject();
                       // fields["CurrManager"] = CurrentEmployee.UserAccount;// WorkFlowUtil.GetApproverByLevelPAD(UserProfileUtil.GetEmployeeEx(WorkFlowUtil.GetApplicantAccount(WorkflowContext.Current.DataFields["Applicant"].ToString()))).UserAccount;
                        fields["Status"] = CAWorkflowStatus.Completed;
                        fields["Approvers"] = ReturnAllApprovers(fields["CurrManager"].ToString());
                        fields["ApproversSPUser"] = ReturnAllApproversSP("ApproversSPUser", fields["CurrManager"].ToString());
                        SendNoticeMail("rejected");
                    }
                    break;
                case "SuperManagerApprove":
                    if (e.Action.Equals("Approve", StringComparison.CurrentCultureIgnoreCase))
                    {
                        if (UpdateToSAP(sWorkflowNumber))
                        {
                            WorkflowContext.Current.UpdateWorkflowVariable("updateResult", true);

                            var applicant = WorkFlowUtil.GetApplicantAccount(WorkflowContext.Current.DataFields["Applicant"].ToString());
                            var supmanagerEmp = WorkFlowUtil.GetApproverIgnoreRight(WorkFlowUtil.GetApproverByLevelPAD(UserProfileUtil.GetEmployeeEx(applicant)));
                           // fields["CurrManager"] = supmanagerEmp.UserAccount;
                            fields["ApproversSPUser"] = ReturnAllApproversSP("ApproversSPUser", fields["CurrManager"].ToString());
                            if (!SPContext.Current.Web.CurrentUser.LoginName.Equals(fields["CurrManager"].ToString(), StringComparison.CurrentCultureIgnoreCase))
                            {
                                fields["ApproversSPUser"] = ReturnAllApproversSP("ApproversSPUser", SPContext.Current.Web.CurrentUser.LoginName);
                            }
                            fields["Status"] = CAWorkflowStatus.Completed;
                            SendNoticeMail("approved");
                        }
                        else
                        {
                            e.Cancel = true;
                            return;
                        }
                    }
                    else
                    {
                        UpdateItemReject();
                       // fields["CurrManager"] = CurrentEmployee.UserAccount;// WorkFlowUtil.GetApproverByLevelPAD(UserProfileUtil.GetEmployeeEx(WorkFlowUtil.GetApplicantAccount(WorkflowContext.Current.DataFields["Applicant"].ToString()))).UserAccount;
                        fields["Status"] = CAWorkflowStatus.Completed;
                        fields["Approvers"] = ReturnAllApprovers(fields["CurrManager"].ToString());
                        fields["ApproversSPUser"] = ReturnAllApproversSP("ApproversSPUser", fields["CurrManager"].ToString());
                        SendNoticeMail("rejected");
                    }
                    break;
            }

            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
Example #16
0
        private void Actions_ActionExecuting(object sender, ActionEventArgs e)
        {
            WorkflowDataFields fields = WorkflowContext.Current.DataFields;
            switch (WorkflowContext.Current.Step)
            {
                case "ManagerApprove":
                    if (e.Action.Equals("Approve", StringComparison.CurrentCultureIgnoreCase))
                    {
                        if (WorkFlowUtil.GetApproverIsLastPAD(WorkFlowUtil.GetApproverByLevelPAD(UserProfileUtil.GetEmployeeEx(WorkFlowUtil.GetApplicantAccount(WorkflowContext.Current.DataFields["Applicant"].ToString())))))
                        {
                            if (sapcommonpad.SapUpdatePAD(fields["PONumber"].ToString(), Convert.ToDateTime(fields["NewPAD"]).ToString("yyyy-MM-dd")))
                            {
                                WorkflowContext.Current.UpdateWorkflowVariable("isOnlyApp", true);
                                WorkflowContext.Current.UpdateWorkflowVariable("updateResult", true);

                                fields["CurrManager"] = WorkFlowUtil.GetApproverByLevelPAD(UserProfileUtil.GetEmployeeEx(WorkFlowUtil.GetApplicantAccount(WorkflowContext.Current.DataFields["Applicant"].ToString()))).UserAccount;
                                fields["Approvers"] = ReturnAllApprovers(fields["CurrManager"].ToString());
                                fields["ApproversSPUser"] = ReturnAllApproversSP("ApproversSPUser", fields["CurrManager"].ToString());
                                if (!SPContext.Current.Web.CurrentUser.LoginName.Equals(fields["CurrManager"].ToString(), StringComparison.CurrentCultureIgnoreCase))
                                {
                                    fields["ApproversSPUser"] = ReturnAllApproversSP("ApproversSPUser", SPContext.Current.Web.CurrentUser.LoginName);
                                }

                                fields["Status"] = CAWorkflowStatus.Completed;
                            }
                            else
                            {
                                DisplayMessage("更新SAP数据失败,请联系IT人员或稍后审批.Error:" + sapcommonpad.ErrorMsg);
                                e.Cancel = true;
                                return;
                            }
                        }
                        else
                        {
                            QuickFlow.NameCollection SuperApproveUser = new QuickFlow.NameCollection();
                            var applicant = WorkFlowUtil.GetApplicantAccount(WorkflowContext.Current.DataFields["Applicant"].ToString());
                            var supmanagerEmp = WorkFlowUtil.GetApproverIgnoreRight(WorkFlowUtil.GetApproverByLevelPAD(UserProfileUtil.GetEmployeeEx(applicant)));

                            if (supmanagerEmp == null)
                            {
                                DisplayMessage("此用户没有Level-4级以上的审批用户,无法提交");
                                e.Cancel = true;
                                return;
                            }
                            // ApproveUser.Add("ca\\function.head2");
                            SuperApproveUser.Add(supmanagerEmp.UserAccount);
                            var deleman = WorkFlowUtil.GetDeleman(supmanagerEmp.UserAccount, "127");
                            if (deleman != null)
                            {
                                SuperApproveUser.Add(deleman);
                                //fields["Delegates"] = deleman;
                            }
                            WorkflowContext.Current.UpdateWorkflowVariable("isOnlyApp", false);
                            WorkflowContext.Current.UpdateWorkflowVariable("secApproveU", SuperApproveUser);
                            WorkflowContext.Current.UpdateWorkflowVariable("SuperManagerT", "PAD Change Request needs to Approve");
                            WorkflowContext.Current.UpdateWorkflowVariable("approveUrl", "/_Layouts/CA/WorkFlows/PADChangeRequest/ApproveForm.aspx");

                            fields["CurrManager"] = WorkFlowUtil.GetApproverByLevelPAD(UserProfileUtil.GetEmployeeEx(WorkFlowUtil.GetApplicantAccount(WorkflowContext.Current.DataFields["Applicant"].ToString()))).UserAccount;
                            fields["Approvers"] = ReturnAllApprovers(fields["CurrManager"].ToString());
                            fields["ApproversSPUser"] = ReturnAllApproversSP("ApproversSPUser", fields["CurrManager"].ToString());
                            if (!SPContext.Current.Web.CurrentUser.LoginName.Equals(fields["CurrManager"].ToString(), StringComparison.CurrentCultureIgnoreCase))
                            {
                                fields["ApproversSPUser"] = ReturnAllApproversSP("ApproversSPUser", SPContext.Current.Web.CurrentUser.LoginName);
                            }

                            fields["Status"] = CAWorkflowStatus.InProgress;
                        }
                    }
                    else
                    {
                        fields["Status"] = CAWorkflowStatus.Completed;
                    }
                    break;
                case "SuperManagerApprove":
                    if (e.Action.Equals("Approve", StringComparison.CurrentCultureIgnoreCase))
                    {
                        if (sapcommonpad.SapUpdatePAD(fields["PONumber"].ToString(), Convert.ToDateTime(fields["NewPAD"]).ToString("yyyy-MM-dd")))
                        {
                            WorkflowContext.Current.UpdateWorkflowVariable("updateResult", true);

                            var applicant = WorkFlowUtil.GetApplicantAccount(WorkflowContext.Current.DataFields["Applicant"].ToString());
                            var supmanagerEmp = WorkFlowUtil.GetApproverIgnoreRight(WorkFlowUtil.GetApproverByLevelPAD(UserProfileUtil.GetEmployeeEx(applicant)));
                            fields["CurrManager"] = supmanagerEmp.UserAccount;
                            fields["ApproversSPUser"] = ReturnAllApproversSP("ApproversSPUser", fields["CurrManager"].ToString());
                            if (!SPContext.Current.Web.CurrentUser.LoginName.Equals(fields["CurrManager"].ToString(), StringComparison.CurrentCultureIgnoreCase))
                            {
                                fields["ApproversSPUser"] = ReturnAllApproversSP("ApproversSPUser", SPContext.Current.Web.CurrentUser.LoginName);
                            }

                            fields["Status"] = CAWorkflowStatus.Completed;
                        }
                        else
                        {
                            DisplayMessage("更新SAP数据失败,请联系IT人员或稍后审批.Error:" + sapcommonpad.ErrorMsg);
                            e.Cancel = true;
                            return;
                        }
                    }
                    else
                    {
                        fields["Status"] = CAWorkflowStatus.Completed;
                    }
                    break;
            }

            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
Example #17
0
 protected virtual void FireAfterPerform(ActionEventArgs e)
 {
     if (AfterPerform != null)
         AfterPerform(this, e);
 }
Example #18
0
 protected virtual void FireBeforePerform(ActionEventArgs e)
 {
     _e.FireCancelableEvent(BeforePerform, this, e);
 }
 /// <summary>
 /// 当请求的操作方法未找到时要执行的操作
 /// </summary>
 /// <param name="controller"></param>
 /// <param name="e"></param>
 protected virtual void OnActionNotFound(object controller, ActionEventArgs e)
 {
 }
Example #20
0
        public bool Perform(int performer, int itemId, int receiver, string comment)
        {
            ActionEventArgs e = new ActionEventArgs();
                e.PerformerId = performer;
                e.ItemId = itemId;
                e.ReceiverId = receiver;
                e.ActionType = TypeAlias;

                FireBeforePerform(e);

                if (!e.Cancel) {

                    bool allowed = Allowed(performer, itemId, receiver, comment);

                    if (allowed)
                    {

                    Data.SqlHelper.ExecuteNonQuery("INSERT INTO " + DataBaseTable + "(id, memberId, points, receiverId, receiverPoints, performerPoints, comment) VALUES(@id, @memberId, @points, @receiverId, @receiverPoints, @performerPoints, @comment)",
                        Data.SqlHelper.CreateParameter("@id", e.ItemId),
                        Data.SqlHelper.CreateParameter("@table", DataBaseTable),
                        Data.SqlHelper.CreateParameter("@memberId", e.PerformerId),
                        Data.SqlHelper.CreateParameter("@points", Weight),
                        Data.SqlHelper.CreateParameter("@receiverid", e.ReceiverId),
                        Data.SqlHelper.CreateParameter("@receiverPoints", ReceiverReward),
                        Data.SqlHelper.CreateParameter("@performerPoints", PerformerReward),
                        Data.SqlHelper.CreateParameter("@comment", comment + " ")
                    );

                    //the performer gets his share
                    if(PerformerReward != 0){
                        Reputation r = new Reputation(e.PerformerId);
                        r.Current = (r.Current + (PerformerReward) );
                        r.Total = (r.Total + (PerformerReward) );
                        r.Save();
                    }

                    //And maybe the author of the item gets a cut as well..
                    if (e.ReceiverId > 0 && ReceiverReward != 0) {
                        Reputation pr = new Reputation(e.ReceiverId);
                        pr.Current = (pr.Current + (ReceiverReward) );
                        pr.Total = (pr.Total + (ReceiverReward));
                        pr.Save();
                    }

                    //And maybe there are some additional receivers
                    if (e.ExtraReceivers != null)
                    {
                        foreach (int r in e.ExtraReceivers)
                        {
                            if (allowed)
                            {
                                //make sure the extra receivers also get inserted (but no points for item and performer)
                                Data.SqlHelper.ExecuteNonQuery("INSERT INTO " + DataBaseTable + "(id, memberId, points, receiverId, receiverPoints, performerPoints, comment) VALUES(@id, @memberId, @points, @receiverId, @receiverPoints, @performerPoints, @comment)",
                                    Data.SqlHelper.CreateParameter("@id", e.ItemId),
                                    Data.SqlHelper.CreateParameter("@table", DataBaseTable),
                                    Data.SqlHelper.CreateParameter("@memberId", e.PerformerId),
                                    Data.SqlHelper.CreateParameter("@points", 0),
                                    Data.SqlHelper.CreateParameter("@receiverid", r),
                                    Data.SqlHelper.CreateParameter("@receiverPoints", ReceiverReward),
                                    Data.SqlHelper.CreateParameter("@performerPoints", 0),
                                    Data.SqlHelper.CreateParameter("@comment", comment + " "));
                            }
                            Reputation pr = new Reputation(r);
                            pr.Current = (pr.Current + (ReceiverReward));
                            pr.Total = (pr.Total + (ReceiverReward));
                            pr.Save();
                        }
                    }

                    FireAfterPerform(e);
                    return true;
                }
            }

            return false;
        }
Example #21
0
        void Actions_ActionExecuting(object sender, ActionEventArgs e)
        {
            bool isCheckOK = CheckData();
            if (!isCheckOK)//未能通过数据验证
            {
                e.Cancel = true;
                return;
            }

            WorkflowDataFields fields = WorkflowContext.Current.DataFields;
            string sWorkflowNumber = fields["Title"].ToString();

            if (e.Action.Equals("Save", StringComparison.CurrentCultureIgnoreCase))
            {
                WorkflowContext.Current.UpdateWorkflowVariable("isSave", true);
                WorkflowContext.Current.UpdateWorkflowVariable("isSubmit", false);
                WorkflowContext.Current.UpdateWorkflowVariable("isFree", false);
                WorkflowContext.Current.UpdateWorkflowVariable("completeTaskT", "PAD Change Request needs to Submit");
                WorkflowContext.Current.UpdateWorkflowVariable("editUrl", "/_Layouts/CA/WorkFlows/PADChangeRequest/BatchEditForm.aspx");
                fields["Status"] = CAWorkflowStatus.InProgress;

                DeleteData(sWorkflowNumber);
                SaveDataToPADChangeRequest(sWorkflowNumber);
            }
            else//submit
            {
                bool IsNeedApprove = IsNeedWorkFlowStep();//是否需要工作流审批,只要有一个记录的原始日期大于新输入的日期,则需要进入工作流审批流程,
                if (!IsNeedApprove)//不需要工作流审批流程
                {
                    bool isSuccess = UpdateToSAP(sWorkflowNumber);
                    if (isSuccess)
                    {
                        WorkflowContext.Current.UpdateWorkflowVariable("isSubmit", true);
                        WorkflowContext.Current.UpdateWorkflowVariable("isFree", true);
                        WorkflowContext.Current.UpdateWorkflowVariable("isSave", false);
                        fields["Status"] = CAWorkflowStatus.Completed;

                        DeleteData(sWorkflowNumber);
                        SaveDataToPADChangeRequest(sWorkflowNumber);
                    }
                    else
                    {
                        e.Cancel = true;
                        return;
                    }
                }
                else//需要工作流审批流程
                {
                    QuickFlow.NameCollection ApproveUser = new QuickFlow.NameCollection();
                    var applicant = WorkFlowUtil.GetApplicantAccount(WorkflowContext.Current.DataFields["Applicant"].ToString());

                    var managerEmp = SapCommonPADChangeRequest.GetApproverByLevelPAD(UserProfileUtil.GetEmployeeEx(applicant));// WorkFlowUtil.GetApproverByLevelPAD(UserProfileUtil.GetEmployeeEx(applicant));
                    if (managerEmp == null)
                    {
                        DisplayMessage("此用户没有Level-5,Level-4级的审批用户,无法提交");
                        e.Cancel = true;
                        return;
                    }
                    ApproveUser.Add(managerEmp.UserAccount);
                    var deleman = WorkFlowUtil.GetDeleman(managerEmp.UserAccount, CA.WorkFlow.UI.Constants.CAModules.PADChangeRequest);
                    if (deleman != null)
                    {
                        ApproveUser.Add(deleman);
                    }
                    WorkflowContext.Current.UpdateWorkflowVariable("isSave", false);
                    WorkflowContext.Current.UpdateWorkflowVariable("isSubmit", true);
                    WorkflowContext.Current.UpdateWorkflowVariable("isFree", false);
                    WorkflowContext.Current.UpdateWorkflowVariable("firstApproveUser", ApproveUser);
                    WorkflowContext.Current.UpdateWorkflowVariable("ManagerApproveT", "PAD Change Request needs to Approve");
                    WorkflowContext.Current.UpdateWorkflowVariable("approveUrl", "/_Layouts/CA/WorkFlows/PADChangeRequest/BatchApproveForm.aspx");
                    fields["Status"] = CAWorkflowStatus.InProgress;
                    fields["CurrManager"] = managerEmp.UserAccount;
                    DeleteData(sWorkflowNumber);
                    SaveDataToPADChangeRequest(sWorkflowNumber);
                }
            }

            WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="values"></param>
        /// <returns></returns>
        protected override int ExecuteInsert(IDictionary values)
        {
            if (owner.SaveFunction == null)
                throw new DelegateNotFoundException("SaveFunction", "The insert function doesn't implemented.");

            var eventArg = new SavingEventArgs(owner.SourceType, values);
            owner.OnInserting(eventArg);

            if (eventArg.Cancel)
                return 0;

            var insertingActionEvent = new ActionEventArgs<SavingEventArgs, IPersisterResult>(eventArg, owner.SaveFunction);

            try
            {
                var result = insertingActionEvent.Execute();
                if (result.QueryException != null)
                {
                    owner.OnExecutionQueryError(new QueryResultEventArgs(result));
                    return -1;
                }

                owner.OnInserted(EventArgs.Empty);
                OnDataSourceViewChanged(EventArgs.Empty);
            }
            catch (Exception)
            {
                return -1;
            }
            return 1;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="arguments"></param>
        /// <returns></returns>
        protected override IEnumerable ExecuteSelect(DataSourceSelectArguments arguments)
        {
            if (owner.SelectFunction == null)
                throw new DelegateNotFoundException("SelectFunction", "The select function doesn't implemented.");

            arguments.RaiseUnsupportedCapabilitiesError(this);

            var eventArg = new SelectingEventArgs(arguments, this.GetSelectParameters(), owner.SourceType);
            owner.OnSelecting(eventArg);
            if (eventArg.Cancel)
                return null;

            var selectActionEvent = new ActionEventArgs<SelectingEventArgs, IPagingResult>(eventArg, owner.SelectFunction);

            IPagingResult paging = selectActionEvent.Execute();
            if (paging.QueryException != null)
            {
                owner.OnExecutionQueryError(new QueryResultEventArgs(paging));
                return null;
            }

            IEnumerable result = paging.Result;
            arguments.TotalRowCount = paging.TotalRowCount;
            owner.OnSelected(EventArgs.Empty);

            return result;
        }
Example #24
0
 private void Actions_ActionExecuting(object sender, ActionEventArgs e)
 {
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="keys"></param>
        /// <param name="oldValues"></param>
        /// <returns></returns>
        protected override int ExecuteDelete(IDictionary keys, IDictionary oldValues)
        {
            if (owner.DeleteFunction == null)
                throw new DelegateNotFoundException("DeleteFunction", "The delete function doesn't implemented.");

            if (owner.IdentifierFunction == null)
                throw new DelegateNotFoundException("IdentifierFunction", "The identifier function doesn't implemented.");

            var eventArg = new DeletingEventArgs(owner.SourceType, owner.IdentifierFunction.Invoke(keys));
            owner.OnDeleting(eventArg);

            if (eventArg.Cancel)
                return 0;

            var deletingActionEvent = new ActionEventArgs<DeletingEventArgs, IPersisterResult>(eventArg, owner.DeleteFunction);

            var result = deletingActionEvent.Execute();
            if (result.QueryException != null)
            {
                owner.OnExecutionQueryError(new QueryResultEventArgs(result));
                return -1;
            }

            owner.OnDeleted(EventArgs.Empty);
            OnDataSourceViewChanged(EventArgs.Empty);
            return 1;
        }