private void UpdateDifference() { if (Context != null && Context.WeeklyWorldState != null && Context.WeeklyWorldState.StoreWorldInfo != null) { if (!Context.WeeklyWorldState.StoreWorldInfo.IsCashDesk) { lblDifference.Visible = true; StoreWorldPlanningInfo stinfo = Context.WeeklyWorldState.StoreWorldInfo as StoreWorldPlanningInfo; if (stinfo != null) { int targetedHour = stinfo.GetTargetValue(ViewDate.DayOfWeek); int plannedHour = m_dailyView.TotalPlannedWorkingHours; int diff = plannedHour - targetedHour; double diffPercent = (targetedHour != 0)?(100 / (double)targetedHour) * plannedHour - 100:0; lblDifference.Text = GetLocalized("Difference") + " " + String.Format("{0} / {1:F2}%", TextParser.TimeToString(diff), diffPercent); } } else { lblDifference.Visible = false; } } }
protected void UpdatePersonMinMaxInfo() { if (Context == null) { ClearWorldInfo(); } else { if (Context.WeeklyWorldState != null && Context.WeeklyWorldState.StoreWorldInfo != null) { WorldPlanningInfo winfo = Context.WeeklyWorldState.StoreWorldInfo; if (winfo.IsCashDesk) { panelControlWorldInfo.Visible = false; } else { panelControlWorldInfo.Visible = true; lblMinimumPresence.Text = GetLocalized("MinimumPresence") + " " + winfo.MinimumPresence.ToString(); lblMaximumPresence.Text = GetLocalized("MaximumPresence") + " " + winfo.MaximumPresence.ToString(); StoreWorldPlanningInfo stinfo = winfo as StoreWorldPlanningInfo; lblTargetedHours.Text = GetLocalized("TargetedHours") + " " + TextParser.TimeToString(stinfo.GetTargetValue(ViewDate.DayOfWeek)); } } else { ClearWorldInfo(); } } }
private void FillStoreWorldEstimateData(StoreWorldPlanningInfo worldinfo, StoreToWorld storeworld, DateTime begin, DateTime end) { //IList lst = _storetoworldservice.GetEstimatedWorldWorkingHours(begin, end, storeworld.StoreID, storeworld.WorldID); //if (lst != null) //{ // if (_trendhelper == null) // { // _trendhelper = new TrendCorrectionHelper(_storeservice.TrendCorrectionService); // _trendhelper.LoadByStoreAndDateRange(storeworld.StoreID, begin, end); // } // bool isExistsTrendCorrection = _trendhelper.IsExistsForWorld(storeworld.ID); // decimal trendcorrection = 1; // foreach (EstimatedWorldWorkingHours workinghours in lst) // { // if (isExistsTrendCorrection) // { // trendcorrection = Convert.ToDecimal(_trendhelper.GetTrendCorrection(storeworld.ID, workinghours.Date)); // worldinfo.SetTargetedHoursByDate(workinghours.Date, (int)(workinghours.WorkingHours * 60 * trendcorrection)); // } // else // worldinfo.SetTargetedHoursByDate(workinghours.Date, (int)(workinghours.WorkingHours * 60)); // } //} WeeklyEstimatedWorldHoursBuilder estimateLoader = new WeeklyEstimatedWorldHoursBuilder(); estimateLoader.AssignTrendCorrecttionHelper(_trendhelper); int[] days = estimateLoader.BuildWeek(storeworld, begin); worldinfo.SetTargetedHours(days); //if (lst != null && estimateLoader.EstimatedHours != null) //{ // if (lst.Count == estimateLoader.EstimatedHours.Count) // { // for (int i = 0; i < 7; i++) // { // Debug.Assert(worldinfo.TargetedHours[i] == days[i]); // } // } //} }
public WorldPlanningInfo GetWorldInfo(StoreToWorld storeworld, DateTime beginWeekDate) { Debug.Assert(beginWeekDate.DayOfWeek == DayOfWeek.Monday); if (storeworld == null) { throw new ArgumentException(); } StoreId = storeworld.StoreID; if (storeworld.WorldTypeID == WorldType.CashDesk) { return(GetCashDeskInfo(storeworld, beginWeekDate)); } else { DateTime endWeekDate = DateTimeHelper.GetSunday(beginWeekDate); StoreWorldPlanningInfo worldinfo = new StoreWorldPlanningInfo(); worldinfo.StoreWorldId = storeworld.ID; FillCommonInfoForWorld(worldinfo, storeworld, beginWeekDate, endWeekDate); IList listSums = _storetoworldservice.GetBusinessVolumes(IsPlanning, beginWeekDate, endWeekDate, storeworld.StoreID, storeworld.WorldID); if (listSums != null && listSums.Count == 1) { BusinessVolumeTargActSum targsum = listSums[0] as BusinessVolumeTargActSum; if (targsum != null) { worldinfo.TargetedNetPerformancePerHour = targsum.VolumeBC; } } // for recording don't need load estimated (targeted hours) // will be used hours from planning if (IsPlanning) { FillStoreWorldEstimateData(worldinfo, storeworld, beginWeekDate, endWeekDate); } return(worldinfo); } }
private void FillRecordingWorldInfoFromPlanningInfo() { if (_PlanningWorldState != null && _ActualWorldState != null && _ActualWorldState.StoreWorldInfo != null) { int[] dayssum = _PlanningWorldState.GetSums(); if (!_ActualWorldState.IsCashDesk) //StoreWorldInfo.IsCashDesk) { StoreWorldPlanningInfo commonworld = _ActualWorldState.StoreWorldInfo as StoreWorldPlanningInfo; if (commonworld != null && dayssum != null) { commonworld.SetTargetedHours(dayssum); } } else { } } }