private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         StoreProcedure.spd_update_mdHistoryByPatID(pat_id, md_id, cboMdStatus.SelectedItem.ToString(), txtMdDes.Text);
         this.Hide();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_Edit_Patient_Md / btnAdd_Click " + t.Message);
     }
 }
 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);
     }
 }
Esempio n. 3
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);
            }
        }
Esempio n. 4
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         StoreProcedure.spd_insert_patientXray(int.Parse(GlobalVariable._Pat_id), (int)cboXray.SelectedValue, DateTime.Now, txtCode.Text);
         this.fun_getPatientXrayByPatIDTableAdapter.Fill(this.dentistDataSet.fun_getPatientXrayByPatID, int.Parse(GlobalVariable._Pat_id));
         ColorClass();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_patient_Xray / btnAdd_Click : " + t.Message + t.StackTrace);
     }
 }
Esempio n. 5
0
 private void frm_patient_information_Load(object sender, EventArgs e)
 {
     try
     {
         this.fun_getPatientByIDTableAdapter.Fill(this.dentistDataSet.fun_getPatientByID, int.Parse(pat_id));
         lblPatName.Text = pat_name;
         lblPatId.Text   = pat_id;
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_patient_information + frm_patient_information_Load:" + t.Message + t.StackTrace);
     }
 }
 private void cboService_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (cboService.SelectedIndex != -1)
         {
             this.fun_getAllServiceDetailTableAdapter.Fill(dentistDataSet.fun_getAllServiceDetail, (int)cboService.SelectedValue);
         }
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_doc_treatment + cboService_SelectedIndexChanged :" + t.Message + t.StackTrace);
     }
 }
Esempio n. 7
0
 private void frm_patient_Xray_Load(object sender, EventArgs e)
 {
     try
     {
         // TODO: This line of code loads data into the 'dentistDataSet.fun_getXrayMachine' table. You can move, or remove it, as needed.
         this.fun_getXrayMachineTableAdapter.Fill(this.dentistDataSet.fun_getXrayMachine);
         this.fun_getPatientXrayByPatIDTableAdapter.Fill(this.dentistDataSet.fun_getPatientXrayByPatID, int.Parse(GlobalVariable._Pat_id));
         ColorClass();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_patient_Xray / frm_patient_Xray_Load : " + t.Message + t.StackTrace);
     }
 }
 private void frm_patient_prescription_Load(object sender, EventArgs e)
 {
     try
     {
         StartState();
         // TODO: This line of code loads data into the 'dentistDataSet.fun_getAllMedCategory' table. You can move, or remove it, as needed.
         this.fun_getAllMedCategoryTableAdapter.Fill(this.dentistDataSet.fun_getAllMedCategory);
         this.fun_getPrescriptionByPatIDTableAdapter.Fill(this.dentistDataSet.fun_getPrescriptionByPatID, int.Parse(GlobalVariable._Pat_id));
         dgvMed1.AllowUserToDeleteRows = true;
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_patient_prescription + frm_patient_prescription_Load:" + t.Message + t.StackTrace);
     }
 }
 private void cboService_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (cboService.SelectedIndex == -1)
         {
             return;
         }
         this.fun_getAllMedDetailbyCatIDTableAdapter.Fill(this.dentistDataSet.fun_getAllMedDetailbyCatID, (int)cboService.SelectedValue);
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_patient_prescription + cboService_SelectedIndexChanged :" + t.Message + t.StackTrace);
     }
 }
Esempio n. 10
0
 private void frm_doc_code_Load(object sender, EventArgs e)
 {
     try
     {
         txt_doc_code.KeyPress += new KeyPressEventHandler(EventHandlerr.TextBoxNumberOnly);
         this.fun_getAllPatientTableAdapter.Fill(this.dentistDataSet.fun_getAllPatient);
         this.fun_getAllPatientTableAdapter.Fill(this.dentistDataSet.fun_getAllPatient);
         lblDocName.Text = GlobalVariable._User_name;
         lblDocId.Text   = GlobalVariable._User_id;
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_doc_code + frm_doc_code_Load :" + t.Message + t.StackTrace);
     }
 }
