Example #1
0
 private void BtEntrance_Click(object sender, RoutedEventArgs e)
 {
     foreach (RadioButton rb in spRoles.Children)
     {
         if (rb.IsChecked == true)
         {
             this.Close();
             string Role = Roles.RoleNameToEnglish((string)rb.Content);
             Administrator.SetPreviousRole(UserName, Role);
             Desktop desktop = new Desktop();
             desktop.ShowDialog(Administrator, Role, UserName);
             return;
         }
     }
     MessageBox.Show("Выберите роль!", "", MessageBoxButton.OK, MessageBoxImage.Error);
 }
Example #2
0
        private void BtLogin_Click(object sender, RoutedEventArgs e)
        {
            string Name     = tbUserName.Text;
            string Password = pbUserPassword.Password.ToString();

            if (Administrator.ContainsUser(Name, Password) && Name == "Администратор")
            {
                AdminWindow adminWindow = new AdminWindow();
                adminWindow.Owner = this;
                adminWindow.ShowDialog(Administrator);
            }
            else if (Administrator.ContainsUser(Name, Password))
            {
                string PreviousRole = Administrator.GetPreviousRole(Name);
                if (PreviousRole == null)
                {
                    RoleChoice desktop = new RoleChoice();
                    desktop.ShowDialog(Administrator, Name);
                }
                else if (MessageBox.Show("Продолжить предыдущую ссесию?", "", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
                {
                    Desktop desktop = new Desktop();
                    desktop.ShowDialog(Administrator, PreviousRole, Name);
                }
                else
                {
                    Administrator.SetPreviousRole(Name, null);
                    RoleChoice desktop = new RoleChoice();
                    desktop.ShowDialog(Administrator, Name);
                }
            }
            else
            {
                MessageBox.Show(this, $"Неверное имя пользователя или пароль!", "", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            tbUserName.Text         = "";
            pbUserPassword.Password = "";
        }
Example #3
0
 private void EndSession_Click(object sender, RoutedEventArgs e)
 {
     Administrator.SetPreviousRole(UserName, null);
     this.Close();
 }