public Article(int id, string nom, string forme, Matiere matiere)
 {
     this.id      = id;
     this.nom     = nom;
     this.forme   = forme;
     this.matiere = matiere;
 }
        /**
         * Ajoute l'article dans l'usine
         */
        private void button_AjoutMat_Click(object sender, EventArgs e)
        {
            DialogResult rep = MessageBox.Show("Ajouter l'article " + this.textBox_Nom.Text + " d'id [" + this.textBox_id.Text + "] ?", "Confirmation d'ajout dans l'usine", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            switch (rep)
            {
            case DialogResult.Yes:
                if (verifyFields())
                {
                    Matiere mat1 = (Matiere)this.comboBox_matiere.SelectedItem;
                    Matiere mat2 = (Matiere)this.comboBox_dyn_matiere2.SelectedItem;
                    Matiere mat3 = (Matiere)this.comboBox_dyn_matiere3.SelectedItem;

                    if (this.rdButton_Foot.Checked)
                    {
                        usine.addArticle(new BallonFoot(Convert.ToInt16(this.textBox_id.Text), this.textBox_Nom.Text, this.textBox_forme.Text, new Matiere(mat1.getNomMatiere, Convert.ToDouble(mat1.getDensiteMatiere)), new Matiere(mat2.getNomMatiere, Convert.ToDouble(mat2.getDensiteMatiere))));
                    }
                    else if (this.rdButton_Golf.Checked)
                    {
                        usine.addArticle(new ClubGolf(Convert.ToInt16(this.textBox_id.Text), this.textBox_Nom.Text, this.textBox_forme.Text, new Matiere(mat1.getNomMatiere, Convert.ToDouble(mat1.getDensiteMatiere)), Convert.ToInt16(this.numericUpDown_numero.Value)));
                    }
                    else
                    {
                        usine.addArticle(new PlancheVoile(Convert.ToInt16(this.textBox_id.Text), this.textBox_Nom.Text, this.textBox_forme.Text, new Matiere(mat1.getNomMatiere, Convert.ToDouble(mat2.getDensiteMatiere)), new Matiere(mat2.getNomMatiere, Convert.ToDouble(mat2.getDensiteMatiere)), new Matiere(mat3.getNomMatiere, Convert.ToDouble(mat3.getDensiteMatiere))));
                    }
                    MessageBox.Show("L'article a bien été ajouté ! ", "Succès ajout", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.rdButton_Foot.Checked  = false;
                    this.rdButton_Golf.Checked  = false;
                    this.rdButton_Voile.Checked = false;
                    clearForm();
                }

                else
                {
                    MessageBox.Show("Merci de renseigner tout les champs !!!", "ERREUR FORM", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                break;

            case DialogResult.No:
                break;
            }
        }
Exemple #3
0
 public ClubGolf(int id, string nom, string forme, Matiere matiere, int numero) : base(id, nom, forme, matiere)
 {
     this.numero = numero;
 }
Exemple #4
0
 public PlancheVoile(int id, string nom, string forme, Matiere matiere, Matiere matiereSupp1, Matiere matiereSupp2) : base(id, nom, forme, matiere)
 {
     this.matiereSupp1 = matiere;
     this.matiereSupp2 = matiereSupp1;
     this.matiereSupp3 = matiereSupp2;
 }
Exemple #5
0
 public BallonFoot(int id, string nom, string forme, Matiere matiere, Matiere matiereSupp1) : base(id, nom, forme, matiere)
 {
     this.matiereSupp1 = matiere;
     this.matiereSupp2 = matiereSupp1;
 }
Exemple #6
0
 public void deleteMatiere(Matiere matiere)
 {
     this.usineMatiere.Remove(matiere);
 }
Exemple #7
0
 public void addMatiere(Matiere matiere)
 {
     this.usineMatiere.Add(matiere);
 }