Пример #1
0
        public void LoadEmployeePlanningAndRecording(StoreToWorld world)
        {
            _currentWorldID = 0;

            if (world != null)
            {
                _currentWorldID = world.WorldID;

                List <EmployeeWeek> planningWeeks = ClientEnvironment.EmployeeService.GetTimePlannignEmployeeByWorld2(StoreId, _currentWorldID, BeginWeekDate, EndWeekDate);
                Absences.FillEmployeeWeek(planningWeeks);
                _planningWorldState = new StoreWorldWeekState(world, BeginWeekDate, EndWeekDate);
                EmployeeWeekProcessor.MarkAsPlannedWeek(planningWeeks);

                if (planningWeeks != null)
                {
                    _planningWorldState.List.AddRange(planningWeeks);
                    foreach (EmployeeWeek ew in planningWeeks)
                    {
                        ew.InitWeekState();
                    }
                }

                _planningWorldState.Context = this;
                _planningWorldState.Calculate();

                planningWeeks = ClientEnvironment.EmployeeService.GetTimeRecordingEmployeeByWorld(StoreId, _currentWorldID, BeginWeekDate, EndWeekDate);
                Absences.FillEmployeeWeek(planningWeeks);
                _actualWorldState = new StoreWorldWeekState(world, BeginWeekDate, EndWeekDate);
                EmployeeWeekProcessor.MarkAsRecordingWeek(planningWeeks);
                if (planningWeeks != null)
                {
                    _actualWorldState.List.AddRange(planningWeeks);
                    foreach (EmployeeWeek ew in planningWeeks)
                    {
                        ew.InitWeekState();
                    }
                }

                _actualWorldState.Context = this;
                _actualWorldState.Calculate();
            }
        }
Пример #2
0
        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();
            }
        }