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, "خطا"); } } }
public void Create(PatientsHistory obj) { DL.Create(obj); }