private async void OpenPage() { KooshDarooDatabase odb = new KooshDarooDatabase(); var oLoginItemS = odb.GetPharmacysAsync(); if (oLoginItemS.Result.Count > 0) { PharmacyService Pharmacyervices = new PharmacyService(); var pharmacyS = Task.Run(() => Pharmacyervices.GetPharmacyByPhoneNoAsync(oLoginItemS.Result[0].PhoneNo)); if (pharmacyS.Result.Count == 0) { oLoginItemS.Result.ForEach(f => odb.DeletePharmacyAsync(f)); MainPage = new NavigationPage(new SignUpPage()); //MainPage = new SignUpPage(); } else { myId = pharmacyS.Result[0].id; myPhoneNo = pharmacyS.Result[0].PhoneNo; MainPage = new NavigationPage(new MainPageTabbed()); //MainPage = new MainPageTabbed(); } } else { MainPage = new SignUpPage(); } }
private async void SignUpButton_Clicked(object sender, EventArgs e) { PharmacyService Pharmacyservice = new PharmacyService(); var _pharmacyS = await Pharmacyservice.GetPharmacyByPhoneNoAsync(phoneNo.Text); GetCurrentXY(); if (x == 0 & y == 0) { return; } if (_pharmacyS.Count == 0) { KooshDaroo.Models.Pharmacy _pharmacy = new KooshDaroo.Models.Pharmacy { City = city.SelectedItem.ToString(), Title = pharmacy.Text, X = x, Y = y, PhoneNo = phoneNo.Text, is24h = is24h.IsChecked }; var result = Pharmacyservice.PostPharmacyAsync(_pharmacy); App.myId = result.Result.id; App.myPhoneNo = result.Result.PhoneNo; } else { App.myId = _pharmacyS[0].id; App.myPhoneNo = _pharmacyS[0].PhoneNo; } KooshDarooDatabase odb = new KooshDarooDatabase(); tblPharmacy newPharmacy = new tblPharmacy { City = city.SelectedItem.ToString(), Title = pharmacy.Text, X = x, Y = y, PhoneNo = phoneNo.Text, is24h = is24h.IsChecked }; int r = await odb.SavePharmacyAsync(newPharmacy); //odb = new KooshDarooDatabase(); //var oLoginItemS = odb.GetPharmacysAsync(); //var o = oLoginItemS.Result.Count; App.Current.MainPage = new NavigationPage(new MainPageTabbed()); //App.Current.MainPage = new MainPageTabbed(); //App.Current.MainPage = new PrescribesListPage(); //await this.Navigation.PushAsync(new PrescribesListPage()); }