Exemplo n.º 1
0
        public static CustomerOrderVM SetSubData(CustomerOrder model)
        {
            var data = CustomerOrderVM.MToVM(model);

            data.DateTime  = DateTimeStorageVM.MToVM(DateTimeStorageService.GetByOID(model.ID, model.API).FirstOrDefault());
            data.OrderItem = CustomerOrderItemService.SetSubDatas(CustomerOrderItemService.GetByCOID(model.ID, model.API));
            return(data);
        }
Exemplo n.º 2
0
        public async Task <CustomerOrderVM> GetCustomerOrderByOrderId(Guid orderId)
        {
            if (orderId == Guid.Empty)
            {
                CustomerOrderVM customerOrderVM = new CustomerOrderVM();
                return(customerOrderVM);
            }

            return(await orderRepository.GetCustomerOrderByOrderId(orderId));
        }
Exemplo n.º 3
0
 public OrderVM(CustomerOrderVM order, MainWindowVM vm, OrderService orderService)
 {
     ID = order.ID;
     OrderDate = order.CurrentEntity.OrderDate;
     Customer = vm.CustomersVM.Customers.First(c => c.ID == order.CurrentCustomerID).Name;
     CustomerID = order.CurrentCustomerID;
     Total = order.OrderItems.Sum(i => i.Amount.Value);
     Status = order.Status == null ? string.Empty : order.Status.Name;
     HasShippedItems = order.OrderItems.Any(i => i.Status is ShippedState);
     _orderService = orderService;
 }
 public CustomerOrderWindow(OrderService orderService,
                            CustomerService customerService,
                            OrderItemService orderItemService,
                            InventoryItemService inventoryService,
                            MainWindowVM mainVM,
                            EventAggregator eventAggregator)
     : this()
 {
     var vm = new CustomerOrderVM(eventAggregator, orderService, orderItemService, inventoryService, mainVM);
     DataContext = vm;
 }
Exemplo n.º 5
0
 public static bool Insert(Guid id, Guid uid, Guid oid, Guid aid, Guid dtid, bool iS, float tc)
 {
     try {
         using (var context = new CentralProcessContext()) {
             var data = CustomerOrderVM.set(id, uid, oid, aid, dtid, iS, tc);
             context.CustomerOrderDB.Add(data);
             context.SaveChanges();
             return(true);
         }
     } catch { return(false); }
 }
Exemplo n.º 6
0
        public CustomerOrderWindow(OrderService orderService,
                                   CustomerService customerService,
                                   OrderItemService orderItemService,
                                   InventoryItemService inventoryService,
                                   MainWindowVM mainVM,
                                   EventAggregator eventAggregator)
            : this()
        {
            var vm = new CustomerOrderVM(eventAggregator, orderService, orderItemService, inventoryService, mainVM);

            DataContext = vm;
        }
        public async Task <IActionResult> DisplayOrders(int id)
        {
            var customer = await _context.Customers.FindAsync(id);

            var custOrders = new CustomerOrderVM();

            custOrders.Customer = customer;

            var orders = await _context.Orders
                         .Where(o => o.CustomerId == id)
                         .ToListAsync <Order>();

            custOrders.Orders = orders;


            return(View(custOrders));
        }
        public ActionResult MyOrder()
        {
            List <CustomerOrderVM> covm = new List <CustomerOrderVM>();
            var orderHistoryList        = db.OnlineInvoices.Where(o => o.UserName == HttpContext.User.Identity.Name).Include(os => os.OnlineSales).AsEnumerable().Select(o => new { id = o.OnlineInvoiceID, invNumber = o.InvoiceNumber, price = db.OnlineSales.Where(s => s.OnlineInvoiceID == o.OnlineInvoiceID).Sum(s => s.ItemPrice), status = o.IsPaid, date = o.OrderDate.ToString("MMM dd, yyyy") });

            foreach (var item in orderHistoryList)
            {
                CustomerOrderVM obj = new CustomerOrderVM();
                obj.OnlineInvoiceID = item.id;
                obj.InvoiceNumber   = item.invNumber;
                obj.ItemPrice       = item.price;
                obj.OrderDate       = item.date;
                obj.IsPaid          = item.status;
                covm.Add(obj);
            }

            return(View(covm));
        }
 public CustomerOrderWindow(OrderVM currentOrder,
                            OrderService orderService,
                            CustomerService customerService,
                            OrderItemService orderItemService,
                            InventoryItemService inventoryService,
                            MainWindowVM mainVM,
                            EventAggregator eventAggregator)
     : this()
 {
     var order = new Order()
     {
         ID = currentOrder.ID,
         CustomerID = currentOrder.CustomerID,
         OrderDate = currentOrder.OrderDate,
     };
     var vm = new CustomerOrderVM(eventAggregator, order, orderService, orderItemService, inventoryService, mainVM);
     vm.RefreshCommand.Execute(null);
     DataContext = vm;
 }
