public CustomersViewModel(ICustomerService customerService, IOrderService orderService, IFilePickerService filePickerService, ICommonServices commonServices) : base(commonServices)
        {
            CustomerService = customerService;

            CustomerList    = new CustomerListViewModel(CustomerService, commonServices);
            CustomerDetails = new CustomerDetailsViewModel(CustomerService, filePickerService, commonServices);
            CustomerOrders  = new OrderListViewModel(orderService, commonServices);
        }
Example #2
0
        public OrdersViewModel(IOrderService orderService, IOrderItemService orderItemService, ICommonServices commonServices) : base(commonServices)
        {
            OrderService = orderService;

            OrderList     = new OrderListViewModel(OrderService, commonServices);
            OrderDetails  = new OrderDetailsViewModel(OrderService, commonServices);
            OrderItemList = new OrderItemListViewModel(orderItemService, commonServices);
        }
Example #3
0
 private async void OnMessage(OrderListViewModel viewModel, string message, object args)
 {
     if (viewModel == OrderList && message == "ItemSelected")
     {
         await ContextService.RunAsync(() =>
         {
             OnItemSelected();
         });
     }
 }
        private async void OnListMessage(OrderListViewModel sender, string message, object args)
        {
            var current = Item;

            if (current != null)
            {
                switch (message)
                {
                case "ItemsDeleted":
                    if (args is IList <OrderModel> deletedModels)
                    {
                        if (deletedModels.Any(r => r.OrderID == current.OrderID))
                        {
                            await OnItemDeletedExternally();
                        }
                    }
                    break;

                case "ItemRangesDeleted":
                    try
                    {
                        var model = await OrderService.GetOrderAsync(current.OrderID);

                        if (model == null)
                        {
                            await OnItemDeletedExternally();
                        }
                    }
                    catch (Exception ex)
                    {
                        LogException("Order", "Handle Ranges Deleted", ex);
                    }
                    break;
                }
            }
        }