コード例 #1
0
        public RequestApproved CloseRequest(RequestApproved request)
        {
            request = GetRequestApproved(request);

            if (request.IsReturned)
            {
                throw new Exception("Книга уже возвращена");
            }

            var returnBook = Ninject.Get <UpdateBooksQuantityQuery>();

            returnBook.Book         = request.Id.Book;
            returnBook.BookQuantity = request.Id.BookQuantity;

            var closeRequest = Ninject.Get <CloseRequestQuery>();

            closeRequest.RequestApproved = request;

            var executor = Ninject.Get <Executor>();

            try {
                executor.ExecuteNonQueries(new NoValueQuery[] {
                    returnBook,
                    closeRequest
                });
                request.IsReturned = true;
            } catch (Exception exc) {
                throw exc;
            }
            return(request);
        }
コード例 #2
0
        public RequestApproved CloseRequest(RequestApproved request)
        {
            request = GetRequestApproved(request);

            if (request.IsReturned) {
                throw new Exception("Книга уже возвращена");
            }

            var returnBook = Ninject.Get<UpdateBooksQuantityQuery>();
            returnBook.Book = request.Id.Book;
            returnBook.BookQuantity = request.Id.BookQuantity;

            var closeRequest = Ninject.Get<CloseRequestQuery>();
            closeRequest.RequestApproved = request;

            var executor = Ninject.Get<Executor>();
            try {
                executor.ExecuteNonQueries(new NoValueQuery[]{
                    returnBook,
                    closeRequest
                });
                request.IsReturned = true;
            } catch (Exception exc) {
                throw exc;
            }
            return request;
        }
コード例 #3
0
        //public IEnumerable<RequestApproved> GetApprovedRequests(RequestHeader request) {
        //    var query = Ninject.Get<GetApprovedRequestsQuery>();
        //    query.Request = request;
        //    return query.Execute();
        //}

        //public IEnumerable<RequestRejected> GetRejectedRequests(RequestHeader request) {
        //    var query = Ninject.Get<GetRejectedRequestsQuery>();
        //    query.Request = request;
        //    return query.Execute();
        //}

        public RequestApproved RenewRequest(RequestApproved request)
        {
            request = GetRequestApproved(request);

            if (request.IsReturned)
            {
                throw new Exception("Книга уже возвращена. Продление невозможно");
            }

            if (DateTime.Now.Date <= request.ReturnDate.Date)
            {
                throw new Exception("Срок возврата еще не истек. Продление невозможно");
            }

            var command = Ninject.Get <RenewRequestQuery>();

            command.RequestApproved = request;
            try {
                command.Execute();
            } catch (DbException exc) {
                throw new Exception("Достигнут предел числа продлений. Дальнейшее продление невозможно");
            }
            return(request);
        }
コード例 #4
0
        public async Task ApproveRequest(int id)
        {
            var approved = new RequestApproved(id);

            await _getStore().WriteEvent(approved, Streams.UtoRequests);
        }
コード例 #5
0
 protected RequestApproved GetRequestApproved(RequestApproved source)
 {
     return GetApprovedRequests(source.Id.Id.Reader.Card).FirstOrDefault(s => s.Id.Equals(source.Id));
 }
コード例 #6
0
        //public IEnumerable<RequestApproved> GetApprovedRequests(RequestHeader request) {
        //    var query = Ninject.Get<GetApprovedRequestsQuery>();
        //    query.Request = request;
        //    return query.Execute();
        //}
        //public IEnumerable<RequestRejected> GetRejectedRequests(RequestHeader request) {
        //    var query = Ninject.Get<GetRejectedRequestsQuery>();
        //    query.Request = request;
        //    return query.Execute();
        //}
        public RequestApproved RenewRequest(RequestApproved request)
        {
            request = GetRequestApproved(request);

            if (request.IsReturned) {
                throw new Exception("Книга уже возвращена. Продление невозможно");
            }

            if (DateTime.Now.Date <= request.ReturnDate.Date) {
                throw new Exception("Срок возврата еще не истек. Продление невозможно");
            }

            var command = Ninject.Get<RenewRequestQuery>();
            command.RequestApproved = request;
            try {
                command.Execute();
            } catch (DbException exc) {
                throw new Exception("Достигнут предел числа продлений. Дальнейшее продление невозможно");
            }
            return request;
        }
コード例 #7
0
 protected RequestApproved GetRequestApproved(RequestApproved source)
 {
     return(GetApprovedRequests(source.Id.Id.Reader.Card).FirstOrDefault(s => s.Id.Equals(source.Id)));
 }
コード例 #8
0
 public RequestApproved CloseRequest(RequestApproved request)
 {
     return(ExecuteScoped(() => Channel.CloseRequest(request)));
 }
コード例 #9
0
 public RequestApproved RenewRequest(RequestApproved request)
 {
     return(ExecuteScoped(() => Channel.RenewRequest(request)));
 }
コード例 #10
0
ファイル: RequestPage.cs プロジェクト: BlackieLawless/Library
 public RequestApprovedWrap(RequestApproved request)
 {
     Request = request;
 }
コード例 #11
0
ファイル: RequestPage.cs プロジェクト: BlackieLawless/Library
 Task <RequestApproved> CloseRequest(RequestApproved request)
 {
     return(Task.Factory.StartNew(() => GetProxy().CloseRequest(request)));
 }
コード例 #12
0
ファイル: RequestPage.cs プロジェクト: BlackieLawless/Library
 Task <RequestApproved> RenewalRequest(RequestApproved request)
 {
     return(Task.Factory.StartNew(() => GetProxy().RenewRequest(request)));
 }