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; } } }
public WorldPlanningInfo GetStoreWorldPlanningInfo(bool IsPlanning, long storeid, long worldid, DateTime beginWeekDate) { StoreWorldEstimateInfoBuilder builderWorldInfo = new StoreWorldEstimateInfoBuilder(StoreService, this); builderWorldInfo.IsPlanning = IsPlanning; return(builderWorldInfo.GetWorldInfo(ExStoreToWorld.Get(storeid, worldid), beginWeekDate)); }
public void UpdatePlanningSum(long storeid, DateTime monday) { Dictionary <long, int?> diction = ExStoreToWorld.GetPlannedWorkingSumByStore(storeid, monday); if (diction != null) { WorldAvailableBufferHoursManager manager = null; int?sum = null; foreach (long sw_id in diction.Keys) { manager = GetManager(sw_id); if (manager != null) { sum = diction[sw_id]; if (sum.HasValue) { manager.UpdatePlanningSum(monday, sum.Value); } } } } }
public BufferHours ValidateAndUpdate(BufferHours entity) { ExStoreToWorld ex = new ExStoreToWorld(entity.StoreWorldID); if (ex.Entity != null) { bool bModified = false; BufferHours buffer = ex.BufferHours(entity.Year); if (buffer == null) { entity.ID = 0; entity.ValueWeek = BufferHours.GetWeekStepValue(entity); //Math.Round(entity.Value*60 / DateTimeHelper.GetCountWeekInYear(entity.Year)); bModified = true; } else { if (buffer.Value != entity.Value) { buffer.Value = entity.Value; buffer.ValueWeek = BufferHours.GetWeekStepValue(buffer); //Math.Round(buffer.Value * 60 / DateTimeHelper.GetCountWeekInYear(buffer.Year)); entity = buffer; bModified = true; } } //if (entity.IsNew) //{ // if (buffer == null) // { // bModified = true; // } // else // { // if (buffer.Value != entity.Value) // { // buffer.Value = entity.Value; // buffer.ValueWeek = Math.Round(buffer.ValueWeek / DateTimeHelper.GetCountWeekInYear(buffer.Year)); // entity = buffer; // bModified = true; // } // } //} //else //{ // if (buffer == null) // { // bModified = true; // } // else // { // if (buffer.Value != entity.Value) // { // buffer.Value = entity.Value; // buffer.ValueWeek = Math.Round(buffer.ValueWeek / DateTimeHelper.GetCountWeekInYear(buffer.Year)); // entity = buffer; // bModified = true; // } // } //} if (bModified) { SaveOrUpdate(entity); WorldAvailableBufferHoursManager world_availble_buffer_manager = new WorldAvailableBufferHoursManager(ex.Entity, entity.Year); world_availble_buffer_manager.Load(); world_availble_buffer_manager.CheckAndBuildAllYearEntity(); world_availble_buffer_manager.RecalculateAfterChangedBufferValue(); } return(entity); } return(null); }
private void LoadBufferHours() { BufferHours = ExStoreToWorld.GetBufferHours(StoreWorld, Year);//ServerEnvironment.BufferHoursService.GetBufferHours(StoreWorld.ID, (short)Year); CheckBufferHours(); }