예제 #1
0
        private void btnAjouterDon_Click(object sender, EventArgs e)
        {
            string   iDDon      = txtIDDon.Text;
            DateTime ahjourdui  = DateTime.Now;
            string   dateDuDon  = ahjourdui.ToString("dd MM yyyy");
            string   iDDonateur = txtIDDonneur.Text;
            double   montantDuDon;

            if (!Double.TryParse(txtMontantDon.Text, out montantDuDon))
            {
                DialogResult reponse = MessageBox.Show("La montant du don doit etre en chiffres",
                                                       "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            string iDPrix = txtIDPrixDonneurs.Text;

            if (!String.IsNullOrEmpty(iDDon) && !String.IsNullOrEmpty(iDDonateur) && montantDuDon > 0 && !String.IsNullOrEmpty(iDPrix))
            {
                Don dentrainednetre = new Don(iDDon, dateDuDon, iDDonateur, montantDuDon, iDPrix);
                if (gste.VerifierDon(dentrainednetre))
                {
                    if (gste.AttribuerPrix(dentrainednetre.MontantDuDon1, dentrainednetre.IDPrix1))
                    {
                        gste.Dons.Add(dentrainednetre);
                        Don.All_file += dentrainednetre.ToFile() + "\r\n";;

                        rtbArea.Text           = "Le dons est ajoute";
                        txtIDDon.Text          = String.Empty;
                        txtIDDonneur.Text      = String.Empty;
                        txtMontantDon.Text     = String.Empty;
                        txtIDPrixDonneurs.Text = String.Empty;
                        txtIDDon.Focus();

                        rtbArea.Text = gste.AfficherDons();
                    }
                    else
                    {
                        DialogResult reponse = MessageBox.Show("La prix n'est pas disponible. Choisissez un autre prix",
                                                               "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    DialogResult reponse = MessageBox.Show("Le dons n'est pas ajoute. Vous pouvez entrer un don avec un ID de don nouveau et si le ID PRix et ID Donnateur existe deja",
                                                           "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                DialogResult reponse = MessageBox.Show("Vous devez remplir tous les donnes",
                                                       "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #2
0
 private void btnAfficherDon_Click(object sender, EventArgs e)
 {
     rtbArea.Text = gste.AfficherDons();
 }