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"); } }
private void buttonSearch_Click(object sender, EventArgs e) { if (Validation.IsNullEmptyWhiteSpace(textBoxBloodGroup.Text) && Validation.IsNullEmptyWhiteSpace(textBoxRh.Text)) { frm.dataGridViewDonors.DataSource = GetDataOps.GetDonnorsbyGroupAndRh(textBoxBloodGroup.Text, textBoxRh.Text); } else { MessageBox.Show("Enter value of Blood Group or RH"); } }
private void buttonSearch_Click(object sender, EventArgs e) { if (Validation.IsNullEmptyWhiteSpace(textBox1.Text)) { frm.dataGridViewDonors.DataSource = GetDataOps.GetDonnorsbyName(textBox1.Text); } else { MessageBox.Show("Enter name"); } }
public void FillInfo() { if (GetDataOps.DonorUpdateId != 0) { textBoxName.Text = GetDataOps.GetDonorById(GetDataOps.DonorUpdateId).Name; textBoxBloodGroup.Text = GetDataOps.GetDonorById(GetDataOps.DonorUpdateId).BloodGroup.ToString(); textBoxRh.Text = GetDataOps.GetDonorById(GetDataOps.DonorUpdateId).RH.ToString(); textBoxMail.Text = GetDataOps.GetDonorById(GetDataOps.DonorUpdateId).MailAdress.ToString(); textBoxPhone.Text = GetDataOps.GetDonorById(GetDataOps.DonorUpdateId).PhoneNumber.ToString(); } }
private void buttonUpdate_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 Upate Donor?", "Updating Donor", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { GetDataOps.UpdateDonor(GetDataOps.DonorUpdateId, textBoxName.Text, textBoxBloodGroup.Text, textBoxRh.Text, textBoxMail.Text, textBoxPhone.Text); frm.dataGridViewDonors.DataSource = GetDataOps.GetAllDonnors(); } else if (dialogResult == DialogResult.No) { } } else { MessageBox.Show("Error! Entries are not good"); } }
private void deleteDonorToolStripMenuItem_Click(object sender, EventArgs e) { try { GetDataOps.DonorUpdateId = int.Parse(dataGridViewDonors.SelectedCells[0].Value.ToString()); DialogResult dialogResult = MessageBox.Show("Are you sure?", "Deleting Donor", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { GetDataOps.DeleteDonor(GetDataOps.DonorUpdateId); dataGridViewDonors.DataSource = GetDataOps.GetAllDonnors(); } else if (dialogResult == DialogResult.No) { } } catch (Exception) { MessageBox.Show("You must select Id of Donor or whole row"); } }
private void listAllDonorsToolStripMenuItem_Click(object sender, EventArgs e) { dataGridViewDonors.DataSource = GetDataOps.GetAllDonnors(); }