private void AuthClick(object sender, RoutedEventArgs e) { try { if (IsFieldsEmpty()) { SharedClass.MessageBoxWarning("Все поля должны быть заполнены"); return; } if (userRepo.IsAuth(this.txtLogin.Text.Trim(), this.txtPassword.Text.Trim())) { MainWindow mainWindow = new MainWindow(); mainWindow.Show(); this.Close(); } else { SharedClass.MessageBoxWarning($"Неправильный логин или пароль."); } } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
private void AuthClick(object sender, RoutedEventArgs e) { try { if (this.txtLogin.Text != "" && this.txtPassword.Text != "") { if (model.IsAuth(this.txtLogin.Text, this.txtPassword.Text)) { SharedClass.OpenNewPage(this, new MainMenu()); } else { SharedClass.MessageBoxWarning("Неправильный логин или пароль"); } } else { SharedClass.MessageBoxWarning("Все поля должны быть заполнены"); } } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
//sing in application private void ClickBtnSing(object sender, RoutedEventArgs e) { try { string login = this.TxbLogin.Text; string password = this.PsbPassword.Password; //if check is null, send message for user if (!user.CheckFields(login, password)) { return; } //authorization user if (!user.AuthUser(login, password)) { return; } //open MainPage if User has SharedClass.OpenNewWindow(new MainWindow(), this); } catch (Exception ex) { SharedClass.MessageBoxError(ex.Message); } }
private void SaveEditAboutCar(object sender, RoutedEventArgs routedEventArgs) { try { if (!Admin.isSelected(SelectedCar)) { SharedClass.MessageBoxWarning("Выберите автомобиль в таблице"); return; } if (Admin.checkVIN(SelectedCar)) { SharedClass.MessageBoxWarning("Все поля должны быть заполнены"); } else { Controller.Model.SaveChanges(); SharedClass.MessageBoxInformation("Data Success Edit for selected car"); UpdateDataGrid(); } } catch (NullReferenceException) { SharedClass.MessageBoxWarning("Все поля должны быть заполнены"); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
//add new car in BD private void AddCar(object sender, RoutedEventArgs routedEventArgs) { try { //check fiels, if have null -> send message for user if (Admin.checkVIN(NewCar)) { SharedClass.MessageBoxWarning("Все поля должны быть заполнены"); } else { //add new user and send message for user Admin.AddCar(NewCar); SharedClass.MessageBoxInformation("Автомобиль успешно добавлен в базу данных"); this.Close(); } } catch (DbEntityValidationException) { SharedClass.MessageBoxWarning("Заполните все поля"); } catch (NullReferenceException) { SharedClass.MessageBoxWarning("Все поля должны быть заполнены"); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
private void SaveChanges(object sender, RoutedEventArgs e) { try { //check fiels, if null -> send message for user if (!new Controller.User().CheckFields(Controller.User.AuthorizedUser.Email, Controller.User.AuthorizedUser.Password, Controller.User.AuthorizedUser.FirstName, Controller.User.AuthorizedUser.LastName)) { return; } Controller.Model.SaveChanges(); SharedClass.MessageBoxInformation("Данные о пользователе успешно отредактированы"); //open main menu, for type auth user if (new Controller.User().isAdmin()) { SharedClass.OpenNewPage(this, new View.Admin.MainMenu()); } else { SharedClass.OpenNewPage(this, new View.Client.MainMenu()); } } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
private void BackClick(object sender, RoutedEventArgs e) { try { SharedClass.OpenNewPage(this, new ListClients()); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
public Auth() { try { InitializeComponent(); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
private void Statistick(object sender, RoutedEventArgs eventArgs) { try { this.MainFrame.Content = new View.Admin.Statistick(); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
private void AddNewRent(object sender, RoutedEventArgs routedEventArgs) { try { SharedClass.OpenNewPage(this, new View.Client.AddNewRent()); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
//edit data for account private void SettingsAccount(object sender, RoutedEventArgs e) { try { this.MainFrame.Content = new View.User.SettingsAccount(); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
private void AddNewRent(object sender, RoutedEventArgs eventArgs) { try { this.MainFrame.Content = new View.Client.AddNewRent(); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
private void LoadDataGrid() { try { this.ListRentCarsForUser.ItemsSource = Client.getListRentForUser(CarSharing.Controller.User.AuthorizedUser); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
/// <summary> /// genarate main Window /// </summary> public MainWindow() { try { InitializeComponent(); SharedClass.SetFrame(this.MainFrame, new ListClients()); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
//update data in DataGrid private void UpdateDataGrid() { try { this.ListCars.ItemsSource = null; this.ListCars.ItemsSource = Admin.getListCars(); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
public MainWindow() { try { InitializeComponent(); SetAuthText(); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
public SelectCity() { try { InitializeComponent(); this.ListCities.ItemsSource = new Controller.Client().getListCities(); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
public MainMenu() { try { InitializeComponent(); LoadDataGrid(); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
public AddNewRent() { try { InitializeComponent(); SetStartTextBlocks(); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
private void SelectCityInDataGrid(object sender, RoutedEventArgs routedEventArgs) { try { Client.AddNewRent.SelectedCity = (CarSharing.Model.City) this.ListCities.SelectedItem; this.DialogResult = true; } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
public ListOfCars() { try { InitializeComponent(); LoadDataAboutCars(); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
//open window for add Car and Update data in DataGrid private void AddNewCar(object sender, RoutedEventArgs routedEventArgs) { try { new View.Admin.AddNewCar().ShowDialog(); UpdateDataGrid(); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
public ListClients() { try { InitializeComponent(); UpdateList(); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
private void UpdatePage() { try { this.ListRentCarsForUser.ItemsSource = null; rentCarForUser = new Model.RentCarForUser(); LoadDataGrid(); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
private void SetStartTextBlocks() { try { setTextAuto(""); setTextCity(""); setTextPrice(""); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
public AddNewCar() { try { InitializeComponent(); this.DataContext = NewCar; this.LoadDataInComboBox(); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
private void getFuncForClient() { try { this.AdminFunctional.Visibility = Visibility.Hidden; this.ClientFunctional.Visibility = Visibility.Visible; this.MainFrame.Content = new View.Client.MainMenu(); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
public SettingsAccount() { try { InitializeComponent(); //load data for auth User DataContext = Controller.User.AuthorizedUser; TblRole.Text = $"Your Role: {Controller.User.AuthorizedUser.Role.NameRole}"; } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
private void LoadDataInComboBox() { try { this.CmbCarColor.ItemsSource = Admin.getListColors(); this.CmbTypeOfCar.ItemsSource = Admin.getListTypeOfCar(); this.CmbCarMake.ItemsSource = Admin.getListCarMakes(); this.CmbTypeEngine.ItemsSource = Admin.getListTypeEngines(); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
//set DataContext from Selected Row private void SelectCar(object sender, RoutedEventArgs routedEventArgs) { try { if (this.ListCars.SelectedItem != null) { this.SelectedCar = (Model.Car) this.ListCars.SelectedItem; this.DataContext = this.SelectedCar; } } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }