Пример #1
0
        private void OnSearch()
        {
            var text = search.Text;

            if (text != null)
            {
                var ad = DBActions.GetAdminById(text);
                if (ad != null)
                {
                    if (ad.ID == App.ACCOUNT_NAME)
                    {
                        return;
                    }
                    admin           = ad;
                    stack.IsVisible = true;
                }
                else
                {
                    stack.IsVisible = false;
                    App.Send("Fel", "Kunde inte hitta kontot med ID: " + text + "!", "Avbryt", ManagePage.page);
                }
            }
            else
            {
                App.Send("Fel", "Ange admin id!", "Avbryt", ManagePage.page);
            }
        }
Пример #2
0
        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;
            };
        }
Пример #3
0
        private async void OnClicked(object s, EventArgs args)
        {
            var a1 = id.Text; var a2 = pass.Text;

            if (a1 != null && a2 != null)
            {
                if (DBActions.GetAdminById(a1) == null)
                {
                    await DBActions.FullyAddAdmin(new Admins { ID = a1, Password = a2, Login = false });

                    await App.Send("Info", "Kontot med ID: " + a1 + " har skapats!", "Ok", ManagePage.page);

                    Navigation.PopPopupAsync();
                }
                else
                {
                    App.Send("Fel", "Kontot " + a1 + " finns redan!", "Avbryt", ManagePage.page);
                }
            }
            else
            {
                App.Send("Fel", "Ange id och lösenord.", "Avbryt", ManagePage.page);
            }
        }