Esempio n. 11
0
 private void btnShowPic_Click(object sender, EventArgs e)
 {
     try
     {
         this.fun_getPatientImageByIDTableAdapter.Fill(dentistDataSet.fun_getPatientImageByID, int.Parse(GlobalVariable._Pat_id));
         int rotateOrder = int.Parse(this.fun_getPatientImageByIDTableAdapter.GetData(int.Parse(GlobalVariable._Pat_id)).Rows[0]["pat_image_order"].ToString());
         for (int i = 0; i < rotateOrder; i++)
         {
             GlobalMethod.rotateimage(pictureBox1);
         }
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_patient_detail + btnShowPic_Click :" + t.Message + t.StackTrace);
     }
 }
Esempio n. 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);
     }
 }
Esempio n. 13
0
 private void btnInactive_Click(object sender, EventArgs e)
 {
     try
     {
         string md_name, md_des, md_status;
         int    md_id;
         md_id     = int.Parse(dgvMd.CurrentRow.Cells["md_id"].Value.ToString());
         md_name   = dgvMd.CurrentRow.Cells["md_name"].Value.ToString();
         md_des    = dgvMd.CurrentRow.Cells["md_description"].Value.ToString();
         md_status = dgvMd.CurrentRow.Cells["md_status"].Value.ToString();
         frm_edit_medicalHistory form = new frm_edit_medicalHistory(md_name, md_des, md_status, int.Parse(txtId.Text), md_id);
         form.ShowDialog();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_patient_detail + btnInactive_Click :" + t.Message + t.StackTrace);
     }
 }
Esempio n. 14
0
 public static void sp_prescript(DataGridView dgv)
 {
     //[pro_id][int] NULL,
     //[qty][int] NULL
     //@pres
     try
     {
         DataTable dt;
         con = new SqlConnection(connectionString);
         con.Open();
         cmd             = new SqlCommand("[dbo].[sp_prescript]", con);
         cmd.CommandType = CommandType.StoredProcedure;
         SqlParameter param = new SqlParameter();
         param.ParameterName = "@pres";
         dt = GlobalMethod.convertDGVtoDT(dgv);
         dt.Columns.Remove("pat_id");
         dt.Columns.Remove("ps_date");
         dt.Columns.Remove("ps_unit");
         dt.Columns.Remove("ps_des");
         dt.Columns.Remove("ps_price");
         dt.Columns.Remove("ps_total");
         dt.Columns.Remove("ps_status");
         dt.Columns.Add("id");
         dt.Columns["id"].SetOrdinal(0);
         dt.Columns["p_id"].SetOrdinal(1);
         dt.Columns["ps_amount"].SetOrdinal(2);
         int i = 1;
         foreach (DataRow row in dt.Rows)
         {
             row["id"] = i;
             i++;
         }
         param.Value = dt;
         cmd.Parameters.Add(param);
         cmd.ExecuteNonQuery();
         con.Close();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("StoreProcedure / sp_prescript : " + t.Message);
     }
 }
