コード例 #1
0
        //Control the views of approver report for editors.
        public ActionResult ApproverReportForEditor()
        {
            try
            {
                AllRuleListForApprover allRuleList = new AllRuleListForApprover();
                var totalApprovedRulesAmy          = rulesApprover.GetFixedRulesByStatusForEditor("Approved", "*****@*****.**").Count
                                                     + rulesApprover.GetDataDataDrivenRulesByStatusForEditor("Approved", "*****@*****.**").Count;

                var totalRejectedRulesAmy = rulesApprover.GetFixedRulesByStatusForEditor("Rejected", "*****@*****.**").Count
                                            + rulesApprover.GetDataDataDrivenRulesByStatusForEditor("Rejected", "*****@*****.**").Count;

                var totalUncheckedRulesAmy = rulesApprover.GetFixedRulesByStatusForEditor("Unchecked", "*****@*****.**").Count
                                             + rulesApprover.GetDataDataDrivenRulesByStatusForEditor("Unchecked", "*****@*****.**").Count;

                var resultAmy = ((double)totalApprovedRulesAmy / (totalApprovedRulesAmy + totalRejectedRulesAmy)) * 100;

                allRuleList.TotalApprovedRulesAmy  = totalApprovedRulesAmy;
                allRuleList.TotalRejectedRulesAmy  = totalRejectedRulesAmy;
                allRuleList.TotalUncheckedRulesAmy = totalUncheckedRulesAmy;
                allRuleList.SuccessRateAmy         = Math.Round(resultAmy, 2);

                var totalApprovedRulesCrys = rulesApprover.GetFixedRulesByStatusForEditor("Approved", "*****@*****.**").Count
                                             + rulesApprover.GetDataDataDrivenRulesByStatusForEditor("Approved", "*****@*****.**").Count;

                var totalRejectedRulesCrys = rulesApprover.GetFixedRulesByStatusForEditor("Rejected", "*****@*****.**").Count
                                             + rulesApprover.GetDataDataDrivenRulesByStatusForEditor("Rejected", "*****@*****.**").Count;

                var totalUncheckedRulesCrys = rulesApprover.GetFixedRulesByStatusForEditor("Unchecked", "*****@*****.**").Count
                                              + rulesApprover.GetDataDataDrivenRulesByStatusForEditor("Unchecked", "*****@*****.**").Count;

                var resultCrys = ((double)totalApprovedRulesCrys / (totalApprovedRulesCrys + totalRejectedRulesCrys)) * 100;

                allRuleList.TotalApprovedRulesCrys  = totalApprovedRulesCrys;
                allRuleList.TotalRejectedRulesCrys  = totalRejectedRulesCrys;
                allRuleList.TotalUncheckedRulesCrys = totalUncheckedRulesCrys;
                allRuleList.SuccessRateCrys         = Math.Round(resultCrys, 2);


                var averageResult = ((double)(totalApprovedRulesAmy + totalApprovedRulesCrys) /
                                     (totalApprovedRulesAmy + totalApprovedRulesCrys + totalRejectedRulesAmy +
                                      totalRejectedRulesCrys)) * 100;

                allRuleList.AverageSuccessRate = Math.Round(averageResult, 2);

                return(View(allRuleList));
            }
            catch (Exception e)
            {
                return(View("Error", new HandleErrorInfo(
                                new Exception("Sorry, we have gotten a problem of showing the approver report for editors right now.", e),
                                "Approver", "Index")));
            }
        }
コード例 #2
0
        //Control the views of approver main page.
        public ActionResult Index()
        {
            try
            {
                AllRuleListForApprover allRuleList = new AllRuleListForApprover();

                allRuleList.UncheckedDataDrivenRules = rulesApprover.GetDataDrivenRulesByStatus("Unchecked");

                allRuleList.UncheckedFixedRules = rulesApprover.GetFixedRulesByStatus("Unchecked");


                return(View(allRuleList));
            }
            catch (Exception e)
            {
                return(View("Error", new HandleErrorInfo(new Exception("Sorry, we have gotten a problem of finding the unchecked rules right now.", e),
                                                         "Approver", "Index")));
            }
        }
コード例 #3
0
        //Control the views of approver report;
        public ActionResult ApproverReportForRule()
        {
            try
            {
                AllRuleListForApprover allRuleList = new AllRuleListForApprover();
                allRuleList.ApprovedFixedRules      = rulesApprover.GetFixedRulesByStatus("Approved");
                allRuleList.ApprovedDataDrivenRules = rulesApprover.GetDataDrivenRulesByStatus("Approved");

                allRuleList.TotalApprovedRules = rulesApprover.GetDataDrivenRulesByStatus("Approved").Count + rulesApprover.GetFixedRulesByStatus("Approved").Count;
                allRuleList.TotalRejectedRules = rulesApprover.GetFixedRulesByStatus("Rejected").Count + rulesApprover.GetDataDrivenRulesByStatus("Rejected").Count;

                double result = ((double)allRuleList.TotalApprovedRules / (allRuleList.TotalApprovedRules +
                                                                           allRuleList.TotalRejectedRules)) * 100;

                allRuleList.SuccessRate = Math.Round(result, 2);

                return(View(allRuleList));
            }
            catch (Exception e)
            {
                return(View("Error", new HandleErrorInfo(new Exception("Sorry, we have gotten a problem of showing the approver report right now.", e),
                                                         "Approver", "Index")));
            }
        }