public int Build(long storeid, long worldid, long storeworldid, DateTime beginWeek, DateTime endWeek)
        {
            int result = 0;

            IList lst = ServerEnvironment.StoreToWorldService.GetEstimatedWorldWorkingHours(beginWeek, endWeek, storeid, worldid);

            if (lst != null)
            {
                if (trendhelper == null)
                {
                    trendhelper = new TrendCorrectionHelper(ServerEnvironment.TrendCorrectionService);

                    trendhelper.LoadByStoreAndDateRange(storeid, beginWeek, endWeek);
                }
                bool isExistsTrendCorrection = trendhelper.IsExistsForWorld(storeworldid);

                decimal trendcorrection = 1;

                foreach (EstimatedWorldWorkingHours workinghours in lst)
                {
                    if (isExistsTrendCorrection)
                    {
                        trendcorrection = Convert.ToDecimal(trendhelper.GetTrendCorrection(storeworldid, workinghours.Date));

                        result += ConvertToMinutes(workinghours.WorkingHours * trendcorrection);
                    }
                    else
                        result += ConvertToMinutes(workinghours.WorkingHours);
                }
            }
            return result;
        }
Exemple #2
0
        public int Build(long storeid, long worldid, long storeworldid, DateTime beginWeek, DateTime endWeek)
        {
            int result = 0;

            IList lst = ServerEnvironment.StoreToWorldService.GetEstimatedWorldWorkingHours(beginWeek, endWeek, storeid, worldid);

            if (lst != null)
            {
                if (trendhelper == null)
                {
                    trendhelper = new TrendCorrectionHelper(ServerEnvironment.TrendCorrectionService);

                    trendhelper.LoadByStoreAndDateRange(storeid, beginWeek, endWeek);
                }
                bool isExistsTrendCorrection = trendhelper.IsExistsForWorld(storeworldid);

                decimal trendcorrection = 1;

                foreach (EstimatedWorldWorkingHours workinghours in lst)
                {
                    if (isExistsTrendCorrection)
                    {
                        trendcorrection = Convert.ToDecimal(trendhelper.GetTrendCorrection(storeworldid, workinghours.Date));

                        result += ConvertToMinutes(workinghours.WorkingHours * trendcorrection);
                    }
                    else
                    {
                        result += ConvertToMinutes(workinghours.WorkingHours);
                    }
                }
            }
            return(result);
        }
Exemple #3
0
 protected virtual TrendCorrectionHelper GetTrendHelper()
 {
     if (_trendhelper == null)
     {
         _trendhelper = new TrendCorrectionHelper(ServerEnvironment.TrendCorrectionService);
         _trendhelper.LoadByStoreAndDateRange(_storeid, _begin, _end);
     }
     return(_trendhelper);
 }
 protected virtual TrendCorrectionHelper GetTrendHelper()
 {
     if (_trendhelper == null)
     {
         _trendhelper = new TrendCorrectionHelper(ServerEnvironment.TrendCorrectionService);
         _trendhelper.LoadByStoreAndDateRange(_storeid, _begin, _end);
     }
     return _trendhelper;
 }
        private void FillCashDeskEstimateData(CashDeskPlanningInfo cashdesk, StoreToWorld storeworld, DateTime begin, DateTime end)
        {
            Debug.Assert(cashdesk != null);
            Debug.Assert(begin < end);
            Debug.Assert(begin.DayOfWeek == DayOfWeek.Monday);
            Debug.Assert(end.DayOfWeek == DayOfWeek.Sunday);

            if (cashdesk == null)
                return;

            if (_trendhelper == null)
            {
                _trendhelper = new TrendCorrectionHelper(_storeservice.TrendCorrectionService);
                _trendhelper.LoadByStoreAndDateRange(storeworld.StoreID, begin, end);
            }

            bool isExistsTrendCorrection = _trendhelper.IsExistsForWorld(storeworld.ID);
            decimal trendcorrection = 1;

            IList lst = _storetoworldservice.GetCashDeskPeopleEstimated(begin, end, storeworld.StoreID);

            if (lst != null)
            {
                foreach (CashDeskPeoplePerHourEstimateShort cashdeskitem in lst)
                {
                    if (isExistsTrendCorrection)
                    {
                        trendcorrection = Convert.ToDecimal(_trendhelper.GetTrendCorrection(storeworld.ID, cashdeskitem.Date));
                        cashdeskitem.PeoplePerHour = Convert.ToInt16(cashdeskitem.PeoplePerHour * trendcorrection);
                        cashdeskitem.TargReceiptsPerHour = cashdeskitem.TargReceiptsPerHour * trendcorrection;
                        cashdesk.AddCashDeskItem(cashdeskitem);
                    }
                    else
                    {
                        cashdesk.AddCashDeskItem(cashdeskitem);
                    }
                }
            }

            EstimatedWorldHoursBuilder2 estimatedHoursLoader = new EstimatedWorldHoursBuilder2();
            estimatedHoursLoader.AssignTrendCorrecttionHelper(_trendhelper);

            cashdesk.SumPlannedWorkingHours = estimatedHoursLoader.Build(storeworld, begin, end);

            //IList list = _storetoworldservice.GetEstimatedWorldWorkingHours(begin, end, storeworld.StoreID, storeworld.WorldID);
            //if (list != null)
            //{
            //    int totalTime = 0;
            //    foreach (EstimatedWorldWorkingHours workinghours in list)
            //    {
            //        if (isExistsTrendCorrection)
            //        {
            //            trendcorrection = Convert.ToDecimal(_trendhelper.GetTrendCorrection(storeworld.ID, workinghours.Date));
            //        }
            //        totalTime += (int)(workinghours.WorkingHours * 60 * trendcorrection);
            //    }

            //    cashdesk.SumPlannedWorkingHours = totalTime;
            //}
        }
        private void FillCashDeskEstimateData(CashDeskPlanningInfo cashdesk, StoreToWorld storeworld, DateTime begin, DateTime end)
        {
            Debug.Assert(cashdesk != null);
            Debug.Assert(begin < end);
            Debug.Assert(begin.DayOfWeek == DayOfWeek.Monday);
            Debug.Assert(end.DayOfWeek == DayOfWeek.Sunday);

            if (cashdesk == null)
            {
                return;
            }

            if (_trendhelper == null)
            {
                _trendhelper = new TrendCorrectionHelper(_storeservice.TrendCorrectionService);
                _trendhelper.LoadByStoreAndDateRange(storeworld.StoreID, begin, end);
            }

            bool    isExistsTrendCorrection = _trendhelper.IsExistsForWorld(storeworld.ID);
            decimal trendcorrection         = 1;

            IList lst = _storetoworldservice.GetCashDeskPeopleEstimated(begin, end, storeworld.StoreID);

            if (lst != null)
            {
                foreach (CashDeskPeoplePerHourEstimateShort cashdeskitem in lst)
                {
                    if (isExistsTrendCorrection)
                    {
                        trendcorrection                  = Convert.ToDecimal(_trendhelper.GetTrendCorrection(storeworld.ID, cashdeskitem.Date));
                        cashdeskitem.PeoplePerHour       = Convert.ToInt16(cashdeskitem.PeoplePerHour * trendcorrection);
                        cashdeskitem.TargReceiptsPerHour = cashdeskitem.TargReceiptsPerHour * trendcorrection;
                        cashdesk.AddCashDeskItem(cashdeskitem);
                    }
                    else
                    {
                        cashdesk.AddCashDeskItem(cashdeskitem);
                    }
                }
            }

            EstimatedWorldHoursBuilder2 estimatedHoursLoader = new EstimatedWorldHoursBuilder2();

            estimatedHoursLoader.AssignTrendCorrecttionHelper(_trendhelper);

            cashdesk.SumPlannedWorkingHours = estimatedHoursLoader.Build(storeworld, begin, end);


            //IList list = _storetoworldservice.GetEstimatedWorldWorkingHours(begin, end, storeworld.StoreID, storeworld.WorldID);
            //if (list != null)
            //{
            //    int totalTime = 0;
            //    foreach (EstimatedWorldWorkingHours workinghours in list)
            //    {
            //        if (isExistsTrendCorrection)
            //        {
            //            trendcorrection = Convert.ToDecimal(_trendhelper.GetTrendCorrection(storeworld.ID, workinghours.Date));
            //        }
            //        totalTime += (int)(workinghours.WorkingHours * 60 * trendcorrection);
            //    }

            //    cashdesk.SumPlannedWorkingHours = totalTime;
            //}
        }