示例#1
0
        public async Task SetStatusCompletPoint(int idOrderMobile)
        {
            ManagerNotifyMobileApi managerNotifyMobileApi = new ManagerNotifyMobileApi();
            OrderMobile            orderMobile            = context.OrderMobiles
                                                            .Include(om => om.Orders)
                                                            .Include(om => om.OnePointForAddressOrders)
                                                            .FirstOrDefault(om => om.ID == idOrderMobile);
            OnePointForAddressOrder onePointForAddressOrder = orderMobile.OnePointForAddressOrders.FirstOrDefault(om => om.Status == "DriveFromPoint");
            int   index = orderMobile.OnePointForAddressOrders.IndexOf(onePointForAddressOrder);
            Order order = context.Orders.FirstOrDefault(o => o.ID == onePointForAddressOrder.IDorder);

            if (onePointForAddressOrder != null)
            {
                orderMobile.OnePointForAddressOrders.First(om => om.Status == "DriveFromPoint").Status = "CompletePoint";
                orderMobile.OnePointForAddressOrders[index + 1].Status = "DriveFromPoint";
            }
            if (onePointForAddressOrder.Type == "Start")
            {
                order.CurrentStatus = "Picked up";
            }
            else if (onePointForAddressOrder.Type == "End")
            {
                order.CurrentStatus = "Delivered";
            }
            string tokenShope = GetTokenShope(orderMobile.IdDriver);

            managerNotifyMobileApi.SendNotyfyStatusPickup(tokenShope, "Order", $"Drive to {orderMobile.OnePointForAddressOrders[index+1].Address}", $"It is important to complete the order on time before {orderMobile.OnePointForAddressOrders[index+1].PTime}");
            await context.SaveChangesAsync();
        }
示例#2
0
        private async void ListView_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            OnePointForAddressOrder onePointForAddressOrder = (OnePointForAddressOrder)e.Item;

            if (onePointForAddressOrder.Status == "DriveFromPoint")
            {
                var options = new MapLaunchOptions {
                    Name = "1", NavigationMode = Xamarin.Essentials.NavigationMode.Driving
                };
                await Map.OpenAsync(onePointForAddressOrder.Lat, onePointForAddressOrder.Lng, options);
            }
        }
示例#3
0
        public async Task <BackgroundService.DriverManager.location> GetAddressToOrderDB(int idMobileOrder)
        {
            OrderMobile orderMobile = await context.OrderMobiles
                                      .Include(o => o.OnePointForAddressOrders)
                                      .FirstOrDefaultAsync(o => o.ID == idMobileOrder);

            OnePointForAddressOrder onePointForAddressOrder = orderMobile.OnePointForAddressOrders[orderMobile.OnePointForAddressOrders.Count - 1];

            return(new ApiMobaileTaxi.BackgroundService.DriverManager.location(onePointForAddressOrder.Lat, onePointForAddressOrder.Lng)
            {
                ID = orderMobile.IdDriver,
                ApiniTime = onePointForAddressOrder.PTime,
                Date = onePointForAddressOrder.Date
            });
        }