/// <summary> /// Searchs for the name of a specified group in the connection group table. /// </summary> /// <returns><c>true</c>, if group name was found, <c>false</c> otherwise.</returns> public List <GroupForListDto> GetConnectionGroupInfo(string dawgtag, ref List <Exception> excepts) { List <GroupForListDto> userGroupInfo = new List <GroupForListDto>(); const string queryString = "SELECT guacamole_connection_group.connection_group_id, guacamole_connection_group.connection_group_name, guacamole_connection_group.max_connections, guacamole_connection_group.enable_session_affinity FROM guacamole_entity AS e1, guacamole_entity AS e2, guacamole_connection_group, guacamole_connection_group_permission, guacamole_user_group_member, guacamole_user_group " + "WHERE e1.name = @name AND e1.entity_id = member_entity_id AND guacamole_user_group_member.user_group_id = guacamole_user_group.user_group_id AND " + "guacamole_user_group.entity_id = e2.entity_id AND e2.entity_id = guacamole_connection_group_permission.entity_id AND guacamole_connection_group_permission.connection_group_id = guacamole_connection_group.connection_group_id"; try { using (GuacamoleDatabaseConnector gdbc = new GuacamoleDatabaseConnector(ref excepts)) { using (MySqlCommand query = new MySqlCommand(queryString, gdbc.getConnection())) { query.Prepare(); //Add the agruments given query.Parameters.AddWithValue("@name", dawgtag); //Collect the query result column using (MySqlDataReader reader = query.ExecuteReader()) { while (reader.Read()) { GroupForListDto infoDto = new GroupForListDto(); infoDto.Id = Int32.Parse(reader.GetValue(0).ToString()); infoDto.Name = reader.GetValue(1).ToString(); if (reader.GetValue(2).ToString() != String.Empty) { infoDto.Max = Int32.Parse(reader.GetValue(2).ToString()); } if (reader.GetValue(3).ToString() == "0") { infoDto.Affinity = false; } else { infoDto.Affinity = true; } userGroupInfo.Add(infoDto); } } return(userGroupInfo); } } } catch (Exception e) { excepts.Add(e); Console.WriteLine("\n\n\n\n" + e.Message); return(null); } }
/// <summary> /// Searchs for the name of a specified group in the connection group table. /// </summary> /// <returns><c>true</c>, if group name was found, <c>false</c> otherwise.</returns> public GroupForListDto GetAllConnectionGroupInfo(int connectionGroupId, ref List <Exception> excepts) { GroupForListDto infoDto = new GroupForListDto(); const string queryString = "SELECT guacamole_connection_group.connection_group_id, guacamole_connection_group.connection_group_name, guacamole_connection_group.max_connections, guacamole_connection_group.enable_session_affinity FROM guacamole_connection_group " + "WHERE guacamole_connection_group.connection_group_id = @id"; try { using (GuacamoleDatabaseConnector gdbc = new GuacamoleDatabaseConnector(ref excepts)) { using (MySqlCommand query = new MySqlCommand(queryString, gdbc.getConnection())) { query.Prepare(); //Add the agruments given query.Parameters.AddWithValue("@id", connectionGroupId); //Collect the query result column using (MySqlDataReader reader = query.ExecuteReader()) { while (reader.Read()) { infoDto.Id = Int32.Parse(reader.GetValue(0).ToString()); infoDto.Name = reader.GetValue(1).ToString(); if (reader.GetValue(2).ToString() != String.Empty) { infoDto.Max = Int32.Parse(reader.GetValue(2).ToString()); } if (reader.GetValue(3).ToString() == "0") { infoDto.Affinity = false; } else { infoDto.Affinity = true; } } } return(infoDto); } } } catch (Exception e) { excepts.Add(e); Console.WriteLine("\n\n\n\n" + e.Message); return(null); } }
public GroupForListDto GetConnectionGroupsFromId(int id) { //Method Level Variable Declarations List <Exception> excepts = new List <Exception>(); GuacamoleDatabaseGetter getter = new GuacamoleDatabaseGetter(); GroupForListDto dto = new GroupForListDto(); dto = getter.GetAllConnectionGroupInfo(id, ref excepts); dto.Connections = getter.GetAllGroupConnections(dto.Id, ref excepts); dto.Users = getter.GetAllConnectionGroupUsers(dto.Id, ref excepts); return(dto); }