Example #1
0
        private void Shop_Click(object sender, RoutedEventArgs e)
        {
            MedicineViewer page = new MedicineViewer(ID);

            page.Show();
            this.Close();
        }
Example #2
0
        public void Login()
        {
            string name     = NameB.Text;
            string pass     = PassB.Text;
            string passDat  = "";
            int    ID       = 0;
            bool   found    = false;
            int    decision = 0;

            if (name != "" & pass != "")
            {
                var userCount = App.DatabaseCustomers.QueryCustomExist().Result;
                foreach (var house in userCount)
                {
                    if (house.Name == name)
                    {
                        ID       = house.ID;
                        found    = true;
                        passDat  = house.Password;
                        decision = house.Choice;
                    }
                }
                if (found)
                {
                    string passHash = App.GetStringSha256Hash(pass);
                    if (passHash == passDat)
                    {
                        if (decision == 1)
                        {
                            MedicineViewer Page = new MedicineViewer(ID);
                            Page.Show();
                            this.Close();
                        }
                        else
                        {
                            Settings Page = new Settings(ID);
                            Page.Show();
                            this.Close();
                        }
                    }
                    else
                    {
                        Error.Content = "";
                    }
                }
                else
                {
                    Error.Content = "Zkontroluj údaje";
                }
            }

            else
            {
                Error.Content = "Špatně vyplněné údaje";
            }
        }