public static TabUserModel Parse(UserDataSet.TabUserRow row) { if (row == null) { return(null); } TabUserModel modelData = new TabUserModel(); modelData.Uid = row.UID; modelData.UserName = row.UserName; modelData.Password = row.Password; switch (row.UserLevel) { case 1: modelData.UserLevel = 1; break; case 2: modelData.UserLevel = 2; break; case 3: modelData.UserLevel = 3; break; default: modelData.UserLevel = 1; break; } return(modelData); }
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"); } }
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); }
/// <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); }
/// <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); }
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); }
/// <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); }
//create a PARSE function that is static public static TabUserModel Parse(UserDataSet.TabUserRow rowFromDataSet) { if (rowFromDataSet == null) { return(null); } TabUserModel modelData = new TabUserModel(); modelData.UserID = rowFromDataSet.UID; modelData.UserName = rowFromDataSet.UserName; modelData.UserLevel = rowFromDataSet.UserLevel; modelData.UserEmail = rowFromDataSet.UserEmail; return(modelData); }
// Get the value from the dataset and stock them in tempModel public static TabUserModel Parse(DataSet1.TabUserRow minionRow) { if (minionRow == null) { return(null); } else { TabUserModel tempModel = new TabUserModel(); tempModel.UserID = minionRow.UID; tempModel.UserName = minionRow.UserName; tempModel.UserLevel = minionRow.UserLevel; tempModel.Password = minionRow.Password; return(tempModel); } }
/// <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; } }
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
/// <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); } }