private void btnOK_Click(object sender, RoutedEventArgs e) { if (surnameComboBox.SelectedItem == null) { MessageBox.Show("errror"); return; } Worker worker = workerRepository.GetListFromCache().Where(p => p.Surname == surnameComboBox.Text).First(); //Worker worker2 = workerRepository.Get(p => p.Surname == surnameComboBox.Text).First(); User user = userReository.FindByID(worker.ID); if (user == null) { MessageBox.Show("error pass"); return; } if (passwordBox.Password != user.Password) { MessageBox.Show("error pass"); return; } Window mainWin = new Window(); if (worker.DepartamentID == departamentRepository.GetListFromCache().Where(p => p.Name == "Балет").Select(p => p.ID).First()) { mainWin = new ChooseEvent(); } if (worker.DepartamentID == departamentRepository.GetListFromCache().Where(p => p.Name == "Администрация").Select(p => p.ID).First()) { mainWin = new WorkersWindow(); } if (mainWin.IsInitialized == false) { MessageBox.Show("Недостаточно прав доступа"); return; } mainWin.Show(); this.Close(); }
private void WorkersButton_Click(object sender, RoutedEventArgs e) { WorkersWindow window = new WorkersWindow(); window.Show(); }