Exemple #1
0
        private void ActualiserFormulaire()
        {
            ActiveControl = null;

            medicamentSelectionne = (MedicamentModel)medicSelecComboBox.SelectedItem;

            // Certaines familles peuvent ne pas comporter de médicament
            if (medicamentsDispos.Count == 0)
            {
                codeVal.Text        = "";
                nomCommVal.Text     = "(Aucun médicament dans cette famille)";
                familleVal.Text     = "";
                composVal.Text      = "";
                effetsVal.Text      = "";
                contreIndicVal.Text = "";
                prixEchantVal.Text  = "";
            }

            else
            {
                codeVal.Text        = medicamentSelectionne.DepotLegal;
                nomCommVal.Text     = medicamentSelectionne.NomCommercial;
                familleVal.Text     = medicamentSelectionne.Famille.Libelle;
                composVal.Text      = medicamentSelectionne.Composition;
                effetsVal.Text      = medicamentSelectionne.Effets;
                contreIndicVal.Text = medicamentSelectionne.ContreIndications;
                prixEchantVal.Text  = medicamentSelectionne.PrixEchantillon?.ToString("C") ?? "(Non renseigné)";

                // Grise éventuellement un des boutons Suivant / Précédent
                medicPrecBtn.Enabled = medicSelecComboBox.SelectedIndex != 0;
                medicSuivBtn.Enabled = medicSelecComboBox.SelectedIndex != medicSelecComboBox.Items.Count - 1;
            }
        }
Exemple #2
0
 public void CreateNewMedicament(MedicamentModel medicament, int amount)
 {
     ListOfChoosenMedicament.Add(new ChoosenMedicamentModel(medicament.Name, (Amount + amount), medicament.Price));
     TotalCost         += medicament.Price * (Amount + amount);
     SelectedMedicament = null;
     Amount             = 0;
 }
        public void MedicamentModelTest()
        {
            // Arrange
            string name  = "Apap";
            double price = 10.99;

            // Act
            MedicamentModel Drug = new MedicamentModel(name, price);

            // Assert
            Assert.AreEqual(Drug.Name, name, "Błąd we własciwości Name");
            Assert.AreEqual(Drug.Price, price, "Bład we właściwości Price");
        }