public Result FinishGrabRequest(DbSession session, TGrabRequest request, EResultCode code, string message) { EProcessStatus status = EProcessStatus.Ready; switch (code) { case EResultCode.Success: status = EProcessStatus.Success; break; case EResultCode.Failure: status = EProcessStatus.Failure; break; case EResultCode.Error: status = EProcessStatus.Error; break; default: ExceptionHelper.DoWhileResultCodeHandlerNotImplemented(); break; } return(new Result() { ResultCode = request.Settle(session, status, message) ? EResultCode.Success : EResultCode.Failure, Message = message }); }
protected PostModule(IUnitOfWork unitOfWork, ICommandHandler <TMessage> commandHandler, string path, NHibernateUnitOfWork relationalUnitOfWork, EventDispatcher eventDispatcher) { this.unitOfWork = unitOfWork; this.commandHandler = commandHandler; this.relationalUnitOfWork = relationalUnitOfWork; this.eventDispatcher = eventDispatcher; this.RequiresAuthentication(); this.RequiresHttps(); Post[path] = _ => { CustomUserIdentity user = this.Context.CurrentUser as CustomUserIdentity; TMessage message = this.Bind <TMessage>(); message.UserId = user.Id; message.ProcessId = Guid.NewGuid(); EResultCode resultCode = default(EResultCode); unitOfWork.DoInTransaction(() => { resultCode = (EResultCode)commandHandler.Handle(message); }); relationalUnitOfWork.DoInTransaction(eventDispatcher.DispatchEvents); return(new Response() { StatusCode = (HttpStatusCode)resultCode, }); }; }
public ResponseData(EResponseType InType, String InBody) { Code = EResultCode.OK; Type = InType; Body = InBody; }
public ResponseData(EResponseType InType, EResultCode InCode) { Code = InCode; Type = InType; Body = ""; }
public ResponseData(EResponseType InType) { Code = EResultCode.Error; Type = InType; Body = ""; }