Exemplo n.º 10
0
        public CustomerOrderWindow(OrderVM currentOrder,
                                   OrderService orderService,
                                   CustomerService customerService,
                                   OrderItemService orderItemService,
                                   InventoryItemService inventoryService,
                                   MainWindowVM mainVM,
                                   EventAggregator eventAggregator)
            : this()
        {
            var order = new Order()
            {
                ID         = currentOrder.ID,
                CustomerID = currentOrder.CustomerID,
                OrderDate  = currentOrder.OrderDate,
            };
            var vm = new CustomerOrderVM(eventAggregator, order, orderService, orderItemService, inventoryService, mainVM);

            vm.RefreshCommand.Execute(null);
            DataContext = vm;
        }
Exemplo n.º 11
0
        public async Task <List <CustomerOrderVM> > GetAllCustomerOrders(Guid customerId)
        {
            List <CustomerOrderVM> customerOrder = await ctx.Order.Where(o => o.CustomerId == customerId)
                                                   .Select(o => new CustomerOrderVM
            {
                OrderId          = o.OrderId,
                CustomerId       = o.CustomerId,
                CreatedDate      = o.CreatedDate,
                TotalPrice       = o.TotalPrice,
                ContactPhone     = o.ContactPhone,
                DeliveryName     = o.DeliveryName,
                DeliveryEmail    = o.DeliveryEmail,
                DeliveryAddress  = o.DeliveryAddress,
                DeliveryPrice    = o.DeliveryPrice,
                DeliveryDate     = o.DeliveryDate,
                NumberOfProducts = o.OrderProductSize.Count,
                StatusId         = o.StatusId,
                StatusName       = o.Status.Name
            })
                                                   .OrderByDescending(o => o.CreatedDate)
                                                   .ToListAsync();

            List <Guid> orderIds = customerOrder.Select(o => o.OrderId)
                                   .ToList();

            foreach (Guid guid in orderIds)
            {
                OrderProductSize orderProductSize = await ctx.OrderProductSize.Where(o => o.OrderId == guid).FirstOrDefaultAsync();

                CustomerOrderVM customerOrderVM = customerOrder.Where(o => o.OrderId == guid).FirstOrDefault();
                customerOrderVM.FirstProductName = await ctx.ProductSize.Where(p => p.ColorId == orderProductSize.ColorId && p.ProductId == orderProductSize.ProductId && p.SizeId == orderProductSize.SizeId)
                                                   .Select(p => p.ProductColor.Product.Name)
                                                   .FirstOrDefaultAsync();
            }

            return(customerOrder);
        }
Exemplo n.º 12
0
        public async Task <CustomerOrderVM> GetCustomerOrderByOrderId(Guid orderId)
        {
            CustomerOrderVM customerOrder = await ctx.Order.Where(o => o.OrderId == orderId)
                                            .Select(o => new CustomerOrderVM
            {
                OrderId          = o.OrderId,
                CustomerId       = o.CustomerId,
                CreatedDate      = o.CreatedDate,
                TotalPrice       = o.TotalPrice,
                ContactPhone     = o.ContactPhone,
                DeliveryName     = o.DeliveryName,
                DeliveryEmail    = o.DeliveryEmail,
                DeliveryAddress  = o.DeliveryAddress,
                DeliveryPrice    = o.DeliveryPrice,
                DeliveryDate     = o.DeliveryDate,
                NumberOfProducts = o.OrderProductSize.Count,
                StatusId         = o.StatusId,
                StatusName       = o.Status.Name
            })
                                            .OrderByDescending(o => o.CreatedDate)
                                            .FirstOrDefaultAsync();

            return(customerOrder);
        }
Exemplo n.º 13
0
 public OrderUpdatedEvent(CustomerOrderVM order)
 {
     Order = order;
 }
Exemplo n.º 14
0
 public OrderUpdatedEvent(CustomerOrderVM order)
 {
     Order = order;
 }