/// <summary> /// Получение списка категорий проекта разделеными символом '#' /// </summary> /// <returns>Строка с списком</returns> public static string GetListViewApplication() { string listData = string.Empty; try { string quary = "select Name from ViewApplication " + "where idViewApplication != -1"; MySqlClass.mySQLConn.Open(); MySql.Data.MySqlClient.MySqlDataReader reader = (new MySql.Data.MySqlClient.MySqlCommand(quary, MySqlClass.mySQLConn)).ExecuteReader(); while (reader.Read()) { listData += reader.GetString(0) + " #"; } } catch (Exception ex) { ServerClass.WriteConsoleMsg("GetListViewApplication : " + ex.Message); } finally { MySqlClass.mySQLConn.Close(); } return(listData); }
/// <summary> /// Получение списка проектов и файлов сохраненные на серевер у данного пользователя /// </summary> /// <param name="client">Сокет клиента</param> /// <param name="login">Логин</param> /// <param name="isThisUser"></param> public static void GetListProject(Socket client, string login, bool isThisUser) { try { string quary = "select Project.*, ViewApplication.Name from Project " + "inner join HistoryDownload on HistoryDownload.idProject = Project.idProject " + "inner join Person on Person.idPerson = HistoryDownload.idPerson " + "inner join `User` on `User`.idUser = Person.idUser " + "inner join ViewApplication on ViewApplication.idViewApplication = Project.idViewApplication " + $"where `User`.Login = '******'"; MySqlClass.mySQLConn.Open(); MySql.Data.MySqlClient.MySqlDataReader reader = (new MySql.Data.MySqlClient.MySqlCommand(quary, MySqlClass.mySQLConn)).ExecuteReader(); while (reader.Read()) { int idProject = reader.GetInt32(0); string name = reader.GetString(2); int countVote = reader.GetInt32(3); double rating = reader.GetDouble(4); string date = reader.GetDateTime(5).ToString("dd-MM-yyyy"); string note = (reader.IsDBNull(7) == true) ? string.Empty : reader.GetString(7); string image = (reader.IsDBNull(8) == true) ? string.Empty : reader.GetString(8); string viewApplication = reader.GetString(9); ServerClass.SendMsgClient(client, 2048, 1002, isThisUser, idProject, name, countVote, rating, date, note, image, viewApplication); } } catch (Exception ex) { ServerClass.WriteConsoleMsg("GetListProject : " + ex.Message); } finally { MySqlClass.mySQLConn.Close(); } }