private async void AddToCart() { Debug.WriteLine($"**** {this.GetType().Name}.{nameof(AddToCart)}"); bool userResponse = await page_service.DisplayAlertAsync("Add Item?", "Are you sure you want to add item to cart?", "Ok", "Cancel"); if (userResponse == false) { return; } else { OrderItem newItem = new OrderItem { Item = this.PlaceOrder }; await _repo.AddItem(newItem); var navParams = new NavigationParameters(); navParams.Add("ItemAdded", newItem); await Task.Delay(1); Restaurant2SideItem newItema = new Restaurant2SideItem { Item = this.PlaceOrder }; await _repo.AddItem(newItema); var navParams1 = new NavigationParameters(); navParams1.Add("ItemAdded", newItema); await Task.Delay(1); } }
private async void OnNextPage() { Debug.WriteLine($"**** {this.GetType().Name}.{nameof(OnNextPage)}"); if (string.IsNullOrEmpty(secret_code)) { await _pageDialogService.DisplayAlertAsync("Error", "A server must enter valid code", "Dismiss"); return; } if (secret_code == "!8&v") { CrossLocalNotifications.Current.Show("Dine & Dash", "Thank you for your order! Your food is on its way...", 1, DateTime.Now.AddSeconds(2)); await nav_service.NavigateAsync("ConfirmationSubPage", null); Restaurant2SideItem cashPayment2 = new Restaurant2SideItem { Item = this.PlaceCash }; await _repo.AddItem(cashPayment2); var navParams = new NavigationParameters(); navParams.Add("ItemAdded", navParams); await Task.Delay(1); } if (secret_code == "" || secret_code != "!8&v") { await _pageDialogService.DisplayAlertAsync("Error", "Incorrect Code", "Try Again"); return; } }
private async void OntoNextPage(OrderItem listOfItems) { if (string.IsNullOrEmpty(selectedSeat)) { await _pageDialogService.DisplayAlertAsync("Error", "Must select a seat", "Dismiss"); return; } else { await nav_service.NavigateAsync("MenuTwoContainerPage", null); Restaurant2SideItem seat = new Restaurant2SideItem { Item = this.SelectedSeat }; await _repo.AddItem(seat); var navParams = new NavigationParameters(); navParams.Add("ItemAdded", navParams); await Task.Delay(1); _repo.RemoveAllItems(listOfItems); } }
public async Task RemoveItem(Restaurant2SideItem removeOrderItem1) { if (itemFromSomeDataSource1 == null) { } itemFromSomeDataSource1.Remove(removeOrderItem1); await Task.Delay(500); }
public async Task AddItem(Restaurant2SideItem newOrderItem1) { if (itemFromSomeDataSource1 == null) { itemFromSomeDataSource1 = new List <Restaurant2SideItem>(); } itemFromSomeDataSource1.Add(newOrderItem1); await Task.Delay(500); }
public async Task <IList <Restaurant2SideItem> > GetItems2(int numberOfItems) { itemFromSomeDataSource1 = new List <Restaurant2SideItem>(); for (int i = 0; i < numberOfItems; i++) { var newOrderItem = new Restaurant2SideItem() { Item = $"{i}" }; itemFromSomeDataSource1.Add(newOrderItem); } await Task.Delay(500); return(itemFromSomeDataSource1); }
private async void GoToHomePage() { Debug.WriteLine($"**** {this.GetType().Name}.{nameof(GoToHomePage)}"); await nav_service.NavigateAsync("MainPage", null); Restaurant2SideItem foodToDeliver = new Restaurant2SideItem { Item = this.FoodDelivery }; await _repo.AddItem(foodToDeliver); var navParams = new NavigationParameters(); navParams.Add("ItemAdded", navParams); await Task.Delay(1); // _repo.RemoveAllItems(listOfItems); }
private async void GoToRate() { Debug.WriteLine($"**** {this.GetType().Name}.{nameof(GoToRate)}"); bool response = await displayMessage.DisplayAlertAsync("LIKE OUR APP?", "Share your experience with us!", "Rate Now!", "Dismiss"); if (response == false) { await nav_service.NavigateAsync("GetStartedPage", null); // _repo.RemoveAllItems(listOfItems); Restaurant2SideItem foodToDeliver = new Restaurant2SideItem { Item = this.FoodDelivery }; await _repo.AddItem(foodToDeliver); var navParams = new NavigationParameters(); navParams.Add("ItemAdded", navParams); await Task.Delay(1); } else { await nav_service.NavigateAsync("RatingsPage", null); Restaurant2SideItem foodToDeliver = new Restaurant2SideItem { Item = this.FoodDelivery }; await _repo.AddItem(foodToDeliver); var navParams = new NavigationParameters(); navParams.Add("ItemAdded", navParams); await Task.Delay(1); // _repo.RemoveAllItems(listOfItems); } }
private async void GoToNextPage() { Debug.WriteLine($"**** {this.GetType().Name}.{nameof(GoToNextPage)}"); if (string.IsNullOrEmpty(name_entry) || string.IsNullOrEmpty(cardNumber_entry) || string.IsNullOrEmpty(cardMonth_entry) || string.IsNullOrEmpty(cardYear_entry) || string.IsNullOrEmpty(cardSecurity_entry) || string.IsNullOrEmpty(address_entry) || string.IsNullOrEmpty(city_entry) || string.IsNullOrEmpty(state_entry) || string.IsNullOrEmpty(zip_entry) || string.IsNullOrEmpty(selectedCard)) { await _pageDialogService.DisplayAlertAsync("Error", "You must fill out all fields", "Dismiss"); return; } else { if (cardNumber_entry.Length != 16) { await _pageDialogService.DisplayAlertAsync("Error", "Card Number is invalid", "Dismiss"); return; } else if (cardSecurity_entry.Length != 3) { await _pageDialogService.DisplayAlertAsync("Error", "You must enter a valid CVV", "Dismiss"); return; } else if (cardMonth_entry.Length != 2) { await _pageDialogService.DisplayAlertAsync("Error", "You must enter a valid month", "Dismiss"); return; } else if (cardYear_entry.Length != 4) { await _pageDialogService.DisplayAlertAsync("Error", "You must enter a valid year", "Dismiss"); return; } else if (state_entry.Length != 2) { await _pageDialogService.DisplayAlertAsync("Error", "You must enter a valid year", "Dismiss"); return; } else if (zip_entry.Length != 5) { await _pageDialogService.DisplayAlertAsync("Error", "You must enter a valid year", "Dismiss"); return; } else { CrossLocalNotifications.Current.Show("Dine & Dash", "Thank you for your order! Your food is on its way...", 1, DateTime.Now.AddSeconds(2)); await nav_service.NavigateAsync("ConfirmationSubPage", null); Restaurant2SideItem card_payment = new Restaurant2SideItem { Item = this.CardPayment }; await _repo.AddItem(card_payment); var navParams = new NavigationParameters(); navParams.Add("ItemAdded", navParams); await Task.Delay(1); } } }