Example #1
0
 private void btn_doc_submit_Click(object sender, EventArgs e)
 {
     try
     {
         dt = this.fun_getPatientCodeTableAdapter.GetData(txt_doc_code.Text);
         if (dt.Rows.Count <= 0)
         {
             MyMSB.Show("លេខដែលបានបញ្ចូលមិនត្រឹមត្រូវ ឫ ហួសកំណត់ការប្រើប្រាស់។", "0", false);
             return;
         }
         else
         {
             GlobalVariable._Pat_id   = dt.Rows[0]["pat_id"].ToString();
             GlobalVariable._Pat_name = string.Format("{0} | {1}", dt.Rows[0]["fullname"].ToString(), dt.Rows[0]["fullKHname"].ToString());
             StoreProcedure.spd_clearPatientCode(txt_doc_code.Text);
             this.Close();
             Thread th = new Thread(openAction);
             th.SetApartmentState(ApartmentState.STA);
             th.Start();
         }
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_doc_code + btn_doc_submit_Click :" + t.Message + t.StackTrace);
     }
 }
Example #2
0
 private void btn_Patient_Search_Click(object sender, EventArgs e)
 {
     try
     {
         if (cboSearchChoice.SelectedIndex == 0)
         {
             this.fun_getAllPatientTableAdapter.FillByPatTel(dentistDataSet.fun_getAllPatient, txtSearch.Text);
         }
         else if (cboSearchChoice.SelectedIndex == 1)
         {
             this.fun_getAllPatientTableAdapter.FillByPatName(dentistDataSet.fun_getAllPatient, txtSearch.Text);
         }
         else if (cboSearchChoice.SelectedIndex == 2)
         {
             this.fun_getAllPatientTableAdapter.FillByPatId(dentistDataSet.fun_getAllPatient, int.Parse(txtSearch.Text));
         }
         else if (cboSearchChoice.SelectedIndex == 3)
         {
             this.fun_getAllPatientTableAdapter.FillByLatinName(dentistDataSet.fun_getAllPatient, txtSearch.Text);
         }
         if (dgvAllPatient.Rows.Count == 0)
         {
             MyMSB.Show("មិនមានពត៌មានទេ សូមពិនិត្យមើលទិន្នន័យដែលបានបញ្ចូលម្តងទៀត", "0", false); return;
         }
     }
     catch (Exception)
     {
         MyMSB.Show("សូមពិនិត្យមើលពត៌មានដែលបានបញ្ចូលឡើងវិញ", "0", false);
         return;
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     btnTotal.PerformClick();
     if (IsAddable())
     {
         foreach (DataGridViewRow row in dgvMed1.Rows)
         {
             if (row.Cells["p_id"].Value.ToString() == pro_Id.ToString())
             {
                 if (Convert.ToDecimal(row.Cells["ps_amount"].Value) + nudAmount.Value > Convert.ToDecimal(txtAmountLeft.Text))
                 {
                     MyMSB.Show("មិនមានទំនិញគ្រប់គ្រាន់សម្រាប់ធ្វើការលក់នោះទេ", "0", false); return;
                 }
                 row.Cells["ps_amount"].Value = Convert.ToDecimal(row.Cells["ps_amount"].Value) + nudAmount.Value;
                 row.Cells["ps_total"].Value  = Convert.ToDecimal(row.Cells["ps_amount"].Value) * nudPricePerUnit.Value;
                 ResetState();
                 return;
             }
         }
         dgvMed1.Rows.Add(
             GlobalVariable._Pat_id,
             dtp.Value.ToString("dd/MMMM/yyyy"),
             GlobalMethod.getCboData(cboServiceDetail, "pro_name"),
             txtUnit.Text, nudAmount.Value.ToString(),
             nudPricePerUnit.Value.ToString(),
             txtTotal.Text,
             "no",
             pro_Id.ToString()
             );
         ResetState();
     }
 }
Example #4
0
 public static bool FormValidate(Form f)
 {
     foreach (Control item in f.Controls)
     {
         if (item is TextBox && ((item as TextBox).Text == "" && item.Enabled == true && !string.IsNullOrEmpty(item.Tag.ToString())))
         {
             MyMSB.Show(item.Tag.ToString(), "0", false);
             return(false);
         }
         if (item is DateTimePicker && ((DateTime.Now.Date.ToString() == ((item as DateTimePicker).Value.Date.ToString())) && item.Enabled == true && !string.IsNullOrEmpty(item.Tag.ToString())))
         {
             MyMSB.Show(item.Tag.ToString(), "0", false);
             return(false);
         }
         if (item is ComboBox && ((item as ComboBox).Text == "" && item.Enabled == true && !string.IsNullOrEmpty(item.Tag.ToString())))
         {
             MyMSB.Show(item.Tag.ToString(), "0", false);
             return(false);
         }
         if (item is NumericUpDown && ((item as NumericUpDown).Value == 0 && (item as NumericUpDown).Enabled == true && !string.IsNullOrEmpty(item.Tag.ToString())))
         {
             MyMSB.Show(item.Tag.ToString(), "0", false);
             return(false);
         }
     }
     return(true);
 }
 bool IsAddable()
 {
     if ((cboService.SelectedIndex != -1 && cboServiceDetail.SelectedIndex != -1) && nudAmount.Value != 0)
     {
         return(true);
     }
     else
     {
         MyMSB.Show("មិនមានទំនិញក្នុងស្តុកដើម្បីធ្វើការលក់នោះទេ", "0", false);  return(false);
     }
 }
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         StoreProcedure.spd_update_patientTreatmentDetail(GlobalVariable._Pat_id, txtTD.Text);
         MyMSB.Show("ការរក្សាទុកបានជោគជ័យ", "1", false);
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_patient_treamentDetail / btnSave_Click :" + t.Message + t.StackTrace);
     }
 }
 private void btn_doc_diagnosis_submit_Click(object sender, EventArgs e)
 {
     if (dt.Rows.Count > 0)
     {
         StoreProcedure.sp_insert_teeth(dt, pat_id);
     }
     dt.Clear();
     if (MyMSB.Show("ការក្សាទុកបានជោគជ័យ។", "1", false))
     {
         btnNext.PerformClick();
     }
 }
