Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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));
        }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        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));
        }
Exemplo n.º 7
0
        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));
        }
Exemplo n.º 8
0
        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));
        }
Exemplo n.º 9
0
        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));
        }
Exemplo n.º 10
0
        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));
        }
Exemplo n.º 11
0
        public static bool Account_GetPasswordBack(string email)
        {
            IUserAccountDAL UserAccountDB = new EmployeeUserAccountDAL(connectionString);

            return(UserAccountDB.GetPassword(email));
        }
Exemplo n.º 12
0
        public static bool Account_Update(Employee model)
        {
            IUserAccountDAL UserAccountDB = new EmployeeUserAccountDAL(connectionString);

            return(UserAccountDB.Update(model));
        }
Exemplo n.º 13
0
        /// <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));
        }
Exemplo n.º 14
0
        public static bool Change_Pass(string email, string pass)
        {
            IUserAccountDAL UserAccountDB = new EmployeeUserAccountDAL(connectionString);

            return(UserAccountDB.ChangePassword(email, pass));
        }
Exemplo n.º 15
0
        public static bool UpdateProfile(Employee data)
        {
            IUserAccountDAL UserAccountDB = new EmployeeUserAccountDAL(connectionString);

            return(UserAccountDB.UpdateProfile(data));
        }
Exemplo n.º 16
0
        public static Employee GetProfile(string email)
        {
            IUserAccountDAL UserAccountDB = new EmployeeUserAccountDAL(connectionString);

            return(UserAccountDB.GetProfile(email));
        }