Ejemplo n.º 1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            if (Validation.ValidateDonor(textBoxName.Text, textBoxBloodGroup.Text, textBoxRh.Text, textBoxMail.Text, textBoxPhone.Text))
            {
                DialogResult dialogResult = MessageBox.Show("Do you want to add new Donor?", "Adding new Donor", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    var Donor = new Donor()
                    {
                        Name        = textBoxName.Text,
                        BloodGroup  = textBoxBloodGroup.Text,
                        RH          = textBoxRh.Text,
                        MailAdress  = textBoxMail.Text,
                        PhoneNumber = textBoxPhone.Text
                    };

                    GetDataOps.AddDonor(Donor);
                    frm.dataGridViewDonors.DataSource = GetDataOps.GetAllDonnors();
                }
                else if (dialogResult == DialogResult.No)
                {
                }
            }
            else
            {
                MessageBox.Show("Error! Entries aren't good");
            }
        }