예제 #1
0
        public List <TabUserModel> GetAllUserDetails(int requestLevel)
        {
            if (requestLevel == 3)
            {
                _users = new List <TabUserModel>();

                try
                {
                    _tabUserTable = _userDAO.GetUser();

                    foreach (UserDataSet.TabUserRow row in _tabUserTable.Rows)
                    {
                        _users.Add(TabUserModel.Parse(row));
                    }

                    return(_users);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Table could not be filled");
                    throw ex;
                }
            }
            else
            {
                //throw access denied exception
                throw new MLMSExceptions("Access Denied");
            }
        }
예제 #2
0
        public List <TabUserModel> GetAllUser()
        {
            _users = new List <TabUserModel>();

            _tabUserTable = _userDAO.GetAllUser();

            foreach (UserDS.TabUserRow row in _tabUserTable.Rows)
            {
                _users.Add(TabUserModel.Parse(row));
            }
            return(_users);
        }
예제 #3
0
        /// <summary>
        /// Get user from tabUser by UDID
        /// </summary>
        /// <param name="UID"></param>
        /// <returns></returns>
        public List <TabUserModel> GetUserInfoByUID(int UID)
        {
            List <TabUserModel> _users = new List <TabUserModel>();

            _userTable = _userDao.GetInfoByUID(UID);

            foreach (DataSet1.TabUserRow minionRow in _userTable.Rows)
            {
                TabUserModel tempRow = TabUserModel.Parse(minionRow);
                _users.Add(tempRow);
            }

            return(_users);
        }
예제 #4
0
        /// <summary>
        /// Get login from datatable with the value passed through
        /// </summary>
        /// <param name="userName">String Username</param>
        /// <returns>Return the value from the datatable</returns>
        public List <TabUserModel> GetLogin(string userName)
        {
            List <TabUserModel> _users = new List <TabUserModel>();

            _userTable = _userDao.GetUserName(userName);

            foreach (DataSet1.TabUserRow minionRow in _userTable.Rows)
            {
                TabUserModel tempRow = TabUserModel.Parse(minionRow);
                _users.Add(tempRow);
            }

            return(_users);
        }
예제 #5
0
        public List <TabUserModel> PerformLogin(string username, string password)
        {
            _users = new List <TabUserModel>();

            if (password.Length > 0)
            {
                _tabUserTable = _userDAO.GetLogin(username, password);

                foreach (UserDS.TabUserRow row in _tabUserTable.Rows)
                {
                    _users.Add(TabUserModel.Parse(row));
                }
            }
            return(_users);
        }
예제 #6
0
        /// <summary>
        /// Get user Information
        /// </summary>
        /// <param name="UID">int</param>
        /// <returns></returns>
        public static String GetUserInfoByUID(int UID)
        {
            List <TabUserModel> _users = new List <TabUserModel>();

            UserDAO _userDao = new UserDAO();

            DataSet1.TabUserDataTable _userTable = _userDao.GetInfoByUID(UID);

            foreach (DataSet1.TabUserRow minionRow in _userTable.Rows)
            {
                TabUserModel tempRow = TabUserModel.Parse(minionRow);
                _users.Add(tempRow);
            }

            return(_users[0].UserName);
        }
예제 #7
0
        /// <summary>
        /// Returns all users data from table User.
        /// </summary>
        /// <returns>List<TabUserModel></returns>
        /// <exception cref="ex">Exception</exception>
        public List <TabUserModel> GetAllUser()
        {
            try
            {
                _users        = new List <TabUserModel>();
                _tabUserTable = _userDAO.GetAllUser();

                foreach (UserDS.TabUserRow row in _tabUserTable.Rows)
                {
                    _users.Add(TabUserModel.Parse(row));
                }
                return(_users);
            }
            catch (Exception ex)
            {
                //Error log simulate
                Console.WriteLine(ex.ToString());
                Console.WriteLine(ex.GetBaseException().ToString());
                throw;
            }
        }
예제 #8
0
        public List <TabUserModel> GetLogin(String inputUsername, String inputPassword)
        {
            _users = new List <TabUserModel>();
            try
            {
                _tabUserTable = _userDAO.GetLogin(inputUsername, inputPassword);

                if (_tabUserTable.Count > 0)
                {
                    foreach (UserDataSet.TabUserRow row in _tabUserTable.Rows)
                    {
                        _users.Add(TabUserModel.Parse(row));
                    }
                }
                return(_users);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception:" + ex.ToString() + ", captured. Could Not Fill Table");
                throw ex;
            }
        }//end GetLogin
예제 #9
0
        /// <summary>
        /// Get user from datatable with 2 parameters UID OR UserName
        /// </summary>
        /// <param name="userName">String Username</param>
        /// <param name="UID">Int</param>
        /// <returns>Return the value from the datatable</returns>
        public List <TabUserModel> GetUserByUserNameUID(int UID, string userName)
        {
            int?UIDCheck = UID;

            if (UIDCheck == null && userName != "")
            {
                List <TabUserModel> _users = new List <TabUserModel>();

                _userTable = _userDao.GetUserName(userName);

                foreach (DataSet1.TabUserRow minionRow in _userTable.Rows)
                {
                    TabUserModel tempRow = TabUserModel.Parse(minionRow);
                    _users.Add(tempRow);
                }

                return(_users);
            }
            else if (UIDCheck != null && userName != "")
            {
                List <TabUserModel> _users = new List <TabUserModel>();

                _userTable = _userDao.GetUserByUserNameUID(UID, userName);

                foreach (DataSet1.TabUserRow minionRow in _userTable.Rows)
                {
                    TabUserModel tempRow = TabUserModel.Parse(minionRow);
                    _users.Add(tempRow);
                }

                return(_users);
            }
            else if (UIDCheck != null && userName == "")
            {
                List <TabUserModel> _users = new List <TabUserModel>();

                _userTable = _userDao.GetUserByUserNameUID(UID, "");

                foreach (DataSet1.TabUserRow minionRow in _userTable.Rows)
                {
                    TabUserModel tempRow = TabUserModel.Parse(minionRow);
                    _users.Add(tempRow);
                }

                return(_users);
            }
            else
            {
                List <TabUserModel> _users = new List <TabUserModel>();

                _userTable = _userDao.GetUser();

                foreach (DataSet1.TabUserRow minionRow in _userTable.Rows)
                {
                    TabUserModel tempRow = TabUserModel.Parse(minionRow);
                    _users.Add(tempRow);
                }

                return(_users);
            }
        }