Example #8
0
        private void btn_doc_login_Click(object sender, EventArgs e)
        {
            try
            {
                GlobalMethod.TestConnection();
                con = new SqlConnection(StoreProcedure.connectionString);
                con.Open();
                SqlCommand cmd = new SqlCommand("SELECT dbo.fn_check_login(@u,@p)", con);

                cmd.Parameters.Add(new SqlParameter("@u", txt_doc_username.Text.Trim()));
                cmd.Parameters.Add(new SqlParameter("@p", txt_doc_password.Text.Trim()));

                bool HasUser = (bool)cmd.ExecuteScalar();
                if (HasUser)
                {
                    dt = this.fun_getDoctorLoginTableAdapter.GetData(txt_doc_username.Text, txt_doc_password.Text);
                    if (dt.Rows.Count > 0)
                    {
                        GlobalVariable._User_name = dt.Rows[0]["emp_name"].ToString();
                        GlobalVariable._User_id   = dt.Rows[0]["emp_id"].ToString();
                        GlobalVariable._User_role = dt.Rows[0]["emp_role"].ToString();
                        con.Close();
                        if (GlobalVariable._User_role == "doctor" || GlobalVariable._User_role == "admin")
                        {
                            this.Close();
                            Thread th = new Thread(openCode);
                            th.SetApartmentState(ApartmentState.STA);
                            th.Start();
                        }
                    }
                    else
                    {
                        MyMSB.Show("អ្នកមិនមានសិទ្ធក្នុងការប្រើប្រាស់ឡើយ។", "0", false);
                        txt_doc_password.Text = "";
                        txt_doc_username.Text = "";
                        txt_doc_username.Focus();
                    }
                }
                else
                {
                    MyMSB.Show("ឈ្មោះ និង លេខសម្ងាត់មិនត្រឹមត្រូវ", "0", false);
                    txt_doc_password.Text = "";
                    txt_doc_username.Text = "";
                    txt_doc_username.Focus();
                }
                con.Close();
            }
            catch (Exception t)
            {
                GlobalMethod.HandleException("frm_doc_login / btn_doc_login_Click :" + t.Message + t.StackTrace);
            }
        }
        private void btnHome_Click(object sender, EventArgs e)
        {
            if (dataGridView1.Rows.Count > 0)
            {
                if (!MyMSB.Show("អ្នកមិនទាន់បានធ្វើការ Submit ទេ។ តើអ្នកពិតជាចង់បោះបង់មែនទេ?", "0", true))
                {
                    return;
                }
            }
            this.Close();
            Thread th = new Thread(OpenAction);

            th.SetApartmentState(ApartmentState.STA);
            th.Start();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (txtTD.Text != str)
            {
                if (!MyMSB.Show("អ្នកមិនទាន់បានធ្វើការ Save ទេ។ តើអ្នកពិតជាចង់បោះបង់មែនទេ?", "0", true))
                {
                    return;
                }
            }
            this.Close();
            Thread th = new Thread(OpenAction);

            th.SetApartmentState(ApartmentState.STA);
            th.Start();
        }
        private void button1_Click_1(object sender, EventArgs e)
        {
            if (dgvMed1.Rows.Count > 0)
            {
                if (!MyMSB.Show("អ្នកមិនទាន់បានធ្វើការ Submit ទេ។ តើអ្នកពិតជាចង់បោះបង់មែនទេ?", "0", true))
                {
                    return;
                }
            }
            this.Close();
            Thread th = new Thread(OpenTreatmentDetail);

            th.SetApartmentState(ApartmentState.STA);
            th.Start();
        }
