Beispiel #1
0
        public CreatePosReceiptOfDeliveryResponse CreatePosReceiptOfDelivery(CreatePosReceiptOfDeliveryRequest request)
        {
            CreatePosReceiptOfDeliveryResponse response = new CreatePosReceiptOfDeliveryResponse();
            PosReceiptOfDelivery posReceiptOfDelivery   = new PosReceiptOfDelivery();

            posReceiptOfDelivery.DeliveryDate = request.DeliveryDate;
            posReceiptOfDelivery.ReceiverName = request.ReceiverName;
            posReceiptOfDelivery.PosTerminals = request.PosTerminals.ConvertToPosTerminals();
            posReceiptOfDelivery.User         = request.User.ConvertToUser();

            if (posReceiptOfDelivery.GetBrokenRules().Count() > 0)
            {
                response.Errors = posReceiptOfDelivery.GetBrokenRules().ToList();
            }
            else
            {
                try {
                    _posReceiptOfDeliveryRepository.Add(posReceiptOfDelivery);
                    _uow.Commit();
                    response.Errors = new List <BusinessRule>();
                } catch (Exception ex)
                {
                    List <BusinessRule> errors = new List <BusinessRule>();
                    do
                    {
                        errors.Add(new BusinessRule("DAL", "DAL_ERROR: " + ex.Message));
                        ex = ex.InnerException;
                    } while (ex != null);

                    response.Errors = errors;
                }
            }

            return(response);
        }
Beispiel #2
0
        public JsonResult Create(PosReceiptOfDeliveryDetailView vm)
        {
            CreatePosReceiptOfDeliveryRequest request = new CreatePosReceiptOfDeliveryRequest();

            request.DeliveryDate = vm.DeliveryDate;
            GetUserRequest userRequest = new GetUserRequest();

            userRequest.UserId   = vm.UserUserId;
            request.User         = _userService.GetUser(userRequest).User;
            request.ReceiverName = vm.ReceiverName;
            CreatePosReceiptOfDeliveryResponse response = _posReceiptOfDeliveryService.CreatePosReceiptOfDelivery(request);

            return(Json(response));
        }