Beispiel #1
0
        private void btnAjouterPrix_Click(object sender, EventArgs e)
        {
            string iDPrix      = txtIDPrixCommanditaire.Text.Trim();
            string description = txtDescriptionPrix.Text.Trim();
            double valeur;

            if (!Double.TryParse(txtValeurPrix.Text, out valeur))
            {
                DialogResult reponse = MessageBox.Show("La valeur doit etre en chiffres",
                                                       "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            double donMinimum;

            if (!Double.TryParse(txtDonMinimumPrix.Text, out donMinimum))
            {
                DialogResult reponse = MessageBox.Show("Le don minimum doit etre en chiffres",
                                                       "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            int qnte_Originale;

            if (!Int32.TryParse(txtQuantitePrix.Text, out qnte_Originale))
            {
                DialogResult reponse = MessageBox.Show("Le quantite doit etre en chiffres",
                                                       "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            string iDCommanditaire = txtIDCommanditaire.Text.Trim();

            if (!String.IsNullOrEmpty(iDPrix) && !String.IsNullOrEmpty(description) && valeur > 0 && donMinimum > 0 && qnte_Originale > 0 && !String.IsNullOrEmpty(iDCommanditaire))
            {
                Prix pentraindentre = new Prix(iDPrix, description, valeur, donMinimum, qnte_Originale, iDCommanditaire);
                if (gste.VerifierPrix(pentraindentre))
                {
                    gste.Prix.Add(pentraindentre);
                    Prix.All_file += pentraindentre.ToFile() + "\r\n";;

                    rtbArea.Text = "Le commanditaire est ajoute";
                    txtIDPrixCommanditaire.Text = String.Empty;
                    txtDescriptionPrix.Text     = String.Empty;
                    txtValeurPrix.Text          = String.Empty;
                    txtDonMinimumPrix.Text      = String.Empty;
                    txtQuantitePrix.Text        = String.Empty;
                    txtIDCommanditaire.Text     = String.Empty;
                    txtIDPrixCommanditaire.Focus();

                    rtbArea.Text = gste.AfficherPrix();
                }
                else
                {
                    DialogResult reponse = MessageBox.Show("Le prix n'est pas ajoute. Vous pouvez entrer un prix avec un ID de prix nouveau et si le numero de commanditaire existe deja",
                                                           "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                DialogResult reponse = MessageBox.Show("Vous devez remplir tous les donnes! ",
                                                       "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #2
0
 private void btnAfficherPrix_Click(object sender, EventArgs e)
 {
     rtbArea.Text = gste.AfficherPrix();
 }