Пример #1
0
        public ShiftDispatcherPresenter(IShiftDispatcherModel shiftDispatcherModel, ILaborHoursCountingModel laborHoursCountingModel)
        {
            CurrentIndex = -1;

            _shiftDispatcherModel    = shiftDispatcherModel;
            _laborHoursCountingModel = laborHoursCountingModel;
            _blockConverter          = new DefalutBlockConverter();


            AdherenceBlockConverter = new AdherenceBlockConverter();
            AdherenceBlockConverter.BlockChanged += OnAdhEventBlockChanged;

            _sortDelegate = new Action(() => Sort(GetWatchPoint(), GetWatchPoint().AddDays(1)));
        }
Пример #2
0
        protected override void OnShutdown()
        {
            if (_uiRefresh != null)
            {
                _uiRefresh.GetInvocationList().ForEach(o =>
                {
                    _uiRefresh -= o as Action;
                });
            }

            if (_refresh != null)
            {
                _refresh.GetInvocationList().ForEach(o =>
                {
                    _refresh -= o as Action <IEnumerable>;
                });
            }

            if (_seatDispatcherPresenter != null)
            {
                RunSeatDispatcher(_seatDispatcherPresenter.Target.As <IPresenter>());
            }


            _shiftDispatcherModel.Release();
            ((IDisposable)_shiftDispatcherModel).Dispose();
            _shiftDispatcherModel = null;

            _laborHoursCountingModel.SaftyInvoke <IDisposable>(o => o.Dispose());
            _laborHoursCountingModel = null;

            ApplicationCache.Remove(_schedule);

            if (_blockConverter != null)
            {
                _blockConverter.Dispose();
            }
            _blockConverter = null;

            AdherenceBlockConverter.Dispose();
            AdherenceBlockConverter = null;


            if (this._attendances != null)
            {
                this._attendances.Clear();
                this._attendances = null;
            }
            if (this._agentAdherences != null)
            {
                this._agentAdherences.Clear();
                this._agentAdherences = null;
            }
            if (this._bindableAgents != null)
            {
                this._bindableAgents.Clear();
                this._bindableAgents = null;
            }
            if (this._changedAgents != null)
            {
                this._changedAgents.Clear();
                this._changedAgents = null;
            }
            this._refresh                 = null;
            this._sortDelegate            = null;
            this._uiRefresh               = null;
            this._buildSeatDispatcher     = null;
            this._destroySeatDispatcher   = null;
            this._seatDispatcherPresenter = null;
            this._schedule                = null;
            this._selectedAgent           = null;

            _buildStaffingChart = null;

            if (_staffingCalculatorArgs != null)
            {
                _staffingCalculatorArgs.Clear();
            }
            _staffingCalculatorArgs = null;

            if (_staffingCalculatorService != null)
            {
                _staffingCalculatorService.Shutdown();
            }
            _staffingCalculatorService = null;

            FullyRefresh = null;

            if (this._timer != null)
            {
                _timer.Stop();
                _timer = null;
            }

            base.OnShutdown();
        }