Exemplo n.º 1
0
 public void VerifyMonthlyGraphValue(lineChartData objlineChartData, DataTable dt, List <double> ProjectedList)
 {
     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;
         if (dt.Rows[3] != null)
         {
             for (int i = 1; i <= dt.Columns.Count - 1; i++)
             {
                 SumOfActualSeries = SumOfActualSeries + Convert.ToDecimal(dt.Rows[3].ItemArray[i].ToString()) + Convert.ToDecimal(ProjectedList[i - 1]);
                 Assert.AreEqual(Math.Round(Convert.ToDecimal(ActualSeries.data[i + 1].ToString()), 2), Math.Round(SumOfActualSeries, 2));
                 Console.WriteLine("ReportController - GetRevenueData \n The assert value of actual revenue in graph " + MonthList[i - 1] + " is " + ActualSeries.data[i + 1].ToString() + ".");
             }
         }
         if (GoalAmount != 0)
         {
             decimal goal = 0;
             for (int i = 2; i <= GoalSeries.data.Count - 1; i++)
             {
                 if (i - 1 >= NewStartDate.Month && i - 1 <= NewEndDate.Month)
                 {
                     goal = goal + GoalAmount;
                     Assert.AreEqual(Math.Round(Convert.ToDecimal(GoalSeries.data[i].ToString()), 2), Math.Round(goal, 2));
                     Console.WriteLine("ReportController - GetRevenueData \n The assert value of goal in graph " + MonthList[i - 2] + " is " + GoalSeries.data[i].ToString() + ".");
                 }
                 else
                 {
                     Assert.AreEqual(GoalSeries.data[i].ToString(), "0");
                     Console.WriteLine("ReportController - GetRevenueData \n The assert value of goal in graph " + MonthList[i - 2] + " is " + GoalSeries.data[i].ToString() + ".");
                 }
             }
         }
         for (int i = 2; i <= ProjectedSeries.data.Count - 1; i++)
         {
             decimal projectedData = 0; decimal projected = 0;
             if (ProjectedSeries.data[i].ToString() != null)
             {
                 projectedData = Convert.ToDecimal(ProjectedSeries.data[i]);
                 if (currentMonth > i - 1)
                 {
                     projected = Convert.ToDecimal(ProjectedList[i - 2]);
                 }
                 else
                 {
                     projected = Convert.ToDecimal(ProjectedList[i - 2]) + Convert.ToDecimal(TotalRevenueList[i - 2].ToString());
                 }
             }
             Assert.AreEqual(Math.Round(projectedData, 2), Math.Round(projected, 2));
             Console.WriteLine("ReportController - GetRevenueData \n The assert value of projected revenue in graph " + MonthList[i - 2] + " is " + projectedData.ToString() + ".");
         }
     }
 }
Exemplo n.º 2
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;
            }
        }
Exemplo n.º 3
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
            }
        }