//public UserDb GetUserBySocialId(string socialId) //{ // UserQuery userQuery = new UserQuery(); // System.Data.DataTable dataTable = conn_db.ReadTable(userQuery.GetObjectByColname<string>("users_v", "social_id", socialId)); // UserDb userdb = new UserDb(); // if (dataTable.Rows.Count > 0) // { // userdb.userId = Convert.ToInt32(dataTable.Rows[0]["USER_ID"].ToString()); // userdb.username = dataTable.Rows[0]["USERNAME"].ToString(); // userdb.fullname = dataTable.Rows[0]["FULLNAME"].ToString(); // userdb.email = dataTable.Rows[0]["EMAIL"].ToString(); // userdb.password = dataTable.Rows[0]["PASSWORD"].ToString(); // userdb.phoneNumber = dataTable.Rows[0]["PHONENUMBER"].ToString(); // userdb.countryCode = dataTable.Rows[0]["countryCode"].ToString(); // userdb.isActive = Convert.ToInt32(dataTable.Rows[0]["isActive"].ToString()); // userdb.rating = Convert.ToDouble(dataTable.Rows[0]["RATING"].ToString()); // userdb.userType = Convert.ToInt32(dataTable.Rows[0]["USERTYPE"].ToString()); // userdb.accessToken = dataTable.Rows[0]["ACCESSTOKEN"].ToString(); // userdb.img = dataTable.Rows[0]["IMG"].ToString(); // userdb.socialId = dataTable.Rows[0]["SOCIAL_ID"].ToString(); // } // else // return null; // return userdb; //} public string GetUsernameByUserId(int user_id) { UserQuery userQuery = new UserQuery(language); System.Data.DataTable dataTable = conn_db.ReadTable(userQuery.GetObjectsByColName("users", "username", "id", user_id.ToString())); UserDb userdb = new UserDb(); if (dataTable.Rows.Count == 0) { throw new EmptyViewException(language); } return(dataTable.Rows[0]["username"].ToString()); }
public UserPage GetUserPage(int user_id) { UserQuery userQuery = new UserQuery(language); System.Data.DataTable dataTable = conn_db.ReadTable(userQuery.GetObjectsByColName("users_v", "URL", "user_id", user_id.ToString())); UserPage userPage = new UserPage(); if (dataTable.Rows.Count == 0) { throw new EmptyViewException(language); } userPage.URL = dataTable.Rows[0]["URL"].ToString(); return(userPage); }
public List <int> GetUsersIds() { UserQuery userQuery = new UserQuery(language); System.Data.DataTable dataTable = conn_db.ReadTable(userQuery.GetObjectsByColName("users", "id", "user_type_id", "1")); List <int> users = new List <int>(); if (dataTable.Rows.Count == 0) { throw new EmptyViewException(language); } foreach (System.Data.DataRow row in dataTable.Rows) { int user = row["id"] is DBNull ? 0 : Convert.ToInt32(row["id"]); users.Add(user); } return(users); }
public List <string> GetUserDevices(int user_id) { UserQuery userQuery = new UserQuery(language); System.Data.DataTable dataTable = conn_db.ReadTable(userQuery.GetObjectsByColName("user_device", "DEVICE_ID", "user_id", user_id.ToString())); List <string> devices = new List <string>(); if (dataTable.Rows.Count == 0) { throw new EmptyViewException(language); } foreach (System.Data.DataRow row in dataTable.Rows) { string device = row["device_id"].ToString(); devices.Add(device); } return(devices); }