Beispiel #1
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);
        }
Beispiel #2
0
        public PlacesViewModel(IPlaceService placeService, IOrderService orderService, IFilePickerService filePickerService, ICommonServices commonServices) : base(commonServices)
        {
            PlaceService = placeService;

            PlaceList    = new PlaceListViewModel(PlaceService, commonServices);
            PlaceDetails = new PlaceDetailsViewModel(PlaceService, filePickerService, commonServices);
            PlaceOrders  = new OrderListViewModel(orderService, commonServices);
        }
Beispiel #3
0
 private async void OnMessage(OrderListViewModel viewModel, string message, object args)
 {
     if (viewModel == OrderList && message == "ItemSelected")
     {
         await ContextService.RunAsync(() =>
         {
             OnItemSelected();
         });
     }
 }
Beispiel #4
0
        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;
                }
            }
        }