コード例 #1
0
 private void btn_delete_Click(object sender, EventArgs e)
 {
     try
     {
         cls_patient p = new cls_patient();
         if (dgv_patient.Rows.Count > 0)
         {
             DialogResult dr = MessageBox.Show("هل تريد حذف المريض المحدد", "تحذير", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
             if (dr == DialogResult.Yes)
             {
                 if (
                     p.deletedata("delete", dgv_patient.CurrentRow.Cells[0].Value.ToString(),
                                  "delete", "", "delete", "delete", "5", "delete", "delete", "delete", "delete",
                                  "delete", "5", "delete", "delete", "delete", "delete", "delete", "delete", "delete",
                                  "delete", "1/1/2016", dgv_patient.CurrentRow.Cells[21].Value.ToString()))
                 {
                     this.frm_patient_Load(sender, e);
                     MessageBox.Show("تم الحذف بنجاح ");
                 }
                 else
                 {
                     MessageBox.Show("لم يتم الحذف لان هذ المريض له زيارات الرجاء حذف الزيارات ");
                 }
             }
         }
         else
         {
             MessageBox.Show("تم حذف جميع المرضى ", "انتبه", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }
     }
     catch (Exception ex)
     { MessageBox.Show(ex.Message); }
 }
コード例 #2
0
        int VisibleTime = 1000;  //in milliseconds
        private void frm_patient_Load(object sender, EventArgs e)
        {
            try
            {
                lblTime.Text        = DateTime.Now.ToLongTimeString();
                lblDate.Text        = DateTime.Now.ToShortDateString();
                lb_curent_user.Text = Main_Form.curnt_emp;

                pat = new cls_patient();
                dt  = new DataTable();
                dt  = pat.select_patient();
                dv  = new DataView(dt);
                if (dt.Rows.Count > 0)
                {
                    pat_id = dt.Rows[dt.Rows.Count - 1][0].ToString();
                }
                else
                {
                    pat_id = "Pat_100";
                }
                dgv_patient.DataSource            = dv;
                dgv_patient.Columns[0].HeaderText = "الكود";
                dgv_patient.Columns[1].HeaderText = "الاسم";
                dgv_patient.Columns[3].HeaderText = "الهاتف";
                dgv_patient.Columns[4].HeaderText = "الحالة الاجتماعية";
                dgv_patient.Columns[5].HeaderText = "السن";

                dgv_patient.Columns[2].Visible  = false;
                dgv_patient.Columns[6].Visible  = false;
                dgv_patient.Columns[7].Visible  = false;
                dgv_patient.Columns[8].Visible  = false;
                dgv_patient.Columns[9].Visible  = false;
                dgv_patient.Columns[10].Visible = false;
                dgv_patient.Columns[11].Visible = false;
                dgv_patient.Columns[12].Visible = false;
                dgv_patient.Columns[13].Visible = false;
                dgv_patient.Columns[14].Visible = false;
                dgv_patient.Columns[15].Visible = false;
                dgv_patient.Columns[16].Visible = false;
                dgv_patient.Columns[17].Visible = false;
                dgv_patient.Columns[18].Visible = false;
                dgv_patient.Columns[19].Visible = false;
                dgv_patient.Columns[20].Visible = false;
                dgv_patient.Columns[21].Visible = false;
                if (dt.Rows.Count > 0)
                {
                    dgv_patient.DataSource = dv;
                }
                else
                {
                    MessageBox.Show("لا يوجد مرضى مسجلين");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #3
0
ファイル: frm_Add_Patient.cs プロジェクト: ah01436/HIS
        private void ts_btn_save_Click(object sender, EventArgs e)
        {
            string      regis_date = DateTime.Now.Date.ToShortDateString();
            string      user       = Main_Form.curnt_user;
            cls_patient p          = new cls_patient();

            try
            {
                if (vaildate_text())
                {
                    if (this.Name == "add_patient")
                    {
                        if (p.insertdata("insert", txt_PatCode.Text, txt_patientName.Text, txt_resident_address.Text,
                                         txt_phone.Text, cmb_status.SelectedItem.ToString(), Num_Age.Value.ToString(),
                                         cmb_job.SelectedItem.ToString(), cmb_Nationality.SelectedItem.ToString(), txt_addressWorking.Text,
                                         txt_identity.Text, txt_identity_state.Text, Nu_duration_year.Value.ToString(), txt_husbandName.Text,
                                         txt_HusbandIdentity.Text, txt_patient_Relative_name.Text, patient_relatve_state,
                                         cmb_patient_Relative_job.SelectedItem.ToString(),
                                         txt_patient_Relative_address.Text, txt_patient_Relative_identity.Text,
                                         txt_patient_Relative_phone.Text, regis_date, user
                                         ))
                        {
                            MessageBox.Show("تمت الاضافة بنجاح ", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.Close();
                        }
                    }
                    else if (this.Name == "update_Pat")
                    {
                        if (p.updatedata("update", txt_PatCode.Text, txt_patientName.Text, txt_resident_address.Text,
                                         txt_phone.Text, cmb_status.SelectedItem.ToString(), Num_Age.Value.ToString(),
                                         cmb_job.SelectedItem.ToString(), cmb_Nationality.SelectedItem.ToString(), txt_addressWorking.Text,
                                         txt_identity.Text, txt_identity_state.Text, Nu_duration_year.Value.ToString(), txt_husbandName.Text,
                                         txt_HusbandIdentity.Text, txt_patient_Relative_name.Text, patient_relatve_state,
                                         cmb_patient_Relative_job.SelectedItem.ToString(),
                                         txt_patient_Relative_address.Text, txt_patient_Relative_identity.Text,
                                         txt_patient_Relative_phone.Text, regis_date, user
                                         ))
                        {
                            MessageBox.Show("تمت التعديل بنجاح ", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.Close();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }