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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
public family load_family(int id_manufacturer, int id_family)
{
family myFamily = new family(id_manufacturer, id_family);
this.connexion.Connect();
SqlCommand command = new SqlCommand
(...);
SqlDataReader reader = command.ExecuteReader();
if (this.reader.HasRows)
{
while (reader.Read())
{
child_family tmpChild = new child_family (...);
SqlDataReader readerProduct = commandProduct.ExecuteReader();
if (readerProduct.HasRows)
{
while (readerProduct.Read())
{
product myProduct = new product(...);
SqlCommand commandCaracteristic = new SqlCommand("getCaracteristicsFromSampler", this.connexion.connectToDB);
(...);
SqlDataReader readerCaracteristic = commandCaracteristic.ExecuteReader();
if (readerCaracteristic.HasRows)
{
while (readerCaracteristic.Read())
{
caracteristic myCaracteristic = new caracteristic(...);
SqlCommand commandValue = new SqlCommand("getValueCaracteristicFromIdProductAndCaracteristic", this.connexion.connectToDB);
(...);
SqlDataReader readerValue = commandValue.ExecuteReader();
if (readerValue.HasRows)
{
readerValue.Read();
myCaracteristic.value = readerValue["VALEUR_CARACTERISTIQUE"].ToString();
}
readerValue.Close();
(...);
SqlCommand commandCommission = new SqlCommand(requestSQL, this.connexion.connectToDB);
(...);
SqlDataReader readerCommission = commandCommission.ExecuteReader();
if (readerCommission.HasRows)
{
while (readerCommission.Read())
{
commission myCommission = new commission(readerCommission["DATE_PRELEVEMENT"].ToString().Trim());
myProduct.commissions.Add(myCommission);
}
}
readerCommission.Close();
myProduct.caracteristics.Add(myCaracteristic);
}
}
readerCaracteristic.Close();
tmpChild.products.Add(myProduct);
}
}
this.readerProduct.Close();
myFamily.child_families.Add(tmpChild);
}
}
this.reader.Close();
connexion.Close();
return (myFamily);
} |
Partager