Example #1
0
 public PdbAccount CheckLogin(string username, string password, string department)
 {
     if (username == "" || password == "" || department == "")
     {
         if (username == "")
         {
             Error.UsernameRequired();
             return(null);
         }
         else if (password == "")
         {
             Error.PasswordRequired();
             return(null);
         }
         else
         {
             Error.DepartmentRequired();
             return(null);
         }
     }
     else
     {
         try
         {
             PdbAccount ac = new PdbAccount();
             ac = AccountService.GetAccountwithUPD(username, password, department);
             bool checkauthentication = ac.isActive;
             if (checkauthentication)
             {
                 Successful.LoginSuccessful();
                 return(ac);
             }
             else
             {
                 Error.LockedAccount();
                 return(null);
             }
         }
         catch
         {
             return(null);
         }
     }
 }