//-------------------------------------------------------------------- public int InsertAllMédicament(Prescription pPrescription) { int liErreur = DataBase.DeleteRecords("PrescriptionMédicament", "IDPrescription = '" + pPrescription.ID.ToString() + "'"); if (pPrescription.ListMédicament.Count == 0) { return(liErreur); } IDictionaryEnumerator lDictionaryEnumerator = pPrescription.ListMédicament.GetEnumerator(); int liI = 0; string[] lsCols = new string[2]; string[] lsValues = new string[2]; lsCols[0] = "IDPrescription"; lsCols[1] = "IDMédicament"; while (lDictionaryEnumerator.MoveNext()) { lsValues[0] = "'" + pPrescription.ID.ToString() + "'"; lsValues[1] = "'" + ((Médicament)lDictionaryEnumerator.Value).ID.ToString() + "'"; if (DataBase.Insert("Médicament", lsCols, lsValues) == liErreur) { liI = liErreur; } if (liI != liErreur) { liI += 1; } } return(liI); }
//-------------------------------------------------------------------- public int InsertAllTransactionVente(Session pSession) { int liErreur = DataBase.DeleteRecords("SessionTransactionVente", "IDSession = '" + pSession.ID.ToString() + "'"); if (pSession.ListTransactionVente.Count == 0) { return(liErreur); } IDictionaryEnumerator lDictionaryEnumerator = pSession.ListTransactionVente.GetEnumerator(); int liI = 0; string[] lsCols = new string[2]; string[] lsValues = new string[2]; lsCols[0] = "IDSession"; lsCols[1] = "IDTransactionVente"; while (lDictionaryEnumerator.MoveNext()) { lsValues[0] = "'" + pSession.ID.ToString() + "'"; lsValues[1] = "'" + ((TransactionVente)lDictionaryEnumerator.Value).ID.ToString() + "'"; if (DataBase.Insert("TransactionVente", lsCols, lsValues) == liErreur) { liI = liErreur; } if (liI != liErreur) { liI += 1; } } return(liI); }