/// <summary> /// 注册类型 /// </summary> protected override void RegistType() { Builder.RegisterType <UserAccountDAL>().As <IUserAccountDAL>(); base.RegistType(); //_userDAL = Container.Resolve<IUserAccountDAL>(); _userDAL = new AccountDataBridge(); }
/// <summary> /// 帐号业务 /// </summary> public AccountBLL() { //RegistType(); _userDAL = new AccountDataBridge(); Mapper = AccountMapper.InitAllMapper(); }
/// <summary> /// Phân chia tài khoản kết nối là nhân viên, khách hàng , shipper để trả về thông tin liên quan /// </summary> /// <param name="userName"></param> /// <param name="password"></param> /// <param name="userType"></param> /// <returns></returns> public static UserAccount Authorize(string userName, string password, UserAccountTypes userType) { switch (userType) { case UserAccountTypes.Employee: userAccountDB = new EmployeeUserAccountDAL(_connectionString); break; case UserAccountTypes.Customer: userAccountDB = new CustomerUserAccountDAL(_connectionString); break; default: return(null); } return(userAccountDB.Authorize(userName, password)); }
public static int ChangePassword(string accountId, string newPAssword, UserAccountTypes userType) { IUserAccountDAL userAccountDAL = null; switch (userType) { case UserAccountTypes.Employee: userAccountDAL = new LiteCommerce.DataLayers.SqlServer.EmployeeUserAccountDAL(_connectionString); break; case UserAccountTypes.Customer: userAccountDAL = new LiteCommerce.DataLayers.SqlServer.CustomerUserAccountDAL(_connectionString); break; default: throw new Exception("invalid type"); } return(userAccountDAL.ChangePassword(accountId, newPAssword)); }
public static int UpdateProfile(Object data, UserAccountTypes userType) { IUserAccountDAL userAccountDAL = null; switch (userType) { case UserAccountTypes.Employee: userAccountDAL = new LiteCommerce.DataLayers.SqlServer.EmployeeUserAccountDAL(_connectionString); break; case UserAccountTypes.Customer: userAccountDAL = new LiteCommerce.DataLayers.SqlServer.CustomerUserAccountDAL(_connectionString); break; default: throw new Exception("invalid type"); } return(userAccountDAL.UpdateProfile(data)); }
public static UserAccount Athorize(string username, string password, UserAccountTypes userType) { IUserAccountDAL UserAccountDB = null; 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)); }
/// <summary> /// goi Cơ chế đăng nhập tuong ung => da hinh /// </summary> /// <param name="userName"></param> /// <param name="password"></param> /// <param name="userType"></param> /// <returns></returns> public static UserAccount Authorize(string userName, string password, UserAccountTypes userType) { //IUserAccountDAL userAccountDB; khai báo nội tuyến đúng với tính chất đa hình hơn switch (userType) { case UserAccountTypes.Employee: userAccountDB = new EmployeeUserAccountDAL(_connectionString); break; case UserAccountTypes.Customer: userAccountDB = new CustomerUserAccountDAL(_connectionString); break; default: return(null); } // co che da hinh => tuy tinh huong ma su dug return(userAccountDB.Authorize(userName, password)); }
public UserAccountController() { _userDAL = new UserAccountDAL(); }
public static void Initialize(string connectionString) { UserAccountDB = new DataLayer.SqlServer.EmployeeUserAccountDAL(connectionString); UserAccountBLL.connectionString = connectionString; }