Exemplo n.º 1
0
        private void Save()
        {
            using (StartOperation())
            {
                var orderedBookDescriptions = Order.OrderedBooks
                                              .Select(ob => new OrderedBookDescription
                {
                    BookId    = ob.BookId,
                    BookTitle = ob.Book.Title,
                    Amount    = ob.Amount
                })
                                              .ToList();

                var validationMessage = OrdersLogic.ValidateOrder(_employee.BranchId, orderedBookDescriptions);
                if (!validationMessage.IsNullOrEmpty())
                {
                    ErrorMessage = validationMessage;
                    return;
                }

                Order.Date     = DateTime.Now;
                Order.Customer = Customer;
                OrdersLogic.SaveOrder(_employee.BranchId, Customer.Id, _employee.Id, orderedBookDescriptions);

                Close(true);
            }
        }
Exemplo n.º 2
0
        private void Save()
        {
            using (StartOperation())
            {
                var validationMessage = OrdersLogic.ValidateOrder(Order, _employee.BranchId);
                if (!validationMessage.IsNullOrEmpty())
                {
                    ErrorMessage = validationMessage;
                    return;
                }

                Order.Date     = DateTime.Now;
                Order.Customer = Customer;
                OrdersLogic.SaveOrder(Order, _employee.BranchId);

                Close(true);
            }
        }