private void btDelete_Click(object sender, RoutedEventArgs e) { if (lvPatients.SelectedItem == null) { MessageBox.Show("Выберите пациента"); return; } PatientBL patient = (PatientBL)lvPatients.SelectedItem; string res = patient.Delete(); if (!string.IsNullOrEmpty(res)) { MessageBox.Show(res); } Window_Activated(sender, null); }
private void buttonX2_Click(object sender, EventArgs e) { if (getValue(0) == null) { labelX4.Text = ""; } else { try { Patient obj = new Patient(); obj.Id = (int)getValue(0); BL.Delete(obj); PatientsHistory patientHistoryObj = new PatientsHistory(); patientHistoryObj.Name = getValue(1).ToString(); patientHistoryObj.PhoneNo = getValue(2).ToString(); patientHistoryObj.Address = getValue(3).ToString(); patientHistoryObj.Age = Convert.ToInt32(getValue(4).ToString()); if (getValue(5).ToString().Equals("True")) { patientHistoryObj.Gender = true; } else { patientHistoryObj.Gender = false; } patientHistoryObj.DoctorName = getValue(6).ToString(); patientHistoryObj.RoomNo = getValue(7).ToString(); patientHistoryObj.ReceptionistName = getValue(8).ToString(); patientHistoryObj.Date = DateTime.Now; PaHiBL.Create(patientHistoryObj); refresh(); if (dataGridView1.SelectedCells.Count > 0) { labelX4.Text = getValue(1).ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "خطا"); } } }
private void buttonX2_Click(object sender, EventArgs e) { if (getValue(0) == null) { } else { try { Patient obj = new Patient(); obj.Id = (int)getValue(0); BL.Delete(obj); refresh(); if (dataGridView1.SelectedCells.Count > 0) { labelX4.Text = getValue(1).ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "خطا"); } } }
public JsonResult DeletePatient(int patientid) { obj.Delete(patientid, out outmodel); return(Json(new { result = outmodel }, JsonRequestBehavior.AllowGet)); }
public void Delete(Patient patient) { bl.Delete(patient); }