Beispiel #1
0
        public static bool Employee_Update(Employee data, HttpPostedFileBase file, UserAccountTypes userType)
        {
            switch (userType)
            {
            case UserAccountTypes.Employee:
                return(HumanResourceBLL.Employee_Update(data, file));

            default:
                throw new Exception("usertype is not valid");
            }
        }
Beispiel #2
0
        public static UserAccount Authorize(string userName, string password, UserAccountTypes userType)
        {
            IUserAccountDAL userAccountDB;

            switch (userType)
            {
            case UserAccountTypes.Employee: userAccountDB = new DataLayer.SqlServer.EmployeeUserAccountDAL(connectionString); break;

            case UserAccountTypes.Customer: userAccountDB = new DataLayer.SqlServer.CustomerUserAccountDAL(connectionString); break;

            default:
                throw new Exception("UserTypes is not valid");
            }
            return(userAccountDB.Authorize(userName, password));
        }
        /// <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));
        }
Beispiel #4
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));
        }
Beispiel #5
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));
        }
        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 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));
        }
Beispiel #10
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));
        }
Beispiel #11
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));
        }
Beispiel #12
0
        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));
        }
Beispiel #13
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));
        }
Beispiel #14
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));
        }