Esempio n. 15
0
 public static DataTable get_teeth(int user_id)
 {
     try
     {
         DataTable dt = new DataTable();
         using (con = new SqlConnection(connectionString))
         {
             SqlCommand     cdm = new SqlCommand("select * from tbl_teeth where pat_id=" + user_id.ToString() + " order by teeth_number asc", con);
             SqlDataAdapter adp = new SqlDataAdapter(cdm);
             adp.Fill(dt);
             dt.Columns.RemoveAt(0);
             dt.Columns.RemoveAt(dt.Columns.Count - 1);
         }
         return(dt);
     }
     catch (Exception e)
     {
         GlobalMethod.HandleException("StoreProcedure / get_teeth: " + e.Message);
         return(null);
     }
 }
 private void cboServiceDetail_SelectedValueChanged(object sender, EventArgs e)
 {
     try
     {
         OperateState();
         if (cboServiceDetail.SelectedIndex == -1)
         {
             return;
         }
         string[] arr = cboServiceDetail.SelectedValue.ToString().Split('|');
         pro_Id = int.Parse(arr[0]);
         nudPricePerUnit.Value = Convert.ToDecimal(arr[1]);
         txtUnit.Text          = arr[2];
         txtAmountLeft.Text    = arr[3];
         ResetState();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_patient_prescription + cboServiceDetail_SelectedValueChanged:" + t.Message + t.StackTrace);
     }
 }
Esempio n. 17
0
 private void frm_patient_detail_Activated(object sender, EventArgs e)
 {
     try
     {
         dgvMd.Rows.Clear();
         DataTable dt = this.fun_getActiveMedicalHistoryForSpecificPaientTableAdapter.GetData(int.Parse(txtId.Text));
         foreach (DataRow row in dt.Rows)
         {
             dgvMd.Rows.Add(
                 row["pat_id"].ToString(),
                 row["md_id"].ToString(),
                 row["md_name"].ToString(),
                 row["md_description"].ToString(),
                 row["md_status"].ToString()
                 );
         }
         GlobalMethod.getGreenRed("md_status", dgvMd, "Inactive");
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_patient_detail + frm_patient_detail_Activated :" + t.Message + t.StackTrace);
     }
 }
 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 cboServiceDetail_SelectedValueChanged(object sender, EventArgs e)
 {
     try
     {
         OperataState();
         if (cboServiceDetail.SelectedIndex == -1)
         {
             return;
         }
         string[] arr;
         arr = cboServiceDetail.SelectedValue.ToString().Split('|');
         service_id_detail   = int.Parse(arr[0]);
         txtMax.Text         = arr[1];
         txtMin.Text         = arr[2];
         nudCharge.Maximum   = Convert.ToDecimal(txtMax.Text);
         nudCharge.Minimum   = Convert.ToDecimal(txtMin.Text);
         nudDiscount.Maximum = Convert.ToDecimal(txtMax.Text);
         ResetState();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_doc_treatment + cboServiceDetail_SelectedValueChanged :" + t.Message + t.StackTrace);
     }
 }
Esempio n. 20
0
 public static void spd_insert_patient_md(DataGridView dgv)
 {
     //TableStructure
     //pat_id | md_id | md_name | md_description | md_status
     try
     {
         DataTable dt;
         con = new SqlConnection(connectionString);
         con.Open();
         cmd             = new SqlCommand("[dbo].[spd_insert_patientMd]", con);
         cmd.CommandType = CommandType.StoredProcedure;
         SqlParameter param = new SqlParameter();
         param.ParameterName = "@tempMd";
         dt          = GlobalMethod.convertDGVtoDT(dgv);
         param.Value = dt;
         cmd.Parameters.Add(param);
         cmd.ExecuteNonQuery();
         con.Close();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("StoreProcedure / spd_insert_patient_diagnose : " + t.Message);
     }
 }
 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);
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (IsAddable())
         {
             btnTotal.PerformClick();
             dataGridView1.Rows.Add(GlobalVariable._Pat_id, dtp.Value.ToString("dd/MMMM/yyyy"),
                                    service_id_detail.ToString(),
                                    GlobalMethod.getCboData(cboServiceDetail, "sd_name"),
                                    nudAmount.Value.ToString(),
                                    nudCharge.Value.ToString(),
                                    nudDiscount.Value.ToString(),
                                    txtTotal.Text,
                                    GlobalVariable._User_name,
                                    GlobalVariable._User_id, "no");
             ResetState();
         }
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_doc_treatment + button1_Click :" + t.Message + t.StackTrace);
     }
 }