/// <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));
        }
Exemple #2
0
        /// <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));
        }