Example #12
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow row in dgvMd.Rows)
     {
         if (row.Cells["md_id"].Value​​.ToString() == cboMd.SelectedValue.ToString())
         {
             MyMSB.Show("ប្រវតិ្តវេជ្ជសាស្រ្តបានបញ្ចូលរួចហើយ", "0", false);
             return;
         }
     }
     dgvMd.Rows.Add(txtId.Text, cboMd.SelectedValue, GlobalMethod.getCboData(cboMd, "md_name"), txtDes.Text, "Active");
     if (dgvMd.Rows.Count > 0)
     {
         StoreProcedure.spd_insert_patient_md(dgvMd);
     }
 }
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         if (dataGridView1.Rows.Count <= 0)
         {
             return;
         }
         if (!MyMSB.Show("តើអ្នកពិតជាចង់រក្សាទុកមែនទេ?", "1", true))
         {
             return;
         }
         StoreProcedure.spd_insert_tp(dataGridView1);
         dataGridView1.Rows.Clear();
         MyMSB.Show("ការរក្សាទុកបានជោគជ័យ", "1", false);
         this.fun_getAllPatientServiceTableAdapter.Fill(this.dentistDataSet.fun_getAllPatientService, int.Parse(GlobalVariable._Pat_id));
         btnNext.PerformClick();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_doc_treatment + btnSubmit_Click :" + t.Message + t.StackTrace);
     }
 }
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvMed1.Rows.Count <= 0)
         {
             return;
         }
         if (!MyMSB.Show("តើអ្នកពិតជាចង់រក្សាទុកមែនទេ?", "1", true))
         {
             return;
         }
         StoreProcedure.spd_insert_prescription(dgvMed1);
         StoreProcedure.sp_prescript(dgvMed1);
         dgvMed1.Rows.Clear();
         MyMSB.Show("ការរក្សាទុកបានជោគជ័យ", "1", false);
         this.fun_getPrescriptionByPatIDTableAdapter.Fill(this.dentistDataSet.fun_getPrescriptionByPatID, int.Parse(GlobalVariable._Pat_id));
         btnBack.PerformClick();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_patient_prescription + btnSubmit_Click :" + t.Message + t.StackTrace);
     }
 }
Example #15
0
 public static bool Show(string msg, string sign, bool IsDisplay)
 {
     newMSB = new MyMSB(msg, sign, IsDisplay);
     newMSB.ShowDialog();
     return(result);
 }