Exemple #1
0
 private void btn_Reg_Pat_Save_Click(object sender, EventArgs e)
 {
     try
     {
         byte[] imgByte = null;
         if (!GlobalMethod.FormValidate(this))
         {
             return;
         }
         if (!MyMSB.Show("តើអ្នកពិតជាចង់រក្សាទុកមែនទេ?", "1", true))
         {
             return;
         }
         if (imgLoc != null)
         {
             imgByte = GlobalMethod.GetImageByte(imgLoc);
         }
         StoreProcedure.spd_update_patientByID(
             int.Parse(txtId.Text),
             txtKhFname.Text,
             txtKhLname.Text,
             txtFname.Text,
             txtLname.Text,
             txtGender.Text,
             nudDob.Value.ToString(),
             txtJob.Text,
             txtAddress.Text,
             imgByte,
             dtpAppoint.Value.ToString("yyyy-MM-dd"),
             txtNati.Text,
             txtTel.Text,
             string.Format("{0}:{1}", nudHour.Value.ToString(), nudMinute.Value.ToString())
             );
         if (dgvMd.Rows.Count > 0)
         {
             StoreProcedure.spd_insert_patient_md(dgvMd);
         }
         GlobalVariable._Patient_id = txtId.Text;
         if (MyMSB.Show("ការកែរប្រែបានជោគជ័យ", "1", false))
         {
             btn_Reg_Pat_Cancel.PerformClick();
         }
         ;
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_Patient_Detail_Edit / btn_Reg_Pat_Save_Click : " + t.Message);
     }
 }
        private void btn_Reg_Pat_Save_Click(object sender, EventArgs e)
        {
            if (!GlobalMethod.FormValidate(this) || IsPassValidated())
            {
                return;
            }
            if (!MyMSB.Show("តើអ្នកពិតជាចង់រក្សាទុកមែនទេ?", "1", true))
            {
                return;
            }


            byte[] imgBinary = GlobalMethod.GetImageByte(imgLoc);
            StoreProcedure.spd_insert_patient(
                txtKhFname.Text,
                txtKhLname.Text,
                txtFname.Text,
                txtLname.Text,
                cboGender.Text,
                nudDob.Value.ToString(),
                txtJob.Text,
                txtAddress.Text,
                imgBinary,
                dtpAppoint.Value.ToString("yyyy-MM-dd"),
                txtNati.Text,
                txtTel.Text,
                string.Format("{0}:{1}", nudHour.Value.ToString(), nudMinute.Value.ToString())
                );
            if (dgvMd.Rows.Count > 0)
            {
                StoreProcedure.spd_insert_patient_md(dgvMd);
            }
            GlobalVariable._Patient_id = txtId.Text;


            MyMSB.Show("ការរក្សាទុកបានជោគជ័យ", "1", true);
            this.Close();
            Thread th = new Thread(openPatient);

            th.SetApartmentState(ApartmentState.STA);
            th.Start();
        }