public void BuildNewWeekWorldPlanningList() { _dictionStoreWorldStates.Clear(); if (ListStoreWorlds != null) { List <EmployeePlanningWeek> lst = null; StoreWorldWeekPlanningState state = null; foreach (StoreToWorld stw in ListStoreWorlds) { lst = PlanningWeekProcessor.GetEmployeesByWorld(stw.ID, PlanningEmployees); state = new StoreWorldWeekPlanningState(stw.ID, BeginTime, EndTime); state.IContext = this; if (lst != null) { state.List.AddRange(lst); } _dictionStoreWorldStates[stw.WorldID] = state; WorldPlanningInfo infoworld = ClientEnvironment.StoreService.StoreToWorldService.GetStoreWorldPlanningInfo(true, CurrentStoreId, stw.WorldID, BeginTime); state.StoreWorldInfo = infoworld; } } }
private void FillCommonInfoForWorld(WorldPlanningInfo worldinfo, StoreToWorld storeworld, DateTime begin, DateTime end) { short year = (short)DateTimeHelper.GetYearByDate(begin); PersonMinMax personMinMax = ExStoreToWorld.GetPersonMinMax(storeworld, year); WorldAvailableBufferHoursManager availBufferHours = new WorldAvailableBufferHoursManager(storeworld, begin); AvgAmount avgamount = _avgamountservice.GetAvgAmountByYear(CountryId, year); worldinfo.StoreWorldId = storeworld.ID; if (personMinMax != null) { worldinfo.MinimumPresence = personMinMax.Min; worldinfo.MaximumPresence = personMinMax.Max; } if (availBufferHours.BufferHours != null && availBufferHours.BufferHours.Value != 0) { worldinfo.AvailableWorldBufferHours = Convert.ToInt32(availBufferHours.GetPrevAvailableBufferForWeek(begin) + availBufferHours.BufferHoursPerWeek); } else { worldinfo.AvailableWorldBufferHours = Int32.MinValue; } if (!worldinfo.IsCashDesk) { Benchmark benchmark = ExStoreToWorld.GetBenchmark(storeworld, year);//_benchmarkservice.GetBenchmark(storeworld.ID, year); if (benchmark != null) { worldinfo.Benchmark = benchmark.Value; } } }
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 LoadEmployeePlanningAndRecording(bool bLoadStoreDays) { ClearContext(); if (bLoadStoreDays) { LoadStoreDayInfo(); } ErrorCode = ErrorCodes.Empty; if (m_storedays.IsUndefined()) { ErrorCode |= ErrorCodes.NotExistsOpenTime; } if (m_storedays.AvgDayInWeek == 0) { ErrorCode |= ErrorCodes.NotExistsAvgDaysPerWeek; } if (ErrorCodes.Empty != ErrorCode) { ProcessError(); return; } if (CurrentStoreWorld != null) { List <EmployeeWeek> planningweeks = _EmployeeService.GetTimePlannignEmployeeByWorld2(StoreId, WorldId, BeginWeekDate, EndWeekDate); EmployeeWeekProcessor.MarkAsPlannedWeek(planningweeks); Absences.FillEmployeeWeek(planningweeks); _PlanningWorldState = new StoreWorldWeekState(CurrentStoreWorld, BeginWeekDate, EndWeekDate); if (planningweeks != null) { _PlanningWorldState.List.AddRange(planningweeks); foreach (EmployeeWeek ew in planningweeks) { ew.InitWeekState(); } } _PlanningWorldState.Context = this; _PlanningWorldState.Calculate(); planningweeks = _EmployeeService.GetTimeRecordingEmployeeByWorld(StoreId, WorldId, BeginWeekDate, EndWeekDate); EmployeeWeekProcessor.MarkAsRecordingWeek(planningweeks); Absences.FillEmployeeWeek(planningweeks); _ActualWorldState = new StoreWorldWeekState(CurrentStoreWorld, BeginWeekDate, EndWeekDate); if (planningweeks != null) { _ActualWorldState.List.AddRange(planningweeks); foreach (EmployeeWeek ew in planningweeks) { ew.InitWeekState(); } } _ActualWorldState.PlannedWorld = false; _ActualWorldState.Context = this; _ActualWorldState.Calculate(); WorldPlanningInfo infoworld = _StoreService.StoreToWorldService.GetStoreWorldPlanningInfo(false, StoreId, WorldId, BeginWeekDate); _ActualWorldState.StoreWorldInfo = infoworld; _PlanningWorldState.StoreWorldInfo = infoworld; FillRecordingWorldInfoFromPlanningInfo(); Modified = false; OnChangedContext(); } }