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_PatCode.Text = cls_validate.increasekey(pat_id, 4); frm.ShowDialog(); this.frm_patient_Load(sender, e); }
private void btn_edit_Click(object sender, EventArgs e) { DataTable dtt = new DataTable(); dtt = con.selectt("select * from patient where id='" + patCode + "';"); frm_Add_Patient frm = new frm_Add_Patient(); frm.Text = "تعديل بيانات مريض"; frm.Name = "update_Pat"; frm.txt_PatCode.Text = dtt.Rows[0][0].ToString(); frm.txt_patientName.Text = dtt.Rows[0][1].ToString(); frm.txt_resident_address.Text = dtt.Rows[0][2].ToString(); frm.txt_phone.Text = dtt.Rows[0][3].ToString(); frm.cmb_status.SelectedItem = dtt.Rows[0][4].ToString(); frm.Num_Age.Value = int.Parse(dtt.Rows[0][5].ToString()); frm.cmb_job.SelectedItem = dtt.Rows[0][6].ToString(); frm.cmb_Nationality.SelectedItem = dtt.Rows[0][7].ToString(); frm.txt_addressWorking.Text = dtt.Rows[0][8].ToString(); frm.txt_identity.Text = dtt.Rows[0][9].ToString(); frm.txt_identity_state.Text = dtt.Rows[0][10].ToString(); frm.Nu_duration_year.Value = int.Parse(dtt.Rows[0][11].ToString()); frm.txt_husbandName.Text = dtt.Rows[0][12].ToString(); frm.txt_HusbandIdentity.Text = dtt.Rows[0][13].ToString(); frm.txt_patient_Relative_name.Text = dtt.Rows[0][14].ToString(); frm.txt_patient_Relative_identity.Text = dtt.Rows[0][15].ToString(); frm.txt_patient_Relative_phone.Text = dtt.Rows[0][17].ToString(); frm.txt_patient_Relative_address.Text = dtt.Rows[0][18].ToString(); frm.cmb_patient_Relative_job.SelectedItem = dtt.Rows[0][19].ToString(); frm.cmb_patient_Relative_state.SelectedValue = dtt.Rows[0][16].ToString(); dt = con.selectt("select * from Patient_relarive "); frm.cmb_patient_Relative_state.DataSource = dt; frm.cmb_patient_Relative_state.ValueMember = "id"; frm.cmb_patient_Relative_state.DisplayMember = "name"; frm.cmb_patient_Relative_state.SelectedValue = dtt.Rows[0][16].ToString(); frm.ts_btn_clear.Visible = false; frm.ShowDialog(); }
private void btn_edit_Click(object sender, EventArgs e) { frm_Add_Patient frm = new frm_Add_Patient(); frm.Text = "تعديل بيانات مريض"; frm.Name = "update_Pat"; frm.txt_PatCode.Text = dgv_patient.CurrentRow.Cells[0].Value.ToString(); frm.txt_patientName.Text = dgv_patient.CurrentRow.Cells[1].Value.ToString(); frm.txt_resident_address.Text = dgv_patient.CurrentRow.Cells[2].Value.ToString(); frm.txt_phone.Text = dgv_patient.CurrentRow.Cells[3].Value.ToString(); frm.cmb_status.SelectedItem = dgv_patient.CurrentRow.Cells[4].Value.ToString(); frm.Num_Age.Value = int.Parse(dgv_patient.CurrentRow.Cells[5].Value.ToString()); frm.cmb_job.SelectedItem = dgv_patient.CurrentRow.Cells[6].Value.ToString(); frm.cmb_Nationality.SelectedItem = dgv_patient.CurrentRow.Cells[7].Value.ToString(); frm.txt_addressWorking.Text = dgv_patient.CurrentRow.Cells[8].Value.ToString(); frm.txt_identity.Text = dgv_patient.CurrentRow.Cells[9].Value.ToString(); frm.txt_identity_state.Text = dgv_patient.CurrentRow.Cells[10].Value.ToString(); frm.Nu_duration_year.Value = int.Parse(dgv_patient.CurrentRow.Cells[11].Value.ToString()); frm.txt_husbandName.Text = dgv_patient.CurrentRow.Cells[12].Value.ToString(); frm.txt_HusbandIdentity.Text = dgv_patient.CurrentRow.Cells[13].Value.ToString(); frm.txt_patient_Relative_name.Text = dgv_patient.CurrentRow.Cells[14].Value.ToString(); frm.txt_patient_Relative_identity.Text = dgv_patient.CurrentRow.Cells[15].Value.ToString(); frm.txt_patient_Relative_phone.Text = dgv_patient.CurrentRow.Cells[17].Value.ToString(); frm.txt_patient_Relative_address.Text = dgv_patient.CurrentRow.Cells[18].Value.ToString(); frm.cmb_patient_Relative_job.SelectedItem = dgv_patient.CurrentRow.Cells[19].Value.ToString(); frm.cmb_patient_Relative_state.SelectedValue = dgv_patient.CurrentRow.Cells[16].Value.ToString(); dt = con.selectt("select * from Patient_relarive ;"); frm.cmb_patient_Relative_state.DataSource = dt; frm.cmb_patient_Relative_state.ValueMember = "id"; frm.cmb_patient_Relative_state.DisplayMember = "name"; frm.cmb_patient_Relative_state.SelectedValue = dgv_patient.CurrentRow.Cells[16].Value.ToString(); frm.patient_relatve_state = dgv_patient.CurrentRow.Cells[16].Value.ToString(); frm.ts_btn_clear.Visible = false; frm.ShowDialog(); this.frm_patient_Load(sender, e); }