1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
public class clCatalogue
{
private static Dictionary<string, clAttribut> cCatalogue;
//getter du catalogue
public static Dictionary<string, clAttribut> cpCatalogue
{
get { return cCatalogue; }
}
public string GetNameCat(string TheKey)
{
clAttribut LaSortie = new clAttribut();
cpCatalogue.TryGetValue(TheKey, out LaSortie);
try
{
return LaSortie.spLibelle;
}
catch (NullReferenceException)
{
MessageBox.Show("La référence " + TheKey + " n'existe pas dans le catalogue");
return null;
}
}
public void RemplirCatalogue()
{
clConnection connection = new clConnection();
string strRequete = "Select distinct isnull(NAME, 'NA') AS toto, isnull(REMARKS, 'NA'), isnull(COLTYPE, 'NA'), isnull(TBNAME, 'NA'), isnull(LENGTH, 0) from sy0_col where nrid in (select max(nrid) name from sy0_col group by name) order by toto DESC";
SqlCommand command = new SqlCommand(strRequete, connection.getCurseur());
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
string name = reader.GetString(0);
clAttribut UnAttribut = new clAttribut(reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetInt32(4));
cpCatalogue.Add(name, UnAttribut);
}
reader.Close();
}
} |
Partager