コード例 #1
0
        protected SalesForecastViewModel()
        {
            RequestData("YTDSalesVolume", x => x.GetTotalSalesByRange(DateTimeUtils.GetYtdRange()).TotalCost, x => {
                var YTDSalesVolume = x;
                YTDSalesForecast   = SalesForecastMaker.GetYtdForecast(YTDSalesVolume);
            });

            DecimalRange badSalesRange    = SalesRangeProvider.GetBadSalesRange();
            DecimalRange normalSalesRange = SalesRangeProvider.GetNormalSalesRange();
            DecimalRange goodSalesRange   = SalesRangeProvider.GetGoodSalesRange();

            AnnualSalesFirstRangeEnd  = badSalesRange.End;
            AnnualSalesSecondRangeEnd = normalSalesRange.End;
            AnnualSalesThirdRangeEnd  = goodSalesRange.End;
        }
        protected AnnualSalesPerformanceViewModel(DateTime date)
        {
            DecimalRange badSalesRange    = SalesRangeProvider.GetBadSalesRange();
            DecimalRange normalSalesRange = SalesRangeProvider.GetNormalSalesRange();
            DecimalRange goodSalesRange   = SalesRangeProvider.GetGoodSalesRange();

            AnnualSalesFirstRangeEnd  = badSalesRange.End;
            AnnualSalesSecondRangeEnd = normalSalesRange.End;
            AnnualSalesThirdRangeEnd  = goodSalesRange.End;
            if (DateTimeUtils.IsCurrentYear(date))
            {
                VolumeHeader = "YEAR TO DATE";
                RequestData("Volume", x => x.GetTotalSalesByRange(DateTimeUtils.GetYtdRange()).TotalCost, x => Volume = x);
            }
            else
            {
                VolumeHeader = "YEAR " + date.Year;
                RequestData("Volume", x => x.GetTotalSalesByRange(DateTimeUtils.GetYearRange(date)).TotalCost, x => Volume = x);
            }
        }