private void btn_add_Click(object sender, EventArgs e) { frm_add_patient frm = new frm_add_patient(); frm.Text = "اضافة مريض جديد"; frm.Name = "add_patient"; frm.txt_id.Text = increasekey(pat_id); frm.ShowDialog(); this.frm_patient_Load(sender, e); }
private void btn_edit_Click(object sender, EventArgs e) { frm_add_patient frm = new frm_add_patient(); frm.Text = "تعديل بيانات المريض"; frm.Name = "update_patient"; frm.txt_id.Text = dgv_patient.CurrentRow.Cells[0].Value.ToString(); frm.txt_name.Text = dgv_patient.CurrentRow.Cells[1].Value.ToString(); if (dgv_patient.CurrentRow.Cells[2].Value.ToString() == "ذكر") { frm.rdb_male.Checked = true; } else { frm.rdb_female.Checked = true; } if (dgv_patient.CurrentRow.Cells[5].Value.ToString().Substring(0, 4) == "ارمل") { frm.rdb_armal.Checked = true; } else if (dgv_patient.CurrentRow.Cells[5].Value.ToString().Substring(0, 4) == "اعزب") { frm.rdb_single.Checked = true; } else if (dgv_patient.CurrentRow.Cells[5].Value.ToString().Substring(0, 5) == "متزوج") { frm.rdb_mairried.Checked = true; } else { frm.rdb_motalk.Checked = true; } frm.dtp_birth_date.Value = Convert.ToDateTime(dgv_patient.CurrentRow.Cells[3].Value.ToString()); MessageBox.Show(dgv_patient.CurrentRow.Cells[4].Value.ToString()); frm.dtb_reg_date.Value = Convert.ToDateTime(dgv_patient.CurrentRow.Cells[4].Value.ToString()); frm.txt_address.Text = dgv_patient.CurrentRow.Cells[6].Value.ToString(); frm.txt_phone1.Text = dgv_patient.CurrentRow.Cells[7].Value.ToString(); frm.txt_phone2.Text = dgv_patient.CurrentRow.Cells[8].Value.ToString(); frm.txt_email.Text = dgv_patient.CurrentRow.Cells[9].Value.ToString(); frm.ShowDialog(); this.frm_patient_Load(sender, e); }