private void btnUpdate_Click(object sender, EventArgs e) { var en = new ManageAdminEntity(); var re = new ManageAdminRepo(); if (ValidateToUpdate() == true) { en.Id = txtAid.Text; en.Name = txtAname.Text; en.Age = txtAage.Text; en.Sex = txtAsex.Text; en.Reference = txtAreference.Text; en.Phone = txtAphone.Text; en.Address = txtAaddress.Text; if (MessageBox.Show("Are you sure ??", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.No) { return; } else { re.Update(en); } } else { MessageBox.Show("Invalid Input"); } }
private void btnSearch_Click(object sender, EventArgs e) { var en = new ManageAdminEntity(); var re = new ManageAdminRepo(); if (ValidateToSave() == true) { en.Id = txtId.Text; en.Name = txtName.Text; en.Phone = txtPhone.Text; re.Search(en, mgvAdmin); } else { MessageBox.Show("Invalid Input"); } }
private void btnDelete_Click(object sender, EventArgs e) { if (mgvAdmin.SelectedRows.Count != 1) { MessageBox.Show("Please select a row first."); } else { var en = new ManageAdminEntity(); var re = new ManageAdminRepo(); en.Id = mgvAdmin.CurrentRow.Cells["id"].Value.ToString(); if (MessageBox.Show("Are you sure ??", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.No) { return; } else { re.Delete(en); } } }