/// <summary> /// /// </summary> /// <param name="connectionString"></param> public static void Initialize(string connectionString) { _connectionString = connectionString; // Mình khai báo lên trên để dùng cho 2 method , Chưa đúng lắm , cần tối ưu vì tùy trường hợp trả về UA => mặc định là của nhân viên userAccountDB = new EmployeeUserAccountDAL(_connectionString); }
public static UserAccount Authorize(string userName, string password, UserAccountTypes userType) { IUserAccountDAL userAccountDB; switch (userType) { case UserAccountTypes.Employee: userAccountDB = new EmployeeUserAccountDAL(connectionstring); break; case UserAccountTypes.Customer: userAccountDB = new CustomerUserAccountDAL(connectionstring); break; default: throw new Exception("usertype is not valid"); } return(userAccountDB.Authorize(userName, password)); }
public static UserProfile Account_GetEmployee(Account account, UserAccountTypes userType) { IUserAccountDAL userAccountDB; switch (userType) { case UserAccountTypes.Employee: userAccountDB = new EmployeeUserAccountDAL(connectionstring); break; case UserAccountTypes.Customer: userAccountDB = new CustomerUserAccountDAL(connectionstring); break; default: throw new Exception("usertype is not valid"); } return(userAccountDB.GetEmployee(account)); }
public static bool SetCode(string email, string code, UserAccountTypes userType) { IUserAccountDAL userAccountDB; switch (userType) { case UserAccountTypes.Employee: userAccountDB = new EmployeeUserAccountDAL(connectionstring); break; case UserAccountTypes.Customer: userAccountDB = new CustomerUserAccountDAL(connectionstring); break; default: throw new Exception("usertype is not valid"); } return(userAccountDB.SetCode(email, code)); }
public static UserAccount GetAccount(string email, UserAccountTypes userTypes) { IUserAccountDAL userAccountDB; switch (userTypes) { case UserAccountTypes.Employee: userAccountDB = new EmployeeUserAccountDAL(_connectionString); break; case UserAccountTypes.Customer: userAccountDB = new CustomerUserAccountDAL(_connectionString); break; default: return(null); } return(userAccountDB.GetAccount(email)); }
public static UserAccount Authenticate(string email, string password, UserAccountTypes userTypes) { IUserAccountDAL userAccountDB; switch (userTypes) { case UserAccountTypes.Employee: userAccountDB = new EmployeeUserAccountDAL(_connectionString); break; case UserAccountTypes.Customer: userAccountDB = new CustomerUserAccountDAL(_connectionString); break; default: return(null); } return(userAccountDB.Authenticate(email, password)); }
public static UserAccount Authorize(string userName, string password, UserAccountTypes userType) { IUserAccountDAL userAccountDB; switch (userType) { case UserAccountTypes.Employee: userAccountDB = new EmployeeUserAccountDAL(_connectString); break; case UserAccountTypes.Customer: userAccountDB = new CustomerUserAccountDAL(_connectString); break; default: return(null); } return(userAccountDB.Authorize(userName, password)); }
public static bool ResetPassword(string userName, string password, UserAccountTypes userType) { IUserAccountDAL userAccountDB; switch (userType) { case UserAccountTypes.Customer: userAccountDB = new CustomerUserAccountDAL(_connectionString); break; case UserAccountTypes.Employee: userAccountDB = new EmployeeUserAccountDAL(_connectionString); break; default: return(false); } return(userAccountDB.ResetPassword(userName, password)); }
public static bool FindUserName(string userName, UserAccountTypes userType) { IUserAccountDAL userAccountDB; switch (userType) { case UserAccountTypes.Customer: userAccountDB = new CustomerUserAccountDAL(_connectionString); break; case UserAccountTypes.Employee: userAccountDB = new EmployeeUserAccountDAL(_connectionString); break; default: return(false); } return(userAccountDB.FindEmail(userName)); }
public static bool Account_Get(Account account, UserAccountTypes userType) { IUserAccountDAL userAccountDB; switch (userType) { case UserAccountTypes.Employee: userAccountDB = new EmployeeUserAccountDAL(connectionstring); break; case UserAccountTypes.Customer: userAccountDB = new CustomerUserAccountDAL(connectionstring); break; default: throw new Exception("usertype is not valid"); } //return userAccountDB.Authorize(userName, password); return(userAccountDB.Get(account)); }
public static bool Account_GetPasswordBack(string email) { IUserAccountDAL UserAccountDB = new EmployeeUserAccountDAL(connectionString); return(UserAccountDB.GetPassword(email)); }
public static bool Account_Update(Employee model) { IUserAccountDAL UserAccountDB = new EmployeeUserAccountDAL(connectionString); return(UserAccountDB.Update(model)); }
/// <summary> /// /// </summary> /// <param name="newPassword"></param> /// <param name="id"></param> /// <returns></returns> public static bool Account_ChangePwd(string newPassword, string email) { IUserAccountDAL UserAccountDB = new EmployeeUserAccountDAL(connectionString); return(UserAccountDB.ChangePw(newPassword, email)); }
public static bool Change_Pass(string email, string pass) { IUserAccountDAL UserAccountDB = new EmployeeUserAccountDAL(connectionString); return(UserAccountDB.ChangePassword(email, pass)); }
public static bool UpdateProfile(Employee data) { IUserAccountDAL UserAccountDB = new EmployeeUserAccountDAL(connectionString); return(UserAccountDB.UpdateProfile(data)); }
public static Employee GetProfile(string email) { IUserAccountDAL UserAccountDB = new EmployeeUserAccountDAL(connectionString); return(UserAccountDB.GetProfile(email)); }