Exemplo n.º 1
0
 public void chceckIfLastAdmin()
 {
     if (TypeOf == TypeOfUser.Employee)
     {
         throw new TravelAgency.Exeptions.UserException(TravelAgency.Exeptions.CreateUserError.CANNOT_CHECK_LAST_ADMIN);
     }
     else
     {
         UserDataSource dataSource = new UserDataSource();
         if (dataSource.CheckIfLastAdmin())
         {
             throw new TravelAgency.Exeptions.DeleteException(TravelAgency.Exeptions.DeleteError.LAST_ADMIN_DELETE);
         }
         else if (this.ID == TravelAgency.Utils.SystemManager.Instance.CurrentUser.ID)
         {
             throw new TravelAgency.Exeptions.DeleteException(TravelAgency.Exeptions.DeleteError.YOUR_ACCOUNT_DELETE);
         }
     }
 }