/// <summary> /// Purpose: Grabs all administrators /// Accepts: Boolean /// Returns: List<Administrator> /// </summary> public List<Administrator> GetAllAdministrators(bool onlyActive) { List<Administrator> administrators = new List<Administrator>(); try { AdministratorData data = new AdministratorData(); List<QSRDataObjects.Administrator> dataAdministrators = data.GetAllAdministrators(onlyActive); foreach (QSRDataObjects.Administrator a in dataAdministrators) { Administrator admin = new Administrator(); admin.AdministratorID = a.AdministratorID; admin.Username = a.Username; admin.Password = a.Password; admin.FirstName = a.FirstName; admin.LastName = a.LastName; admin.IsActive = a.IsActive; administrators.Add(admin); } } catch (Exception ex) { ErrorRoutine(ex, "Administrator", "GetAllAdministrators"); } return administrators; }
/// <summary> /// Purpose: Sets administrator ID based on administrator login information /// Accepts: String username, String password /// Returns: Nothing /// </summary> public void Login(string username, string password) { try { AdministratorData adminData = new AdministratorData(); Hashtable hsh = new Hashtable(); hsh["username"] = username.Trim(); hsh["password"] = password.Trim(); AdministratorID = adminData.Login(hsh); } catch (Exception ex) { ErrorRoutine(ex, "Administrator", "Login"); } }
/// <summary> /// Purpose: Grabs administrator information based on ID /// Accepts: Int /// Returns: Nothing /// </summary> public void GetAdministratorByID(int id) { try { AdministratorData data = new AdministratorData(); Hashtable hsh = new Hashtable(); hsh = data.GetAdministratorByID(id); AdministratorID = id; Username = hsh["username"]; Password = hsh["password"]; FirstName = hsh["firstname"]; LastName = hsh["lastname"]; IsActive = hsh["isactive"]; } catch (Exception ex) { ErrorRoutine(ex, "Administrator", "GetAdministratorByID"); } }