private async void RCommand1() { await DBActions.LoadProducts(); await DBActions.LoadUsers(); events.rel_admin(search1.Text); refr1.IsRefreshing = false; }
private async void RCommand() { await DBActions.LoadAdmins(); await DBActions.LoadProducts(); await DBActions.LoadUsers(); events.rel(TXT()); refr.IsRefreshing = false; }
public CardDefault(Binary b) { this.b = b; InitializeComponent(); Account acc = MapPage._g; if (acc is Guests) { Guests g = acc as Guests; if (!DBActions.hasBooked(g, b.PRODUCT)) { btn.Text = "RESERVERA"; } } lbl.Text = b.PRODUCT.Description; btn.Clicked += async(s, e) => { if (loading) { return; } if (MapPage._g is Admins) { if (await DBActions.Check(MapPage._g as Admins, MapPage.mapPage)) { return; } } loading = true; await DBActions.LoadProducts(); await DBActions.LoadUsers(); var prds = DBActions.GetProductById(b.PRODUCT.ID); if (prds != null && prds.Quantity > 0 && DBActions.GetAdminById(prds.AdminID) != null) { MapPage.mapPage.OpenProduct(b); } else { App.Send("Info", "Produkten finns inte längre!", "Ok"); if (DBActions.GetAdminById(prds.AdminID) == null) { await DBActions.CheckProducts(); } MapPage.mapPage.ReloadAll(); } loading = false; }; }
private async void Button_Create_Clicked(object s, EventArgs a) { if (created) { return; } string n = e_name.Text; string p = e_pass.Text; if (n != null && p != null) { if (!(n.Length >= MIN_U_LENGTH && n.Length <= MAX_U_LENGTH)) { DisplayAlert("Fel", "ID ska vara mellan " + MIN_U_LENGTH + " och " + MAX_U_LENGTH, "Ok"); return; } if (!(p.Length >= MIN_P_LENGTH && p.Length <= MAX_P_LENGTH)) { DisplayAlert("Fel", "Lösenordet ska vara mellan " + MIN_P_LENGTH + " och " + MAX_P_LENGTH, "Ok"); return; } created = true; App.StartLoading("Register"); await DBActions.LoadUsers(); bool found = true; foreach (Admins admin in DBActions.admins) { if (admin.ID.ToLower() == n.ToLower()) { found = false; break; } } foreach (Guests guest in DBActions.guests) { if (guest.Name.ToLower() == n.ToLower()) { found = false; break; } } if (found) { success = await DBActions.Process("adduser", new Guests { Name = n, Password = p }); if (success) { await DBActions.LoadAccounts(); PlaySuccess(); } else { created = false; } } else { an.Pause(); an.IsVisible = false; created = false; DisplayAlert("Fel", "Kontot med ID: " + n + " finns redan!", "Ok"); } App.FinishLoading("Register"); return; } else { DisplayAlert("Fel", "Ange ID och lösenord.", "Ok"); } created = false; }