public void SaveExecute(object parametar) { var passwordBox = parametar as PasswordBox; var password = passwordBox.Password; var email = User.Email.ToLower(); User.Password = password; User.Email = email; User.RoleId = 2; try { if (User.HotelUserId == 0) { bool uniqueUserName = service.CheckUsername(User.Username); bool uniqueEmail = service.CheckEmail(User.Email); bool uniqueFloor = service.CheckHotelFloor(UserManager.HotelFloor); if (uniqueUserName && uniqueEmail && uniqueFloor) { int userId = service.AddHotelUser(User); if (userId != 0) { UserManager.HotelUserId = userId; UserManager.QualificationLevelId = selectedQualificationLevel.QualificationLevelId; if (service.AddNewManger(UserManager) != 0) { MessageBox.Show("You have successfully added new manager"); OwnerView ownerView = new OwnerView(); ownerView.Show(); addManagerView.Close(); } } } else if (!uniqueUserName) { MessageBox.Show("Username already exists!"); } else if (!uniqueEmail) { MessageBox.Show("Email already exists!"); } else if (!uniqueFloor) { MessageBox.Show("The floor is occupied select another!"); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }