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); }
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; }
protected virtual void Process() { EstimatedHours.Clear(); EstimatedHours.Capacity = 370; TotalSum = 0; IList lst = ServerEnvironment.StoreToWorldService.GetEstimatedWorldWorkingHours(_begin, _end, _storeid, _worldid); if (lst != null) { TrendCorrectionHelper trendhelper = GetTrendHelper(); bool isExistsTrendCorrection = trendhelper.IsExistsForWorld(_storeworldid); decimal trendcorrection = 1; int value = 0; foreach (EstimatedWorldWorkingHours workinghours in lst) { EstimatedHours.Add(workinghours); if (isExistsTrendCorrection) { trendcorrection = Convert.ToDecimal(trendhelper.GetTrendCorrection(_storeworldid, workinghours.Date)); value = ConvertToMinutes(workinghours.WorkingHours * trendcorrection); } else { value = ConvertToMinutes(workinghours.WorkingHours); } ProcessValue(workinghours.Date, value); } } }
protected virtual TrendCorrectionHelper GetTrendHelper() { if (_trendhelper == null) { _trendhelper = new TrendCorrectionHelper(ServerEnvironment.TrendCorrectionService); _trendhelper.LoadByStoreAndDateRange(_storeid, _begin, _end); } return(_trendhelper); }
public virtual int Build(long storeid, long worldid, long storeworldid, DateTime beginWeek, DateTime endWeek) { if (_storeid != 0 && (_storeid != storeid || beginWeek != _begin || endWeek != _end)) { _trendhelper = null; } _storeid = storeid; _worldid = worldid; _storeworldid = storeworldid; _begin = beginWeek; _end = endWeek; Process(); return(TotalSum); }
protected virtual TrendCorrectionHelper GetTrendHelper() { if (_trendhelper == null) { _trendhelper = new TrendCorrectionHelper(ServerEnvironment.TrendCorrectionService); _trendhelper.LoadByStoreAndDateRange(_storeid, _begin, _end); } return _trendhelper; }
public virtual int Build(long storeid, long worldid, long storeworldid, DateTime beginWeek, DateTime endWeek) { if (_storeid != 0 && (_storeid != storeid || beginWeek != _begin || endWeek != _end)) _trendhelper = null; _storeid = storeid; _worldid = worldid; _storeworldid = storeworldid; _begin = beginWeek; _end = endWeek; Process(); return TotalSum; }
public void AssignTrendCorrecttionHelper(TrendCorrectionHelper trends) { _trendhelper = trends; }
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; //} }