Ejemplo n.º 1
0
        public GetSaleByClassResponse Execute(GetSaleByClassRequest request)
        {
            getSaleByClassValidationActivity.Validate(request);
            List <Sale> sales = getSalesByClassActivity.Run(request.Class, DateTime.Parse(request.SinceDate), DateTime.Parse(request.ToDate));

            return(new GetSaleByClassResponse(sales));
        }
        public GetProductByDateResponse Execute(GetProductByDateRequest request)
        {
            getProductByDateValidationActivity.Validate(request);
            List <Product> products = getProductsByDateActivity.Run(DateTime.Parse(request.Date));

            return(new GetProductByDateResponse(products));
        }
Ejemplo n.º 3
0
 public EditUserResponseEvent Execute(EditUserRequestEvent request)
 {
     try
     {
         accessLevelValidationActivity.Validate(new AccessLevelCheckEvent(request.User, DAL.Core.Entity.Enums.AccessLevel.Administrator));
         editUserValidationActivity.Validate(request);
         request.User.Account = editAccountByRequest.Execute(new EditAccountRequestEvent(request.User.Account)).AccountDTO;
         return(editUserByRequest.Execute(request));
     }
     catch (SystemEditUserValidationException ex)
     {
         throw new SystemEditUserValidationException(ex.Message, ex);
     }
     catch (NullReferenceException ex)
     {
         throw new NullReferenceException(ex.Message, ex);
     }
     catch (OperationCanceledException ex)
     {
         throw new OperationCanceledException(ex.Message, ex);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }
Ejemplo n.º 4
0
 public EditAccountResponse Execute(EditAccountRequest request)
 {
     try
     {
         editAccountValidationActivity.Validate(request);
         Account account = editAccountActivity.Run(request.Id, request.LastName, request.FirstName, request.SecondName, request.Photo);
         return(new EditAccountResponse(account));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }
Ejemplo n.º 5
0
 public GetUserResponse Execute(GetUserRequest request)
 {
     try
     {
         enterValidationActivity.Validate(request);
         User user = getUserActivity.Run(request.Login, request.Password);
         return(new GetUserResponse(user));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }
Ejemplo n.º 6
0
 public GetReportDetailedResponse Execute(GetReportDetailedRequest request)
 {
     try
     {
         reportDetailedValidationActivity.Validate(request);
         List <ReportDetailed> reportDetaileds = getReportDetailedActivity.Run(request.Category, DateTime.Parse(request.SinceDate), DateTime.Parse(request.ToDate));
         return(new GetReportDetailedResponse(reportDetaileds));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }
 public GetReportSimpleResponse Execute(GetReportSimpleRequest request)
 {
     try
     {
         reportSimpleValidationActivity.Validate(request);
         List <ReportSimple> reportSimples = getReportSimpleActivity.Run(DateTime.Parse(request.SinceDate), DateTime.Parse(request.ToDate));
         return(new GetReportSimpleResponse(reportSimples));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }
Ejemplo n.º 8
0
 public EditNotesResponse Execute(EditNotesRequest request)
 {
     try
     {
         editNotesValidationActivity.Validate(request);
         editNotesActivity.Run(request.Id, request.Topic, request.Text, request.Date, request.Image, request.IdAccount);
         List <Notes> notes = getNotesActivity.Run(request.IdAccount);
         return(new EditNotesResponse(notes));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }
Ejemplo n.º 9
0
 public CreateAccountResponseEvent Execute(CreateAccountRequestEvent request)
 {
     try
     {
         _createAccountValidationActivity.Validate(request);
         return(this._request.Execute(request));
     }
     catch (SystemLoginValidationException ex)
     {
         throw new SystemCreateAccountValidationException(ex.Message, ex);
     }
     catch (MissingMemberException ex)
     {
         throw new MissingMemberException(ex.Message, ex);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }
Ejemplo n.º 10
0
        public AddSaleResponse Execute(AddSaleRequest request)
        {
            try
            {
                addSaleValidationActivity.Validate(request);
                addSaleActivity.Run(request.Product, int.Parse(request.Count), DateTime.Parse(request.DateTime), float.Parse(request.Price), request.Seller);
                List <Sale> sales = getSaleActivity.Run(request.Product.ArrivedGoods.Department);

                editProductActivity.Run(request.Product.Id, request.Product.Unit, request.Product.Category, request.Product.Class,
                                        request.Product.TareChange, (request.Product.Count - int.Parse(request.Count)), request.Product.ExpirationDate,
                                        request.Product.ArrivedGoods, request.Product.PurchasePrice, request.Product.SalesPrice, request.Product.Returned,
                                        request.Product.ReturnedDate, request.Product.WritenOff);
                List <Product> products = getProductActivity.Run(request.Product.ArrivedGoods.Department);

                return(new AddSaleResponse(sales, products));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Ejemplo n.º 11
0
 /// <summary>
 ///     Execute activities needed to log into the system
 /// </summary>
 /// <param name="request">EnterRequestEvent</param>
 /// <returns>User</returns>
 public EnterResponseEvent Execute(EnterRequestEvent request)
 {
     try
     {
         loginValidationActivity.Validate(request);
         var response = getUserByRequest.Execute(request);
         afterLoginValidationActivity.Validate(response);
         return(response);
     }
     catch (SystemEnterValidationException ex)
     {
         throw new SystemEnterValidationException(ex.Message, ex);
     }
     catch (MissingMemberException ex)
     {
         throw new MissingMemberException(ex.Message, ex);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }
Ejemplo n.º 12
0
        public AddProductGoodsResponse Execute(AddProductGoodsRequest request)
        {
            try
            {
                addProductGoodsValidationActivity.Validate(request);

                addArrivedGoodsActivity.Run(request.Provider, int.Parse(request.Count), DateTime.Parse(request.DateTime), float.Parse(request.AllPurchasePrice), float.Parse(request.AllSalesPrice), request.Department, request.Seller);
                List <ArrivedGoods> arrivedGoods = getArrivedGoodsActivity.Run(request.Department);

                var returnedDate = string.IsNullOrEmpty(request.ReturnedDate) ? (DateTime?)null : DateTime.Parse(request.ReturnedDate);

                addProductActivity.Run(request.Unit, request.Category, request.Class, request.TareChange, int.Parse(request.Count),
                                       DateTime.Parse(request.ExpirationDate), arrivedGoods[arrivedGoods.Count - 1], float.Parse(request.AllPurchasePrice) / float.Parse(request.Count),
                                       float.Parse(request.AllSalesPrice) / float.Parse(request.Count), request.Returned, returnedDate, request.WritenOff);
                List <Product> products = getProductActivity.Run(request.Department);

                return(new AddProductGoodsResponse(arrivedGoods, products));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Ejemplo n.º 13
0
 /// <summary>
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public EditNoteResponseEvent Execute(EditNoteRequestEvent request)
 {
     try
     {
         editNoteValidationActivity.Validate(request);
         return(editNoteByRequest.Execute(request));
     }
     catch (SystemEditNoteValidationException ex)
     {
         throw new SystemEditNoteValidationException(ex.Message, ex);
     }
     catch (NullReferenceException ex)
     {
         throw new NullReferenceException(ex.Message, ex);
     }
     catch (OperationCanceledException ex)
     {
         throw new OperationCanceledException(ex.Message, ex);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }