Пример #1
0
 private void TC_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (TC.SelectedTab == tabMd)
         {
             this.fun_getActiveMedicalHistoryForSpecificPaientTableAdapter.Fill(this.dentistDataSet.fun_getActiveMedicalHistoryForSpecificPaient, int.Parse(pat_id));
         }
         else if (TC.SelectedTab == tabXray)
         {
             this.fun_getPatientXrayByPatIDTableAdapter.Fill(this.dentistDataSet.fun_getPatientXrayByPatID, int.Parse(pat_id));
             ColorClass();
         }
         else if (TC.SelectedTab == tabTP)
         {
             this.fun_getAllPatientServiceTableAdapter.Fill(this.dentistDataSet.fun_getAllPatientService, int.Parse(pat_id));
         }
         else if (TC.SelectedTab == tabPs)
         {
             this.fun_getPrescriptionByPatIDTableAdapter.Fill(this.dentistDataSet.fun_getPrescriptionByPatID, int.Parse(pat_id));
         }
         else if (TC.SelectedTab == TabTd)
         {
             this.fun_getPatientTdByPatIDTableAdapter.Fill(this.dentistDataSet.fun_getPatientTdByPatID, int.Parse(pat_id));
         }
         else if (TC.SelectedTab == tabDiag)
         {
             this.fun_getPatientDiagnoseByIDTableAdapter.Fill(this.dentistDataSet.fun_getPatientDiagnoseByID, int.Parse(pat_id));
         }
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_patient_information + TC_SelectedIndexChanged:" + t.Message + t.StackTrace);
     }
 }
Пример #2
0
 private void RetreiveData(int pat_id)
 {
     try
     {
         DataTable dt;
         this.fun_getPatientByIDTableAdapter.Fill(dentistDataSet.fun_getPatientByID, pat_id);
         this.fun_getMedicalHistoryForSpecificPatientTableAdapter.Fill(dentistDataSet.fun_getMedicalHistoryForSpecificPatient, pat_id);
         dt = this.fun_getActiveMedicalHistoryForSpecificPaientTableAdapter.GetData(pat_id);
         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 + RetreiveData :" + t.Message + t.StackTrace);
     }
 }
Пример #3
0
 public static void spd_insert_tp(DataGridView dgv)
 {
     //TableStructure
     //pat_id | [tp_date] | [sd_id] | [charge_amount] | [discount_amount] | [total_amount] | [doc_id] [int] NULL | [paid_status] | [tp_amount] decimal(18,0)
     try
     {
         DataTable dt;
         con = new SqlConnection(connectionString);
         con.Open();
         cmd             = new SqlCommand("[dbo].[spd_insert_tp]", con);
         cmd.CommandType = CommandType.StoredProcedure;
         SqlParameter param = new SqlParameter();
         param.ParameterName = "@tempTp";
         dt = GlobalMethod.convertDGVtoDT(dgv);
         dt.Columns.Remove("service_name");
         dt.Columns.Remove("doc_name");
         dt.Columns["tp_amount"].SetOrdinal(8);
         param.Value = dt;
         cmd.Parameters.Add(param);
         cmd.ExecuteNonQuery();
         con.Close();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("StoreProcedure / spd_insert_tp : " + t.Message + t.StackTrace);
     }
 }
Пример #4
0
 public static void spd_insert_prescription(DataGridView dgv)
 {       //Table Structure
         //[pat_id] [int] NULL,
         //[ps_date] [date] NULL,
         //[ps_des] [nvarchar](max) NULL,
         //[ps_unit] [nvarchar](max) NULL,
         //[ps_amount] [int] NULL,
         //[ps_price] [decimal](18, 0) NULL,
         //[ps_total] [decimal](18, 0) NULL,
         //[ps_status] [nvarchar](5) NULL
         //[pro_id] [int] NULL,
     //@tempPs
     try
     {
         DataTable dt;
         con = new SqlConnection(connectionString);
         con.Open();
         cmd             = new SqlCommand("[dbo].[spd_insert_prescription]", con);
         cmd.CommandType = CommandType.StoredProcedure;
         SqlParameter param = new SqlParameter();
         param.ParameterName = "@tempPs";
         dt          = GlobalMethod.convertDGVtoDT(dgv);
         param.Value = dt;
         cmd.Parameters.Add(param);
         cmd.ExecuteNonQuery();
         con.Close();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("StoreProcedure / spd_insert_tp : " + t.Message);
     }
 }
Пример #5
0
        //Ridh's part

        public static void sp_insert_teeth(DataTable dt, int cus_id)
        {
            try
            {
                dt.Columns.Add("Customer Id", typeof(int));
                foreach (DataRow dr in dt.Rows)
                {
                    dr[4] = cus_id;
                }
                using (con = new SqlConnection(connectionString))
                {
                    con.Open();
                    SqlCommand cmd = new SqlCommand("insert_teeth", con);
                    cmd.CommandType = CommandType.StoredProcedure;

                    SqlParameter param = new SqlParameter();
                    //SqlParameter param = new SqlParameter("@sto", SqlDbType.Structured)
                    //{
                    //    TypeName = "dbo.stock",
                    //    Value = dt
                    //};
                    param.ParameterName = "@teeth";
                    param.SqlDbType     = SqlDbType.Structured;
                    param.Value         = dt;
                    cmd.Parameters.Add(param);
                    cmd.ExecuteNonQuery();
                    con.Close();
                    dt.Columns.RemoveAt(dt.Columns.Count - 1);
                }
            }
            catch (Exception e)
            {
                GlobalMethod.HandleException("StoreProcedure / Insert Teeth : " + e.Message);
            }
        }
Пример #6
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);
     }
 }
 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 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);
     }
 }
Пример #9
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);
            }
        }
Пример #10
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);
     }
 }
Пример #11
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);
     }
 }
Пример #12
0
 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);
     }
 }
Пример #13
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);
     }
 }
Пример #15
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);
     }
 }
 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);
     }
 }
Пример #17
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);
     }
 }
Пример #18
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);
     }
 }
Пример #19
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);
     }
 }
Пример #20
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);
     }
 }
Пример #22
0
 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);
     }
 }
Пример #23
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);
     }
 }
Пример #24
0
 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);
     }
 }
 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);
     }
 }
Пример #26
0
 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);
     }
 }
Пример #27
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);
     }
 }