コード例 #1
0
ファイル: IGrabConfig.cs プロジェクト: vlong638/VL.Business
        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
            });
        }
コード例 #2
0
        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,
                });
            };
        }
コード例 #3
0
 public ResponseData(EResponseType InType, String InBody)
 {
     Code = EResultCode.OK;
     Type = InType;
     Body = InBody;
 }
コード例 #4
0
 public ResponseData(EResponseType InType, EResultCode InCode)
 {
     Code = InCode;
     Type = InType;
     Body = "";
 }
コード例 #5
0
 public ResponseData(EResponseType InType)
 {
     Code = EResultCode.Error;
     Type = InType;
     Body = "";
 }