Example #1
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));
        }
Example #2
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));
        }
Example #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));
        }
Example #4
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));
        }
Example #5
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));
        }
Example #6
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));
        }
Example #7
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));
        }
Example #8
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));
        }
Example #9
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));
        }