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 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); } }
private void BackClick(object sender, RoutedEventArgs e) { try { SharedClass.OpenNewPage(this, new ListClients()); } 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); } }
private void EditClick(object sender, RoutedEventArgs e) { try { if (IsSelectedClient()) { Client client = displayClientRep.GetClient(GetSelectedDisplayClient()); SharedClass.OpenNewPage(this, new AddOrEditClient(client)); } } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
private void Add(object sender, RoutedEventArgs routedEventArgs) { try { if (SelectedCar != null && SelectedCity != null) { new Controller.Client().AddNewRent(SelectedCar, SelectedCity, Controller.User.AuthorizedUser); SharedClass.MessageBoxInformation("Success"); SharedClass.OpenNewPage(this, new View.Client.MainMenu()); } else { SharedClass.MessageBoxWarning("Выберите авто и город"); } } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
private void EditOrAddClick(object sender, RoutedEventArgs e) { try { SetGenderClient(); if (this.BtnEditOrAdd.Content.ToString() == addStr) { clientRep.AddClient(Client); SharedClass.MessageBoxInformation("Клиент успешно добавлен"); } else { clientRep.EditClient(Client); SharedClass.MessageBoxInformation("Данные о клиенте успешно отредактировны"); } SharedClass.OpenNewPage(this, new ListClients()); } catch (Exception ex) { SharedClass.MessageBoxError(ex); } }
private void Cancel(object sender, RoutedEventArgs routedEventArgs) { SharedClass.OpenNewPage(this, new View.Client.MainMenu()); }
private void User_Click(object sender, RoutedEventArgs e) { SharedClass.OpenNewPage(this, new Auth()); }
private void ListOfCars(object sender, RoutedEventArgs routedEventArgs) { SharedClass.OpenNewPage(this, new View.Admin.ListOfCars()); }
private void AddClick(object sender, RoutedEventArgs e) { SharedClass.OpenNewPage(this, new AddOrEditClient()); }