Ejemplo n.º 1
0
 private void ValidateInputFields(string password)
 {
     UserDataSource var = new UserDataSource();
     if (String.IsNullOrWhiteSpace(Login) || String.IsNullOrEmpty(Login))
     {
         throw new LoginException(TravelAgencySystem.Exeptions.LoginError.LOGIN_EMPTY);
     }
     else if (String.IsNullOrWhiteSpace(password) || String.IsNullOrEmpty(password))
     {
         throw new LoginException(TravelAgencySystem.Exeptions.LoginError.PASSWORD_EMPTY);
     }
     User tmpUser = var.IsUserInDatabase(Login, password, _typeOfUser);
     if (tmpUser == null)
     {
         throw new LoginException(TravelAgencySystem.Exeptions.LoginError.INCORRECT_LOGIN_OR_PASSWORD);
     }
     else
     {
         SystemManager.Instance.CurrentUser = tmpUser;
         Error = String.Empty;
         if (_typeOfUser == TypeOfUser.Employee)
         {
             SystemWindowViewModel.Instance.ContentControlView = new View.Employee.MainControl();
         }
         else
         {
             SystemWindowViewModel.Instance.ContentControlView = new View.Admin.MainControl();
         }
     }
 }