Example #1
0
        private void teaLoginButton_Click(object sender, RoutedEventArgs e)
        {
            bool found = false;

            for (int i = 0; i < User.UserList.Count; i++)
            {
                if (loginBox.Text == User.UserList[i].Login)
                {
                    if (passwordBox.Text == User.UserList[i].Password)
                    {
                        if (User.UserList[i].HasEditAccess == true)
                        {
                            found        = true;
                            User.IsAdmin = true;
                            TeaWindow teaWin = new TeaWindow();
                            teaWin.Show();
                        }
                        else
                        {
                            found        = true;
                            User.IsAdmin = false;
                            TeaWindow teaWin = new TeaWindow();
                            teaWin.Show();
                        }
                    }
                }
            }
            if (found == false)
            {
                MessageBox.Show("Неверные логин или пароль");
            }
        }
Example #2
0
 private void addTeaButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Tea t = new Tea(teaNameBox.Text, teaDescBox.Text, teaTypeBox.Text, Double.Parse(teaPriceBox.Text));
         Tea.TeaList.Add(t);
         Tea.SaveData(Tea.TeaFile, Tea.TeaList);
         this.Close();
         TeaWindow teaWin = new TeaWindow();
         teaWin.Show();
     } catch
     {
         MessageBox.Show("Проверьте корректность ввода");
     }
 }