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;
                }
            }
        }
Ejemplo n.º 2
0
        public void UpdateActualSum(long storeid, DateTime monday)
        {
            Dictionary <long, int?> diction = WorldAvailableBufferHoursManager.LoadActualWorkingHours(storeid, monday);

            if (diction != null)
            {
                WorldAvailableBufferHoursManager manager = null;
                int?sum = null;
                foreach (long sw_id in diction.Keys)
                {
                    manager = GetManager(sw_id);

                    _diction.TryGetValue(sw_id, out manager);

                    if (manager != null)
                    {
                        sum = diction[sw_id];
                        if (sum.HasValue)
                        {
                            manager.UpdateActualSum(monday, sum.Value);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public WorldAvailableBufferHoursManager GetManager(long storeworldid)
        {
            WorldAvailableBufferHoursManager m = null;

            _diction.TryGetValue(storeworldid, out m);
            return(m);
        }
Ejemplo n.º 4
0
        protected void Init(List <StoreToWorld> worlds)
        {
            if (StoreId <= 0)
            {
                return;
            }

            List <StoreToWorld> lstWorlds = worlds;

            if (lstWorlds == null)
            {
                lstWorlds = new StoreWorldListSrv(StoreId);
            }

            WorldAvailableBufferHoursManager bhm = null;

            foreach (StoreToWorld sw in lstWorlds)
            {
                _diction[sw.ID] = new WorldAvailableBufferHoursManager(sw, Year);
            }

            List <BufferHourAvailable> lst = Service.GetAvailableBufferHoursForStore(StoreId, Year);

            if (lst != null && lst.Count > 0)
            {
                WorldAvailableBufferHoursManager m = null;
                foreach (BufferHourAvailable b in lst)
                {
                    if ((m != null && m.StoreWorld.ID == b.StoreWorldID) ||
                        (_diction.TryGetValue(b.StoreWorldID, out m)))
                    {
                        m.AddEntityToList(b);
                    }
                }
            }
            foreach (WorldAvailableBufferHoursManager manager in _diction.Values)
            {
                manager.CheckAndBuildAllYearEntity();
            }
        }
Ejemplo n.º 5
0
        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);
                        }
                    }
                }
            }
        }