private void ButtonLogin_Click(object sender, RoutedEventArgs e) { if (CBZ.CheckCredentials(Bizz, UserName, MenuItemChangePassWord, MenuItemLogOut, TextBoxInitials.Text, TextBoxPassword.Password)) { TabOffer.IsEnabled = true; TabAdministration.IsEnabled = true; if (Bizz.CurrentUser.Administrator) { HelpData.IsEnabled = true; } else { HelpData.IsEnabled = false; } Information.IsEnabled = true; UcLeft.Content = new UserControl(); UcRight.Content = new UserControl(); Bizz.UcRightActive = false; } else { MessageBox.Show("Initialer eller password er forkert."); } }
private void ButtonLogin_Click(object sender, RoutedEventArgs e) { if (CBZ.CheckCredentials(UserName, ButtonChangePassWord, ButtonLogOut, TextBoxInitials.Text, TextBoxPassword.Password)) { switch (CBZ.CurrentUser.UserLevel.Id) { case 1: ButtonChangePassWord.IsEnabled = true; ButtonLogOut.IsEnabled = true; TabOffer.Visibility = Visibility.Visible; TabNews.Visibility = Visibility.Visible; TabMaintenance.Visibility = Visibility.Hidden; TabAdministration.Visibility = Visibility.Hidden; break; case 2: ButtonChangePassWord.IsEnabled = true; ButtonLogOut.IsEnabled = true; TabOffer.Visibility = Visibility.Visible; TabNews.Visibility = Visibility.Visible; TabMaintenance.Visibility = Visibility.Visible; TabAdministration.Visibility = Visibility.Hidden; break; case 3: ButtonChangePassWord.IsEnabled = true; ButtonLogOut.IsEnabled = true; TabOffer.Visibility = Visibility.Visible; TabNews.Visibility = Visibility.Visible; TabMaintenance.Visibility = Visibility.Visible; TabAdministration.Visibility = Visibility.Visible; Data.Visibility = Visibility.Visible; Users.Visibility = Visibility.Hidden; break; case 4: ButtonChangePassWord.IsEnabled = true; ButtonLogOut.IsEnabled = true; TabOffer.Visibility = Visibility.Visible; TabNews.Visibility = Visibility.Visible; TabMaintenance.Visibility = Visibility.Visible; TabAdministration.Visibility = Visibility.Visible; Data.Visibility = Visibility.Visible; Users.Visibility = Visibility.Visible; break; default: ButtonChangePassWord.IsEnabled = true; ButtonLogOut.IsEnabled = true; TabOffer.IsEnabled = false; TabMaintenance.IsEnabled = false; TabAdministration.IsEnabled = false; Data.IsEnabled = false; Users.IsEnabled = false; break; } CBZ.UcMainEdited = false; switch (TextBoxPassword.Password) { case "1234": MessageBox.Show("Dette er et midlertidigt password, der skal ændres!", "Password", MessageBoxButton.OKCancel, MessageBoxImage.Warning); this.UcMain.Content = new UcChangePassWord(CBZ, UcMain, true); break; default: UcMain.Content = new UserControl(); break; } } else { MessageBox.Show("Initialer eller password er forkert.", "Login", MessageBoxButton.OK, MessageBoxImage.Error); } }