public Account ReadAccount(int id) { if ((int)account.AccountLevel <= 1 && id <= 0) { throw new NotImplementedException(); } return(AccountMehod.Read(id)); }
public List <Account> ReadAccount() { if ((int)account.AccountLevel <= 1) { throw new NotImplementedException(); } return(AccountMehod.Read()); }
public List <Account> FindAccount(string search) { if ((int)account.AccountLevel <= 1) { throw new NotImplementedException(); } return(AccountMehod.Find(search)); }
public bool UpdateAccount(int id, string fullname, string address, string phone) { bool isValid = !IsStringEmpty(fullname) && id > 0 && (account.ID == id || account.AccountLevel >= AccountLevelEnums.Librarian); if (!isValid) { return(false); } AccountMehod.Update(new Account(fullname, address, phone, id)); return(true); }
public bool RemoveAccount(int id) { bool isvalid = account.ID != id && account.AccountLevel >= AccountLevelEnums.Librarian; if (!isvalid) { return(false); } AccountMehod.Remove(id); return(true); }
public bool SignIn(string fullname, string address, string phone, AccountLevelEnums level, string username, string password) { bool isValid = !IsStringEmpty(fullname, username, password) && password.Length >= 8 && level != 0 && (account.AccountLevel >= level || level == AccountLevelEnums.Patron); if (!isValid) { return(false); } if (AccountMehod.CountUsername(username) != 0) { return(false); } AccountMehod.Add(new Account(fullname, address, phone, DateTime.Today, level, username, password)); return(true); }
public bool Login(string username, string password) { bool isValid = !IsStringEmpty(username, password); if (!isValid) { return(false); } int id = AccountMehod.Login(username, password); if (id > 0) { _account = AccountMehod.Read(id); return(true); } return(false); }
public bool ChangePassword(string username, string oldPassword, string newPassword) { bool isValid = !IsStringEmpty(username, oldPassword, newPassword); if (!isValid) { return(false); } try { AccountMehod.ChangePassword(username, oldPassword, newPassword); } catch (NotImplementedException) { return(false); } return(true); }