public void Calculate()
        {
            if (IContext != null)
            {
                foreach (EmployeePlanningWeek epw in _listemployeesweek)
                {
                    IContext.WorkingModels.Calculate(epw);
                }
            }
            CalculateDaysSum();

            if (StoreWorldInfo != null)
            {
                StoreWorldInfo.SumHoursForNetPerformance = Summary.CountWorldPlanningHours;

                if (!IsCashDesk)
                {
                    StoreWorldPlanningInfo storeinfo = StoreWorldInfo as StoreWorldPlanningInfo;

                    Debug.Assert(storeinfo != null);

                    if (storeinfo != null)
                    {
                        storeinfo.Calculate(Summary.DaysSum);
                    }
                }
                else
                {
                    CashDeskPlanningInfo cashinfo = StoreWorldInfo as CashDeskPlanningInfo;
                    Debug.Assert(cashinfo != null);

                    if (cashinfo != null)
                    {
                        cashinfo.SumActualWorkingHours = SumWorkingHoursOfWeek;
                    }
                }
            }
        }
        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;
            }
        }