Example #1
0
        public object Any(StopScheduler request)
        {
            _logger.Log(EErrorType.Info, " ****** Call start: StopScheduler");

            StopSchedulerResponse response = new StopSchedulerResponse();

            try
            {
                TransferHeader(request, response);

                if (IsValidSessionToken(request))
                {
                    response.Success = Global.Scheduler.Stop();
                }
                else
                {
                    response.Success = false;
                    response.Errors.Add(new Error()
                    {
                        Code = EErrorCodes.InvalidSession, Type = EErrorType.Error, Message = "Invalid session token"
                    });
                }
            }
            catch (Exception ex)
            {
                _logger.Log(ex);
                response.Success = false;
                response.Errors.Add(new Error()
                {
                    Code    = EErrorCodes.GeneralError,
                    Type    = EErrorType.Error,
                    Message = string.Format("Unpexcted error: {0}", ex.Message)
                });
            }


            _logger.Log(EErrorType.Info, " ****** Call end: StopScheduler");
            return(response);
        }
 public void Handle(StopScheduler c)
 {
     _repository.Perform(c.Id, a => a.StopScheduler(c.Restart));
 }