static void GenForfaitsFromClientData(List <XMLClientData> in_client_data, List <ForfaitData> out_forfait_data) { int id_cpt = 1; foreach (XMLClientData c_c_data in in_client_data) { bool alreadyIn = false; ForfaitData found_data = null; foreach (ForfaitData c_f in out_forfait_data) { if (c_f.Nom == c_c_data.forfait.ToCharArray()[0]) { found_data = c_f; alreadyIn = true; break; } } if (alreadyIn == false) { ForfaitData new_data = new ForfaitData(); new_data.Nom = c_c_data.forfait.ToCharArray()[0]; new_data.id_bd = id_cpt; out_forfait_data.Add(new_data); c_c_data.Ref_Forfait_id = new_data.id_bd; id_cpt++; } else { c_c_data.Ref_Forfait_id = found_data.id_bd; } } }
public void InsertForfait(ForfaitData data) { string cmd_string = @"insert into EQUIPE4.FORFAIT (COUTPARMOIS,TYPEFORFAIT,LOCATIONMAX,DUREEMAXJOUR) values ( " + data.coupPerMount + ", '" + data.Nom + "'," + data.location_max + "," + data.location_duree + ")"; OracleCommand cmd = new OracleCommand(cmd_string, m_connection); cmd.CommandType = CommandType.Text; cmd.ExecuteReader(); cmd = null; }