Ejemplo n.º 1
0
        public void Load(ICanSupportAgentFinder model, Schedule schedule)
        {
            if (IsInitialized)
            {
                return;
            }

            _parentModel         = model;
            _schedule            = schedule;
            _excludedEmployeeIds = _parentModel.Agents.Cast <IAgent>().Select(o => o.Schedule.Id).ToArray();

            ExecuteManager.BackgroundAction(() =>
            {
                _seatBoxes = _seatDispatcherModel.GetSeats(_schedule, _excludedEmployeeIds,
                                                           out _otherAgents, out _areas)
                             .ToDictionary(o => o.Seat.Id.ToString(), o => o as IEnumerable);
                IsDirty = false;
                BuildSeatArrangement <TimeBox>(_otherAgents, o => o); // the agents which have seat but, not in the schedule
                BuildSeatArrangement <IAgent>(_parentModel.Agents, o => o.Schedule);

                this.NotifyOfPropertyChange("Areas");
                SelectedArea = _areas.FirstOrDefault();
            }, BeginLoading, EndLoading);

            base.OnInitialize();
            IsInitialized = true;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Helper method to encapsulate exception handling for WebAPI
 /// </summary>
 /// <typeparam name="TResult"></typeparam>
 /// <param name="code"></param>
 /// <returns></returns>
 protected TResult Execute <TResult>(Func <TResult> code)
 {
     try
     {
         if (CurrentUser != null)
         {
             using (var session = LoginUserSection.Start(CurrentUser))
             {
                 return(ExecuteManager.Execute(code));
             }
         }
         else
         {
             return(ExecuteManager.Execute(code));
         }
     }
     catch (UnauthorizedException e)
     {
         HttpResponseMessage response = this.Request.CreateErrorResponse(HttpStatusCode.Unauthorized, e.Message);
         throw new HttpResponseException(response);
     }
     catch (DomainException e)
     {
         HttpResponseMessage response = this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e.Message);
         throw new HttpResponseException(response);
     }
     catch (Exception)
     {
         HttpResponseMessage response = this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ErrorMessage.InternalServerError);
         throw new HttpResponseException(response);
     }
 }
Ejemplo n.º 3
0
 public void SubmitChangesFail(Exception ex)
 {
     ExecuteManager.BackgroundAction(this, () =>
     {
         ReloadAgents(null, ex);//also might include rtaa reload
         _changedAgents.Clear();
     }, () => { }, () => { });
 }
Ejemplo n.º 4
0
        public static void Authorize(string token, string language, BaseApiController controller)
        {
            ExecuteManager.Execute(() =>
            {
                var systemUser = ValidateToken(token);

                if (controller == null)
                {
                    return;
                }
                controller.CurrentUser = systemUser;
            });
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializating managers and uOw
 /// </summary>
 public TaskExecuter()
 {
     uOw               = new UnitOfWork();
     elasticuOw        = new ElasticUnitOfWork();
     parsermanager     = new ParserTaskManager(uOw);
     propmanager       = new PropertyManager(uOw);
     goodManager       = new GoodManager(uOw);
     urlManager        = new URLManager(uOw);
     htmlValidator     = new HtmlValidator();
     priceManager      = new PriceManager(uOw);
     elasticManager    = new ElasticManager(elasticuOw);
     goodwizardManager = new GoodDatabasesWizard(elasticuOw, uOw);
     taskinfoManager   = new ExecuteManager(uOw);
 }
        public void ReloadData()
        {
            ExecuteManager.BackgroundAction(() =>
            {
                foreach (var item in _seatDispatcherModel.GetSeats(_schedule, _excludedEmployeeIds, out _otherAgents, out _areas))
                {
                    _seatBoxes[item.Id.ToString()] = (IEnumerable)item;
                }

                IsDirty = false;
                BuildSeatArrangement <TimeBox>(_otherAgents, o => o);
                BuildSeatArrangement <IAgent>(_parentModel.Agents, o => o.Schedule);
                FilterSeats(SelectedArea);
            }, BeginLoading, EndLoading);
        }
 public void FastReloadData()
 {
     ExecuteManager.BackgroundAction(() =>
     {
         foreach (SeatBox seatBox in _seatBoxes.Values)
         {
             seatBox.Initial();
         }
         BuildSeatArrangement <TimeBox>(_otherAgents, o => o);
         BuildSeatArrangement <IAgent>(_parentModel.Agents, o => o.Schedule);
         var reselectSeat = RetainCurrentSelectedSeat();
         this.QuietlyReload(ref _bindableSeats, "BindableSeats");
         reselectSeat.Invoke();
     });
 }
Ejemplo n.º 8
0
        private bool ExecuteOrder(PushMsgModel pushMsgModel)
        {
            ADC_Status adcStatus  = new ADC_Status();
            ADCManager adcManager = new ADCManager();

            adcStatus.ADC_Index         = adcManager.CreateNewProcess(pushMsgModel);
            adcStatus.ADC_ProcessStatus = DefineManager.STATUS_CODE_RECEIVE_PUSH_MSG;

            ExecuteManager executeManager = new ExecuteManager();

            executeManager.pushMsgModel = pushMsgModel;
            executeManager.adcManager   = adcManager;
            executeManager.adcStatus    = adcStatus;

            adcManager.UpdateCurrentProcessStatus(adcStatus);

            return(executeManager.Execute());
        }