Beispiel #1
0
        public void SetValuesForReport(string Year, string isQuarterly)
        {
            objReportController     = new ReportController();
            objReportModel          = new ReportModel();
            objReportDataTable      = new RevenueDataTable();
            subModelList            = new RevenueSubDataTableModel();
            objRevenueToPlanModel   = new RevenueToPlanModel();
            objProjected_Goal       = new Projected_Goal();
            objCardSection          = new CardSectionModel();
            objlineChartData        = new lineChartData();
            objCardSectionListModel = new CardSectionListModel();
            ObjPlanCommonFunctions.SetSessionData();

            var result1 = objReportController.GetRevenueData(Year, isQuarterly) as PartialViewResult;

            objReportModel          = (ReportModel)(result1.ViewData.Model);
            objRevenueToPlanModel   = objReportModel.RevenueToPlanModel;
            objReportDataTable      = objRevenueToPlanModel.RevenueToPlanDataModel;
            subModelList            = objReportDataTable.SubDataModel;
            objlineChartData        = objRevenueToPlanModel.LineChartModel;
            objProjected_Goal       = objReportModel.RevenueHeaderModel;
            objCardSection          = objReportModel.CardSectionModel;
            objCardSectionListModel = objCardSection.CardSectionListModel[0];

            if (isQuarterly == "Monthly")
            {
                ActualList       = objReportDataTable.ActualList;
                ProjectedList    = objReportDataTable.ProjectedList;
                GoalList         = objReportDataTable.GoalList;
                PerformanceList  = subModelList.PerformanceList;
                ActualCostList   = subModelList.CostList;
                ROIList          = subModelList.ROIList;
                TotalRevenueList = subModelList.RevenueList;
            }
            else
            {
                QuaterlyActualList       = objReportDataTable.ActualList;
                QuaterlyProjectedList    = objReportDataTable.ProjectedList;
                QuaterlyGoalList         = objReportDataTable.GoalList;
                QuaterlyPerformanceList  = subModelList.PerformanceList;
                QuaterlyActualCostList   = subModelList.CostList;
                QuaterlyROIList          = subModelList.ROIList;
                QuaterlyTotalRevenueList = subModelList.RevenueList;
            }
        }
Beispiel #2
0
        public void VerifyQuarterlyGraphValue(lineChartData objlineChartData, CardSectionListModel objCardSectionListModel)
        {
            if (objlineChartData.categories != null && objlineChartData.categories.Count > 0 && objlineChartData.series != null && objlineChartData.series.Count > 0)
            {
                List <string> categories = objlineChartData.categories;
                series        ActualSeries = objlineChartData.series[0];
                series        GoalSeries = objlineChartData.series[1];
                series        ProjectedSeries = objlineChartData.series[2];
                decimal       SumOfActualSeries = 0; decimal SumOfGoalSeries = 0; decimal SumOfProjectedSeries = 0; decimal SumOfActualCostSeries = 0;

                lineChartData tacticLineChartData = objCardSectionListModel.LineChartData;
                series        tacticRevenueSeries = tacticLineChartData.series[0];
                series        tacticCostSeries    = tacticLineChartData.series[1];



                #region Graph for Plan
                for (int i = 1; i <= ActualSeries.data.Count - 1; i++)
                {
                    if (QuaterlyTotalRevenueList != null && QuaterlyTotalRevenueList.Count > 0 && QuaterlyProjectedList != null && QuaterlyProjectedList.Count > 0)
                    {
                        SumOfActualSeries = Convert.ToDecimal(QuaterlyTotalRevenueList[i - 1]) + Convert.ToDecimal(QuaterlyProjectedList[i - 1]);
                        Assert.AreEqual(Math.Round(Convert.ToDecimal(ActualSeries.data[i].ToString()), 2), Math.Round(SumOfActualSeries, 2));
                        Console.WriteLine("ReportController - GetRevenueData \n The assert value of quarterly actual revenue in graph " + QuarterList[i - 1] + " is " + ActualSeries.data[i].ToString() + ".");
                    }
                }
                for (int i = 1; i <= GoalSeries.data.Count - 1; i++)
                {
                    if (QuaterlyGoalList != null && QuaterlyGoalList.Count > 0)
                    {
                        SumOfGoalSeries = SumOfGoalSeries + Convert.ToDecimal(QuaterlyGoalList[i - 1]);
                        Assert.AreEqual(Math.Round(Convert.ToDecimal(GoalSeries.data[i].ToString()), 2), Math.Round(SumOfGoalSeries, 2));
                        Console.WriteLine("ReportController - GetRevenueData \n The assert value of quarterly goal in graph " + QuarterList[i - 1] + " is " + GoalSeries.data[i].ToString() + ".");
                    }
                }
                for (int i = 1; i <= ProjectedSeries.data.Count - 1; i++)
                {
                    decimal projectedSeries = 0;
                    if (QuaterlyProjectedList != null && QuaterlyProjectedList.Count > 0 && QuaterlyProjectedList[i - 1] != 0)
                    {
                        SumOfProjectedSeries = Convert.ToDecimal(QuaterlyTotalRevenueList[i - 1]) + Convert.ToDecimal(QuaterlyProjectedList[i - 1]);
                    }
                    if (ProjectedSeries.data[i].ToString() == "")
                    {
                        projectedSeries = 0;
                    }
                    else
                    {
                        projectedSeries = Convert.ToDecimal(ProjectedSeries.data[i].ToString());
                    }

                    Assert.AreEqual(Math.Round(Convert.ToDecimal(projectedSeries), 2), Math.Round(SumOfProjectedSeries, 2));
                    Console.WriteLine("ReportController - GetRevenueData \n The assert value of quarterly projected revenue in graph " + QuarterList[i - 1] + " is " + ProjectedSeries.data[i].ToString() + ".");
                }
                #endregion

                #region Graph for Tactic

                for (int i = 0; i <= QuaterlyTotalRevenueList.Count - 1; i++)
                {
                    if (QuaterlyTotalRevenueList != null && QuaterlyTotalRevenueList.Count > 0)
                    {
                        Assert.AreEqual(Math.Round(Convert.ToDecimal(tacticRevenueSeries.data[i].ToString()), 2), Math.Round(Convert.ToDecimal(QuaterlyTotalRevenueList[i]), 2));
                        Console.WriteLine("ReportController - GetRevenueData \n The assert value of quarterly tactic actual revenue in graph " + QuarterList[i] + " is " + tacticRevenueSeries.data[i].ToString() + ".");
                    }
                }

                for (int i = 0; i <= QuaterlyActualCostList.Count - 1; i++)
                {
                    if (QuaterlyActualCostList != null && QuaterlyActualCostList.Count > 0)
                    {
                        SumOfActualCostSeries = SumOfActualCostSeries + Convert.ToDecimal(QuaterlyActualCostList[i]);
                        Assert.AreEqual(Math.Round(Convert.ToDecimal(tacticCostSeries.data[i].ToString()), 2), Math.Round(SumOfActualCostSeries, 2));
                        Console.WriteLine("ReportController - GetRevenueData \n The assert value of quarterly tactic actual cost in graph " + QuarterList[i] + " is " + tacticCostSeries.data[i].ToString() + ".");
                    }
                }
                #endregion
            }
        }