private void ExitExecute() { MainWindow loginWindow = new MainWindow(); hotelOwnerView.Close(); loginWindow.Show(); }
public void LogOutExecute() { MessageBoxResult result = MessageBox.Show("Are you sure you want to log out?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { masterView.Close(); } }
private void SaveExecute() { try { // if (!Validation.IsValid(Administrator.JMBG)) //{ // MessageBox.Show("JMBG is not valid"); // return; //} //else if (!Validation.PasswordValidation(Administrator.Pasword)) //{ // MessageBox.Show("Password Hint must contain at least 5 caracters. Try again"); // return; //} /*Administrator.ExpirationDate = DateTime.Now.AddDays(7)*/; MessageBoxResult result = MessageBox.Show("Are you sure?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { bool isUpdateAdministrator = service.AddAdministrator(Administrator); if (isUpdateAdministrator == true) { MessageBox.Show("Administratoris registered.", "Notification", MessageBoxButton.OK); view.Close(); } else { MessageBox.Show("Administrator is not registered.", "Notification", MessageBoxButton.OK); view.Close(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void Logout() { try { MessageBoxResult result = MessageBox.Show("Are you sure you want to logout?", "Confirmation", MessageBoxButton.OKCancel); switch (result) { case MessageBoxResult.OK: LoginView loginView = new LoginView(); Thread.Sleep(1000); masterView.Close(); loginView.Show(); return; case MessageBoxResult.Cancel: break; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void CloseExecute() { master.Close(); }
private void _btn_cancel_Click(object sender, EventArgs e) { MasterView.Close(); }
/// <summary> /// method for saving data to the database /// </summary> private void SaveExecute() { try { using (CompanyDBEntities context = new CompanyDBEntities()) { tblUser newUser = new tblUser(); tblAdmin newAdmin = new tblAdmin(); // inputs and validations if (user.FirstName.All(Char.IsLetter)) { newUser.FirstName = user.FirstName; } else { MessageBox.Show("Wrong First Name input, please try again."); } if (user.LastName.All(Char.IsLetter)) { newUser.LastName = user.LastName; } else { MessageBox.Show("Wrong Last Name input, please try again."); } newUser.JMBG = user.JMBG; // JMBG validation if (JmbgInputValidation(newUser.JMBG) == false) { MessageBox.Show("Wrong input, please check your JMBG (13 characters)."); } string sex = user.Gender.ToUpper(); // gender validation if ((sex == "M" || sex == "Z" || sex == "X" || sex == "N")) { newUser.Gender = sex; } else { MessageBox.Show("Wrong Gender input, please enter M, Z, X or N."); } user.UserID = newUser.UserID; newUser.Residence = user.Residence; string marriage = user.MarriageStatus.ToUpper(); if ((marriage == "MARRIED" || marriage == "UNMARRIED" || marriage == "DIVORCED")) { newUser.MarriageStatus = marriage; } else { MessageBox.Show("Wrong Marriage status input. Please try again.\n (Married/Unmarried/Divorced)"); } newUser.Username = user.Username; newUser.UserPassword = user.UserPassword; string adminType = admin.AdminType.ToUpper(); if ((adminType == "TEAM" || adminType == "SYSTEM" || adminType == "LOCAL")) { newAdmin.AdminType = adminType; } else { MessageBox.Show("Wrong Admin type input. Please try again.\n (Team/System/Local)"); } newAdmin.AdminID = admin.AdminID; newAdmin.ExpirationDate = DateTime.Now.AddDays(7); newAdmin.UserID = newUser.UserID; // saving data to the database context.tblUsers.Add(newUser); context.tblAdmins.Add(newAdmin); context.SaveChanges(); MessageBox.Show("The admin created successfully."); // logging the action FileActions.FileActions.Instance.Adding(FileActions.FileActions.path, FileActions.FileActions.actions, "user", newUser.FirstName + " " + newUser.LastName); FileActions.FileActions.Instance.Adding(FileActions.FileActions.path, FileActions.FileActions.actions, "admin", newUser.FirstName + " " + newUser.LastName); } masterView.Close(); } catch (Exception) { MessageBox.Show("Wrong inputs, please check your inputs or try again."); } }
private void CancelButton_Click(object sender, EventArgs e) { MasterView.Close(); }