public async void captureLoginSession(LoginResponse loginResponse) { var userSessionInformation = new UserLoginSession { // object to send into local database UserUid = loginResponse.Result.Result[0].UserId, FirstName = loginResponse.Result.Result[0].UserFirstName, LastName = loginResponse.Result.Result[0].UserLastName, SessionId = loginResponse.LoginAttemptLog.SessionId, LoginId = loginResponse.LoginAttemptLog.LoginId, PhoneNumber = loginResponse.Result.Result[0].UserPhone, Address1 = loginResponse.Result.Result[0].UserAddress1, Address2 = loginResponse.Result.Result[0].UserAddress2, City = loginResponse.Result.Result[0].UserCity, State = loginResponse.Result.Result[0].UserState, Street = loginResponse.Result.Result[0].UserAddress1, Zipcode = loginResponse.Result.Result[0].UserZipcode.ToString(), Email = loginResponse.Result.Result[0].UserEmail }; await App.Database.SaveItemAsync(userSessionInformation); // send login session to local database App.setLoggedIn(true); var mainPage = new MainPage(userSessionInformation); await Navigation.PushAsync(mainPage); //This is to change "login" button to "logout" button. Not implemented //mainPage.updateLoginButton(); }
// captures a login session and sends it to the local database public async void captureLoginSession(LoginResponse loginResponse) { var userSessionInformation = new UserLoginSession { // object to send into local database UserUid = loginResponse.Result.Result[0].UserId, FirstName = loginResponse.Result.Result[0].UserFirstName, LastName = loginResponse.Result.Result[0].UserLastName, SessionId = loginResponse.LoginAttemptLog.SessionId, LoginId = loginResponse.LoginAttemptLog.LoginId, PhoneNumber = loginResponse.Result.Result[0].UserPhone, Address1 = loginResponse.Result.Result[0].UserAddress1, Address2 = loginResponse.Result.Result[0].UserAddress2, City = loginResponse.Result.Result[0].UserCity, State = loginResponse.Result.Result[0].UserState, Street = loginResponse.Result.Result[0].UserAddress1, Zipcode = loginResponse.Result.Result[0].UserZipcode.ToString(), Email = loginResponse.Result.Result[0].UserEmail }; await App.Database.SaveItemAsync(userSessionInformation); // send login session to local database App.setLoggedIn(true); // update the login status for the app System.Diagnostics.Debug.WriteLine("change main page"); var mainPage = new MainPage(userSessionInformation); await Navigation.PushAsync(mainPage); //mainPage.updateLoginButton(); // update login button to be login / logout - not implemented //await Navigation.PopToRootAsync(); await DisplayAlert("Success", "Your account was created", "OK"); }
public MainPage(UserLoginSession userSessionInformation) { InitializeComponent(); userSesh = userSessionInformation; kitchensListView.RefreshCommand = new Command(() => { GetKitchens(); kitchensListView.IsRefreshing = false; }); kitchensListView.ItemSelected += Handle_ItemTapped(); }
public SelectMealOptions(string foodbank_id, string foodbank_name, string foodbank_address, UserLoginSession userLoginSession) { InitializeComponent(); userSesh = userLoginSession; SetBinding(TitleProperty, new Binding(foodbank_name)); myProperty = foodbank_name; BindingContext = this; foodbankID = foodbank_id + "?"; kitchenAddress = foodbank_address; foodbankName = foodbank_name; FindMeals(foodbankID, ""); }
public CheckOutPage(ObservableCollection <MealsModel> meals, string foodbank_id, string foodbankName, string kitchen_address, UserLoginSession userLoginSession) { InitializeComponent(); userSesh = userLoginSession; kitchenAddress = kitchen_address; mealsOrdered = meals; SetupUI(); currentOrder.kitchen_id = foodbank_id; currentOrder.customer_id = userSesh.ID.ToString(); currentOrder.phone = userSesh.PhoneNumber; currentOrder.street = userSesh.Street; currentOrder.city = userSesh.City; currentOrder.state = userSesh.State; currentOrder.zipcode = userSesh.Zipcode; currentOrder.delivery_note = "Test delivery note"; currentOrder.latitude = "0.00"; currentOrder.longitude = "0.00"; currentOrder.delivery_date = timePicker.Time.ToString(); nameLabel.Text = foodbankName; addressLabel.Text = kitchen_address; int total = 0; foreach (var meal in mealsOrdered) { if (meal.order_qty > 0) { total += meal.order_qty; Dictionary <string, string> mealDict = new Dictionary <string, string> { { "meal_id", meal.id }, { "qty", meal.order_qty.ToString() } }; currentOrder.ordered_items.Add(mealDict); } } currentOrder.totalAmount = total; }