Exemple #1
0
 private void autoCompleteUC1_SelectedValueChanged(object sender, object e)
 {
     try
     {
         trn_eye_exam_hdr eye = _PatientRegis.trn_eye_exam_hdrs.FirstOrDefault();
         if (eye != null)
         {
             if (e == null)
             {
                 eye.teh_doctor_code    = null;
                 eye.teh_doctor_license = null;
                 eye.teh_doctor_name_en = null;
                 eye.teh_doctor_name_th = null;
             }
             else
             {
                 eye.teh_doctor_code    = ((DoctorProfile)e).SSUSR_Initials;
                 eye.teh_doctor_license = ((DoctorProfile)e).CTPCP_SMCNo;
                 DoctorName dn = obj.GetDoctorName(((DoctorProfile)e).CTPCP_Desc);
                 eye.teh_doctor_name_en = dn.NameEN;
                 eye.teh_doctor_name_th = dn.NameTH;
             }
         }
     }
     catch (Exception ex)
     {
         Program.MessageError(this.Name, "autoCompleteUC1_SelectedValueChanged", ex, false);
     }
 }
Exemple #2
0
 public void EndEdit()
 {
     try
     {
         DateTime         dateNow      = Program.GetServerDateTime();
         trn_eye_exam_hdr patient_eyes = bsPatientEyes.OfType <trn_eye_exam_hdr>().FirstOrDefault();
         if (patient_eyes.teh_create_by == null)
         {
             patient_eyes.teh_create_date = dateNow;
         }
         patient_eyes.teh_update_date = dateNow;
         patient_eyes.teh_advp_others = favoriteTextBox1.Text;
         patient_eyes.teh_advp_others = favoriteTextBox1.Text;
         patient_eyes.trn_eye_diagnosis.Clear();
         patient_eyes.trn_eye_diagnosis.AddRange(sourceDiag.Select(x => new trn_eye_diagnosi
         {
             ted_topic       = x.side,
             ted_main        = x.name_desc,
             ted_detail      = x.val,
             ted_create_by   = username,
             ted_create_date = dateNow,
             ted_update_by   = username,
             ted_update_date = dateNow
         }));
     }
     catch
     {
     }
 }
Exemple #3
0
        private void dgvDiagnosis_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView gv = (DataGridView)sender;

            if (gv.Columns[e.ColumnIndex].Name == "Del")
            {
                clsSourceDiagnosis result = (clsSourceDiagnosis)gv.Rows[e.RowIndex].DataBoundItem;
                sourceDiag.Remove(result);
                fieldDestinationCls fieldDesti = mapField.Where(x => x.fieldDestination == result.fieldName).FirstOrDefault();
                if (fieldDesti != null)
                {
                    trn_eye_exam_hdr patient_eyes = bsPatientEyes.OfType <trn_eye_exam_hdr>().FirstOrDefault();
                    TypeDescriptor.GetProperties(patient_eyes)[fieldDesti.fieldCheck].SetValue(patient_eyes, null);
                }
            }
        }
Exemple #4
0
 private void btnreset_Click(object sender, EventArgs e)
 {
     try
     {
         for (int i = sourceDiag.Count - 1; i >= 0; i--)
         {
             fieldDestinationCls fieldDesti = mapField.Where(x => x.fieldDestination == sourceDiag[i].fieldName).FirstOrDefault();
             if (fieldDesti != null)
             {
                 trn_eye_exam_hdr patient_eyes = bsPatientEyes.OfType <trn_eye_exam_hdr>().FirstOrDefault();
                 TypeDescriptor.GetProperties(patient_eyes)[fieldDesti.fieldCheck].SetValue(patient_eyes, null);
             }
         }
         sourceDiag.Clear();
     }
     catch
     {
     }
 }
Exemple #5
0
 private bool saveData()
 {
     try
     {
         tabEyesExamUC1.EndEdit();
         try
         {
             try
             {
                 trn_patient_regi patientRegis = cdc.trn_patient_regis
                                                 .Where(x => x.tpr_id == this.tpr_id)
                                                 .FirstOrDefault();
                 trn_eye_exam_hdr eyeHdr = patientRegis.trn_eye_exam_hdrs.FirstOrDefault();
                 if (eyeHdr != null)
                 {
                     eyeHdr.teh_is_eye_record = true;
                 }
             }
             catch
             {
             }
             cdc.SubmitChanges();
         }
         catch (System.Data.Linq.ChangeConflictException)
         {
             foreach (ObjectChangeConflict occ in cdc.ChangeConflicts)
             {
                 cdc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object);
             }
             cdc.SubmitChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         Program.MessageError(this.Name, "saveData()", ex, false);
         return(false);
     }
 }
Exemple #6
0
        private void btnDefault_Click(object sender, EventArgs e)
        {
            trn_eye_exam_hdr patient_eyes = bsPatientEyes.OfType <trn_eye_exam_hdr>().FirstOrDefault();

            foreach (PropertyDescriptor prop in TypeDescriptor.GetProperties(patient_eyes))
            {
                if (prop.Name != "teh_color_vision")
                {
                    if (mapField.Select(x => x.fieldCheck).Contains(prop.Name) || prop.Name == "teh_advp" || prop.Name == "teh_color_vision")
                    {
                        if (prop.PropertyType == typeof(System.Nullable <char>))
                        {
                            prop.SetValue(patient_eyes, 'N');
                        }
                        else if (prop.PropertyType == typeof(string))
                        {
                            prop.SetValue(patient_eyes, "N");
                        }
                    }
                }
            }
        }
Exemple #7
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         tabEyesExamUC1.EndEdit();
         try
         {
             try
             {
                 DateTime dateNow = Program.GetServerDateTime();
                 trn_patient_book_result bookResult = dbc.trn_patient_book_results
                                                      .Where(x => x.tpr_id == this._tpr_id &&
                                                             x.tpbr_radiology == "EM")
                                                      .FirstOrDefault();
                 if (bookResult == null)
                 {
                     bookResult = new trn_patient_book_result()
                     {
                         tpr_id           = (int)this._tpr_id,
                         tpbr_radiology   = "EM",
                         tpbr_create_by   = Program.CurrentUser.mut_username,
                         tpbr_create_date = dateNow
                     };
                     dbc.trn_patient_book_results.InsertOnSubmit(bookResult);
                 }
                 bookResult.tpbr_flag_saved      = true;
                 bookResult.tpbr_show_sections   = true;
                 bookResult.tpbr_show_summary    = true;
                 bookResult.tpbr_not_show_report = false;
                 bookResult.tpbr_active          = true;
                 bookResult.tpbr_update_by       = Program.CurrentUser.mut_username;
                 bookResult.tpbr_update_date     = dateNow;
                 trn_patient_regi patientRegis = dbc.trn_patient_regis
                                                 .Where(x => x.tpr_id == this._tpr_id)
                                                 .FirstOrDefault();
                 trn_eye_exam_hdr eyeHdr = patientRegis.trn_eye_exam_hdrs.FirstOrDefault();
                 if (eyeHdr != null)
                 {
                     eyeHdr.teh_is_eye_record = true;
                 }
             }
             catch
             {
             }
             dbc.SubmitChanges();
         }
         catch (System.Data.Linq.ChangeConflictException)
         {
             foreach (System.Data.Linq.ObjectChangeConflict occ in dbc.ChangeConflicts)
             {
                 dbc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object);
             }
             dbc.SubmitChanges();
         }
         lbAlertMsg.Text = "Save Data Complete.";
     }
     catch (Exception ex)
     {
         lbAlertMsg.Text = "โปรดลองอีกครั้ง";
         Program.MessageError(this.Name, "btnSave_Click", ex, false);
     }
 }
Exemple #8
0
        public void GetEyeExam(int tpr_id, string username)
        {
            using (InhCheckupDataContext dbc = new InhCheckupDataContext())
            {
                DateTime         dateNow = globalCls.GetServerDateTime();
                trn_patient_regi tpr     = dbc.trn_patient_regis.Where(x => x.tpr_id == tpr_id).FirstOrDefault();
                if (tpr != null)
                {
                    var visitdate = tpr.trn_patient_regis_detail != null && tpr.trn_patient_regis_detail.tpr_real_arrived_date != null
                                       ? tpr.trn_patient_regis_detail.tpr_real_arrived_date.Value.Date
                                       : tpr.tpr_arrive_date != null
                                       ? tpr.tpr_arrive_date.Value.Date
                                       : dateNow;
                    trn_eye_exam_hdr      teh = dbc.trn_eye_exam_hdrs.Where(x => x.tpr_id == tpr_id).FirstOrDefault();
                    trn_basic_measure_hdr hdr = dbc.trn_basic_measure_hdrs.Where(x => x.tpr_id == tpr_id).FirstOrDefault();
                    trn_patient_event     mvt = dbc.trn_patient_events.Where(x => x.tpr_id == tpr_id && x.mst_event.mvt_code == "EM").FirstOrDefault();

                    if (mvt != null)
                    {
                        hdr.tbm_glass_or_contact = string.IsNullOrEmpty(teh.teh_vision_le) == true && string.IsNullOrEmpty(teh.teh_vision_out_le) == false ? 'Y' : 'N';
                        hdr.tbm_color_blind      = teh.teh_color_vision == null ? (char?)null : (char?)teh.teh_color_vision;
                        //tbm_vision_lvisual_with_lens
                        if (teh.teh_vision_le == null && teh.teh_vision_out_llens == null)
                        {
                            hdr.tbm_vision_lvisual_with_lens = null;
                        }
                        else if (teh.teh_vision_le != null)
                        {
                            if (teh.teh_vision_le.Contains("20/"))
                            {
                                hdr.tbm_vision_lvisual_with_lens = findEyeValue(teh.teh_vision_le);
                            }
                            else
                            {
                                hdr.tbm_vision_lvisual_with_lens = teh.teh_vision_le;
                            }
                        }
                        else if (teh.teh_vision_out_llens != null)
                        {
                            if (teh.teh_vision_out_llens.Contains("20/"))
                            {
                                hdr.tbm_vision_lvisual_with_lens = findEyeValue(teh.teh_vision_out_llens);
                            }
                            else
                            {
                                hdr.tbm_vision_lvisual_with_lens = teh.teh_vision_out_llens.ToString();
                            }
                        }
                        //tbm_vision_rvisual_with_lens

                        if (teh.teh_vision_re == null && teh.teh_vision_out_rlens == null)
                        {
                            hdr.tbm_vision_rvisual_with_lens = null;
                        }
                        else if (teh.teh_vision_re != null)
                        {
                            if (teh.teh_vision_re.Contains("20/"))
                            {
                                hdr.tbm_vision_rvisual_with_lens = findEyeValue(teh.teh_vision_re);
                            }
                            else
                            {
                                hdr.tbm_vision_rvisual_with_lens = teh.teh_vision_re;
                            }
                        }
                        else if (teh.teh_vision_out_llens != null)
                        {
                            if (teh.teh_vision_out_rlens.Contains("20/"))
                            {
                                hdr.tbm_vision_rvisual_with_lens = findEyeValue(teh.teh_vision_out_rlens);
                            }
                            else
                            {
                                hdr.tbm_vision_rvisual_with_lens = teh.teh_vision_out_rlens.ToString();
                            }
                        }



                        hdr.tbm_vision_lvisual_out_lens = teh.teh_vision_out_le == null
                                                           ? null
                                                           : teh.teh_vision_out_le.Contains("20/")
                                                           ? findEyeValue(teh.teh_vision_out_le)
                                                           : null;
                        hdr.tbm_vision_rvisual_out_lens = teh.teh_vision_out_re == null
                                                           ? null
                                                           : teh.teh_vision_out_re.Contains("20/")
                                                           ? findEyeValue(teh.teh_vision_out_re)
                                                           : null;

                        //   }
                        dbc.SubmitChanges();
                        var labconfig = new LabClass.GetLabConfigCls().GetByPaientLab(tpr_id);

                        trn_patient tpt  = dbc.trn_patients.Where(x => x.tpt_id == tpr.tpt_id).FirstOrDefault();
                        var         ages = new LabClass.InterpretLabCls().calAge(tpt.tpt_dob.Value.Date, visitdate);
                        var         sex  = Convert.ToChar(tpt.tpt_gender.ToString());

                        mst_lab lab           = dbc.mst_labs.Where(x => x.mlb_type == 'C' && x.mlb_status == 'A' && x.mlb_code == "VS001").FirstOrDefault();
                        var     maplabspecial = new LabClass.MapLab
                        {
                            code      = lab.mlb_code,
                            id        = lab.mlb_id,
                            nameen    = lab.mlb_ename,
                            nameth    = lab.mlb_tname,
                            seq       = lab.mlb_chart_seq,
                            setcode   = lab.mlb_lab_set,
                            usechart  = false,
                            valuetype = lab.mlb_value_type,
                            status    = 'E'
                        };
                        var rs    = new LabClass.InterpretLabCls().GetResult(maplabspecial, labconfig, ages, sex);
                        var rslab = new LabClass.InterpretLab
                        {
                            setcode     = lab.mlb_lab_set,
                            code        = lab.mlb_code,
                            name_en     = lab.mlb_ename,
                            name_th     = lab.mlb_tname,
                            seq         = lab.mlb_chart_seq,
                            mlr_id      = rs.mlr_id,
                            summary     = rs.summary,
                            result_en   = rs.result_en,
                            result_th   = rs.result_th,
                            result_jp   = rs.result_jp,
                            normalrange = rs.normalrange,
                            unit        = rs.unit,
                            status      = rs.status
                        };



                        var labvs = tpr.trn_patient_lab_vitalsigns.Where(x => x.tplv_lab_code == maplabspecial.code && x.tpr_id == tpr_id).FirstOrDefault();
                        if (labvs != null)
                        {
                            labvs.tplv_summary       = rslab.summary == null ? null : rslab.summary.ToString();
                            labvs.tplv_lab_name_th   = rslab.name_th;
                            labvs.tplv_lab_name_en   = rslab.name_en;
                            labvs.tplv_lab_result_th = rslab.result_th;
                            labvs.tplv_lab_result_en = rslab.result_en;
                            labvs.tplv_lab_result_jp = rslab.result_jp;
                            labvs.tplv_normal_range  = rslab.normalrange;
                            labvs.tplv_update_by     = username;
                            labvs.tplv_update_date   = dateNow;
                        }
                    }
                    try { dbc.SubmitChanges(); }
                    catch (Exception ex)
                    {
                        Class.globalCls.MessageError("GetVitalSignCls", "GetEyeExam", ex.Message);
                        throw ex;
                    }

                    // }
                }
            }
        }
Exemple #9
0
        private void LoadTransaction()
        {
            var objeye_exam = (from teh in dbc.trn_eye_exam_hdrs where teh.tpr_id == TprID select teh).FirstOrDefault();

            if (objeye_exam != null)
            {
                //Tab 1
                bindingSourcetrn_eye_exam_hdr.DataSource = objeye_exam;
                trn_eye_exam_hdr objCurrentEyeExam = (trn_eye_exam_hdr)bindingSourcetrn_eye_exam_hdr.Current;

                trn_eye_aircrew_thai objthai      = dbc.trn_eye_aircrew_thais.Where(c => c.teh_id == objCurrentEyeExam.teh_id).FirstOrDefault();
                trn_eye_aircrew_faa  objfa        = dbc.trn_eye_aircrew_faas.Where(c => c.teh_id == objCurrentEyeExam.teh_id).FirstOrDefault();
                trn_eye_aircrew_can  objcan       = dbc.trn_eye_aircrew_cans.Where(c => c.teh_id == objCurrentEyeExam.teh_id).FirstOrDefault();
                trn_eye_aircrew_aus  objaus       = dbc.trn_eye_aircrew_aus.Where(c => c.teh_id == objCurrentEyeExam.teh_id).FirstOrDefault();
                trn_eye_diagnosi     objdiagnosis = dbc.trn_eye_diagnosis.Where(c => c.teh_id == objCurrentEyeExam.teh_id).FirstOrDefault();

                Program.SetValueRadioGroup(pnlcolor, objCurrentEyeExam.teh_color_vision);

                Program.SetValueRadioGroup(pnlEyeHidRE, objCurrentEyeExam.teh_eyehid_le);
                Program.SetValueRadioGroup(pnlEyeHidLE, objCurrentEyeExam.teh_eyehid_re);
                cmbHidSpecifyRE.SelectedText = objCurrentEyeExam.teh_eyehid_rspecify;
                cmbHidSpecifyRE.SelectedText = objCurrentEyeExam.teh_eyehid_lspecify;

                Program.SetValueRadioGroup(pnlOrbitRE, objCurrentEyeExam.teh_orbit_re);
                Program.SetValueRadioGroup(pnlOrbitLE, objCurrentEyeExam.teh_orbit_le);

                Program.SetValueRadioGroup(pnlConjRE, objCurrentEyeExam.teh_conj_re);
                Program.SetValueRadioGroup(pnlConjLE, objCurrentEyeExam.teh_conj_le);

                Program.SetValueRadioGroup(pnlCornRE, objCurrentEyeExam.teh_corn_re);
                Program.SetValueRadioGroup(pnlCornRE, objCurrentEyeExam.teh_corn_le);

                Program.SetValueRadioGroup(pnlIrisLE, objCurrentEyeExam.teh_iris_re);
                Program.SetValueRadioGroup(pnlIrisRE, objCurrentEyeExam.teh_iris_le);

                Program.SetValueRadioGroup(pnlAC_depth, objCurrentEyeExam.teh_acdep);

                Program.SetValueRadioGroup(pnlLensRE, objCurrentEyeExam.teh_lens_re);
                Program.SetValueRadioGroup(pnllensLE, objCurrentEyeExam.teh_lens_le);

                Program.SetValueRadioGroup(pnlRetinaRE, objCurrentEyeExam.teh_retina_re);
                Program.SetValueRadioGroup(pnlRetinaLE, objCurrentEyeExam.teh_retina_le);

                Program.SetValueRadioGroup(pnlCularRE, objCurrentEyeExam.teh_cular_re);
                Program.SetValueRadioGroup(pnlCularLE, objCurrentEyeExam.teh_cular_le);

                Program.SetValueRadioGroup(pnlFundusMacRE, objCurrentEyeExam.teh_fund_rmacula);
                Program.SetValueRadioGroup(pnlFundusMacLE, objCurrentEyeExam.teh_fund_lmacula);

                Program.SetValueRadioGroup(pnlNormalcupdiscRE, objCurrentEyeExam.teh_fund_rcup);
                Program.SetValueRadioGroup(pnlNormalcupdiscLE, objCurrentEyeExam.teh_fund_lcup);

                if (objCurrentEyeExam.teh_advp_disease == 'Y')
                {
                    chk_adpDisease.Checked = true;
                }
                if (objCurrentEyeExam.teh_advp_med == 'Y')
                {
                    chk_adpMed.Checked = true;
                }
                if (objCurrentEyeExam.teh_advp_care == 'Y')
                {
                    chk_adpCare.Checked = true;
                }
                if (objCurrentEyeExam.teh_advp_fu == 'Y')
                {
                    chk_adpFU.Checked = true;
                }
                if (objCurrentEyeExam.teh_advp_medical == 'Y')
                {
                    chk_adpMedical.Checked = true;
                }

                var master = (from a in dbc.trn_eye_diagnosis
                              join b in dbc.trn_eye_exam_hdrs on a.teh_id equals b.teh_id
                              where a.teh_id == b.teh_id && b.tpr_id == TprID && a.ted_main == "Refractive Error" || a.ted_main == "Visual Disturbance"
                              select new
                {
                    main = a.ted_main,
                    detail = a.ted_detail
                }).Count();

                if (master != 0)
                {
                    btnAddDiagnosis_Click(null, null);
                }

                //tab 2
                if (objthai != null)
                {
                    bindingSourcetrn_eye_aircrew_thai.DataSource = objthai;
                    if (TprID == 0)
                    {
                        bindingSourcetrn_eye_aircrew_thai.DataSource = dbc.trn_eye_aircrew_thais;
                        bindingSourcetrn_eye_aircrew_thai.AddNew();
                    }
                    else
                    {
                        trn_eye_aircrew_thai trneyethai = (trn_eye_aircrew_thai)bindingSourcetrn_eye_aircrew_thai.Current;
                        Program.SetValueRadioGroup(pnlcolorvision, trneyethai.tea_color_vis.ToString());
                        Program.SetValueRadioGroup(pnlvisionfailed, trneyethai.tea_vis_field.ToString());
                    }
                }
                else if (objthai == null)
                {
                    bindingSourcetrn_eye_aircrew_thai.DataSource = dbc.trn_eye_aircrew_thais;
                    bindingSourcetrn_eye_aircrew_thai.AddNew();
                }

                //tab 3
                if (objfa != null)
                {
                    bindingSourcetrn_eye_aircrew_faa.DataSource = objfa;
                    if (TprID == 0)
                    {
                        bindingSourcetrn_eye_aircrew_faa.DataSource = dbc.trn_eye_aircrew_faas;
                        bindingSourcetrn_eye_aircrew_faa.AddNew();
                    }
                    else
                    {
                        trn_eye_aircrew_faa trneyefa = (trn_eye_aircrew_faa)bindingSourcetrn_eye_aircrew_faa.Current;
                        Program.SetValueRadioGroup(pnlcolorvisionFa, trneyefa.taf_color_vis.ToString());
                        Program.SetValueRadioGroup(pnlvisionfailedFa, trneyefa.taf_vis_field.ToString());
                    }
                }
                else if (objfa == null)
                {
                    bindingSourcetrn_eye_aircrew_faa.DataSource = dbc.trn_eye_aircrew_faas;
                    bindingSourcetrn_eye_aircrew_faa.AddNew();
                }

                //tab 4
                if (objcan != null)
                {
                    bindingSourcetrn_eye_aircrew_can.DataSource = objcan;
                    if (TprID == 0)
                    {
                        bindingSourcetrn_eye_aircrew_can.DataSource = dbc.trn_eye_aircrew_cans;
                        bindingSourcetrn_eye_aircrew_can.AddNew();
                    }
                    else
                    {
                        trn_eye_aircrew_can trneyecan = (trn_eye_aircrew_can)bindingSourcetrn_eye_aircrew_can.Current;
                        Program.SetValueRadioGroup(pnlcolorcan, trneyecan.tac_color_vis.ToString());
                        Program.SetValueRadioGroup(pnlvisionfailedcan, trneyecan.tac_vis_field.ToString());
                    }
                }
                else if (objcan == null)
                {
                    bindingSourcetrn_eye_aircrew_can.DataSource = dbc.trn_eye_aircrew_cans;
                    bindingSourcetrn_eye_aircrew_can.AddNew();
                }

                //tab 5
                if (objaus != null)
                {
                    bindingSourcetrn_eye_aircrew_aus.DataSource = objaus;
                    if (TprID == 0)
                    {
                        bindingSourcetrn_eye_aircrew_aus.DataSource = dbc.trn_eye_aircrew_aus;
                        bindingSourcetrn_eye_aircrew_aus.AddNew();
                    }
                    else
                    {
                        trn_eye_aircrew_aus trneyeaus = (trn_eye_aircrew_aus)bindingSourcetrn_eye_aircrew_aus.Current;
                        Program.SetValueRadioGroup(pnlcolorAus, trneyeaus.taa_color_vis.ToString());
                        Program.SetValueRadioGroup(pnlvisionfailedAus, trneyeaus.taa_vis_field.ToString());
                    }
                }
                else if (objaus == null)
                {
                    bindingSourcetrn_eye_aircrew_aus.DataSource = dbc.trn_eye_aircrew_aus;
                    bindingSourcetrn_eye_aircrew_aus.AddNew();
                }


                trn_patient_regi objcurrentRegis = (from t1 in dbc.trn_patient_regis where t1.tpr_id == TprID select t1).FirstOrDefault();
                if (objcurrentRegis != null)
                {
                    string strHn              = objcurrentRegis.trn_patient.tpt_hn_no;
                    string strEN              = objcurrentRegis.tpr_en_no;
                    string strUser            = Program.CurrentUser.mut_username;
                    Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls();
                    DataTable dtservice       = ws.GetMedicineByDoctor(strHn, strEN, strUser);
                    //DataTable dtservice = ws.GetMedicineByDoctor("01-92-006363", "O01-12-876565", "001915668");
                    DataSet ds = new DataSet("dss");
                    Tmptable.Columns.Add("Item");
                    Tmptable.Columns.Add("OrderName");
                    Tmptable.Columns.Add("Instruction");
                    Tmptable.Columns.Add("Dosage");
                    Tmptable.Columns.Add("UOM");
                    Tmptable.Columns.Add("Freg");
                    ds.Tables.Add(Tmptable);
                    if (dtservice.Rows.Count > 0)
                    {
                        for (int i = 0; i <= dtservice.Rows.Count - 1; i++)
                        {
                            DataRow newRow = Tmptable.NewRow();
                            Tmptable.Rows.Add(newRow);
                            newRow["Item"]              = i + 1;
                            newRow["OrderName"]         = dtservice.Rows[i][2].ToString();
                            newRow["Instruction"]       = dtservice.Rows[i][10].ToString();
                            newRow["Dosage"]            = dtservice.Rows[i][17].ToString();
                            newRow["UOM"]               = dtservice.Rows[i][18].ToString();
                            newRow["Freg"]              = dtservice.Rows[i][20].ToString();
                            dgvMedical.DataSource       = Tmptable;
                            dgvMedical.Columns[0].Width = 50;
                        }
                    }
                }
            }
            else
            {
                bindingSourcetrn_eye_exam_hdr.DataSource = dbc.trn_eye_exam_hdrs;
                bindingSourcetrn_eye_exam_hdr.AddNew();
                bindingSourcetrn_eye_aircrew_thai.DataSource = dbc.trn_eye_aircrew_thais;
                bindingSourcetrn_eye_aircrew_thai.AddNew();
                bindingSourcetrn_eye_aircrew_faa.DataSource = dbc.trn_eye_aircrew_faas;
                bindingSourcetrn_eye_aircrew_faa.AddNew();
                bindingSourcetrn_eye_aircrew_can.DataSource = dbc.trn_eye_aircrew_cans;
                bindingSourcetrn_eye_aircrew_can.AddNew();
                bindingSourcetrn_eye_aircrew_aus.DataSource = dbc.trn_eye_aircrew_aus;
                bindingSourcetrn_eye_aircrew_aus.AddNew();
            }
        }
Exemple #10
0
        private void Save()
        {
            Boolean  saveIsCompleted = false;
            DateTime datenowvalue    = Program.GetServerDateTime();
            int      teh_id          = 0;

            if (tabControl1.SelectedTab == t1)
            {
                var EyeExam = (trn_eye_exam_hdr)this.bindingSourcetrn_eye_exam_hdr.Current;
                EyeExam.tpr_id               = TprID;
                EyeExam.mdr_id               = Program.CurrentUser.mut_id;
                EyeExam.teh_type             = EyeExam.teh_type;
                EyeExam.teh_vision_out_re    = cmbIndex(cmbVisionOutRE, "");
                EyeExam.teh_vision_out_le    = cmbIndex(cmbVisionOutLE, "");
                EyeExam.teh_vision_out_rpin  = cmbIndex(cmbVisionOutpinRE, "");
                EyeExam.teh_vision_out_lpin  = cmbIndex(cmbVisionOutpinLE, "");
                EyeExam.teh_vision_out_rlens = cmbIndex(cmbVisionLenRE, "");
                EyeExam.teh_vision_out_llens = cmbIndex(cmbVisionLenLE, "");
                EyeExam.teh_vision_re        = cmbIndex(cmbVisionRE, "");
                EyeExam.teh_vision_le        = cmbIndex(cmbVisionLE, "");
                EyeExam.teh_color_vision     = Program.GetValueRadioTochar(pnlcolor);
                EyeExam.teh_tn_re            = cmbIndex(cmbTnRE, "");
                EyeExam.teh_tn_le            = cmbIndex(cmbTnLE, "");
                EyeExam.teh_eyehid_re        = Program.GetValueRadioTochar(pnlEyeHidRE);
                EyeExam.teh_eyehid_rspecify  = cmbIndex(cmbHidSpecifyRE, "");
                EyeExam.teh_eyehid_le        = Program.GetValueRadioTochar(pnlEyeHidLE);
                EyeExam.teh_eyehid_lspecify  = cmbIndex(cmbHidSpecifyLE, "");
                EyeExam.teh_orbit_re         = Program.GetValueRadioTochar(pnlOrbitRE);
                EyeExam.teh_orbit_rspecify   = cmbIndex(cmbOrbitSpecifyRE, "");
                EyeExam.teh_orbit_le         = Program.GetValueRadioTochar(pnlOrbitLE);
                EyeExam.teh_orbit_lspecify   = cmbIndex(cmbOrbitSpecifyLE, "");
                EyeExam.teh_conj_re          = Program.GetValueRadioTochar(pnlConjRE);
                EyeExam.teh_conj_rspecify    = cmbIndex(cmbConjRspecify, "");
                EyeExam.teh_conj_le          = Program.GetValueRadioTochar(pnlConjLE);
                EyeExam.teh_conj_lspecify    = cmbIndex(cmbConjLspecify, "");
                EyeExam.teh_corn_re          = Program.GetValueRadioTochar(pnlCornRE);
                EyeExam.teh_corn_rspecify    = cmbIndex(cmbCornSpecifyR, "");
                EyeExam.teh_corn_le          = Program.GetValueRadioTochar(pnlCornLE);
                EyeExam.teh_corn_lspecify    = cmbIndex(cmbCornSpecifyL, "");
                EyeExam.teh_iris_re          = Program.GetValueRadioTochar(pnlIrisRE);
                EyeExam.teh_iris_rspecify    = cmbIndex(cmbIrisReSpecify, "");
                EyeExam.teh_iris_le          = Program.GetValueRadioTochar(pnlIrisLE);
                EyeExam.teh_iris_lspecify    = cmbIndex(cmbIrisLeSpecify, "");
                EyeExam.teh_iris_rapd        = cmbIndex(cmbIrisRapd, "");
                EyeExam.teh_acdep            = Program.GetValueRadioTochar(pnlAC_depth);
                EyeExam.teh_lens_re          = Program.GetValueRadioTochar(pnlLensRE);
                EyeExam.teh_lens_rspecify    = cmbIndex(cmbLensRSpecify, "");
                EyeExam.teh_lens_le          = Program.GetValueRadioTochar(pnllensLE);
                EyeExam.teh_lens_lspecify    = cmbIndex(cmbLensLSpecify, "");
                EyeExam.teh_retina_re        = Program.GetValueRadioTochar(pnlRetinaRE);
                EyeExam.teh_retina_rspecify  = cmbIndex(cmbRetinaSpecifyRE, "");
                EyeExam.teh_retina_le        = Program.GetValueRadioTochar(pnlRetinaLE);
                EyeExam.teh_retina_lspecify  = cmbIndex(cmbRetinaSpecifyLE, "");
                EyeExam.teh_cular_re         = Program.GetValueRadioTochar(pnlCularRE);
                EyeExam.teh_cular_rspecify   = cmbIndex(cmbCularSpecifyRE, "");
                EyeExam.teh_cular_le         = Program.GetValueRadioTochar(pnlCularLE);
                EyeExam.teh_cular_lspecify   = cmbIndex(cmbCularSpecifyLE, "");
                EyeExam.teh_fund_re          = Program.GetValueRadioTochar(pnlNormalcupdiscRE);
                EyeExam.teh_fund_rmacula     = Program.GetValueRadioTochar(pnlFundusMacRE);
                EyeExam.teh_fund_rmac_spec   = cmbIndex(cmbFundRESpecify, "");
                EyeExam.teh_fund_le          = Program.GetValueRadioTochar(pnlNormalcupdiscLE);
                EyeExam.teh_fund_lmacula     = Program.GetValueRadioTochar(pnlFundusMacLE);
                EyeExam.teh_fund_lmac_spec   = cmbIndex(cmbFundLESpecify, "");
                EyeExam.teh_advp_disease     = (chk_adpDisease.Checked) ? 'Y' : 'N';
                EyeExam.teh_advp_med         = (chk_adpMed.Checked) ? 'Y' : 'N';
                EyeExam.teh_advp_care        = (chk_adpCare.Checked) ? 'Y' : 'N';
                EyeExam.teh_advp_fu          = (chk_adpFU.Checked) ? 'Y' : 'N';
                EyeExam.teh_advp_medical     = (chk_adpMedical.Checked) ? 'Y' : 'N';
                EyeExam.teh_advp_consult     = cmbIndex(cmbConsultEye, "");
                EyeExam.teh_update_by        = Program.CurrentUser.mut_username;
                EyeExam.teh_update_date      = EyeExam.teh_create_date;
                bindingSourcetrn_eye_exam_hdr.EndEdit();
                dbc.SubmitChanges();
                saveIsCompleted = true;
                teh_id          = EyeExam.teh_id;
                if (saveIsCompleted == true)
                {
                    int tpr_id      = TprID;
                    var countRecord = (from a in dbc.trn_eye_diagnosis
                                       join b in dbc.trn_eye_exam_hdrs on a.teh_id equals b.teh_id
                                       where a.teh_id == b.teh_id && b.tpr_id == tpr_id
                                       select new
                    {
                        main = a.ted_main,
                        detail = a.ted_detail
                    }).Count();
                    if (countRecord != 0)
                    {
                        var del2 = (from a in dbc.trn_eye_diagnosis
                                    where a.teh_id == teh_id
                                    select a);
                        foreach (var detail in del2)
                        {
                            dbc.trn_eye_diagnosis.DeleteOnSubmit(detail);
                        }
                    }
                    var tehidMax = teh_id;
                    for (int i = 0; i <= dgvDiagnosis.Rows.Count - 1; i++)
                    {
                        string           main         = dgvDiagnosis.Rows[i].Cells[2].Value.ToString();
                        string           detail       = dgvDiagnosis.Rows[i].Cells[3].Value.ToString();
                        trn_eye_diagnosi eyediagnosis = new trn_eye_diagnosi();
                        trn_eye_exam_hdr objhdr       = new trn_eye_exam_hdr();
                        eyediagnosis.teh_id          = tehidMax;
                        eyediagnosis.ted_main        = main;
                        eyediagnosis.ted_detail      = detail;
                        eyediagnosis.ted_create_by   = Program.CurrentUser.mut_username;
                        eyediagnosis.ted_create_date = datenowvalue;
                        eyediagnosis.ted_update_by   = Program.CurrentUser.mut_username;
                        eyediagnosis.ted_update_date = EyeExam.teh_create_date;
                        dbc.trn_eye_diagnosis.InsertOnSubmit(eyediagnosis);
                    }
                }
            }
            if (tabControl1.SelectedTab == t2)////eye thai
            {
                trn_eye_exam_hdr obj = dbc.trn_eye_exam_hdrs.Where(c => c.tpr_id == TprID).FirstOrDefault();
                if (obj != null)
                {
                    var EyeAircrewThai = (trn_eye_aircrew_thai)this.bindingSourcetrn_eye_aircrew_thai.Current;
                    EyeAircrewThai.teh_id          = teh_id;
                    EyeAircrewThai.tea_type        = obj.teh_type;
                    EyeAircrewThai.tea_color_vis   = Program.GetValueRadioTochar(pnlcolorvision);
                    EyeAircrewThai.tea_fw_lantern  = Program.GetValueRadioTochar(pnlFWThai);
                    EyeAircrewThai.tea_vis_field   = Program.GetValueRadioTochar(pnlvisionfailed);
                    EyeAircrewThai.tea_create_by   = Program.CurrentUser.mut_username;
                    EyeAircrewThai.tea_create_date = datenowvalue;
                    EyeAircrewThai.tea_update_by   = Program.CurrentUser.mut_username;
                    EyeAircrewThai.tea_update_date = EyeAircrewThai.tea_create_date;
                    bindingSourcetrn_eye_aircrew_thai.EndEdit();
                    saveIsCompleted = true;
                }
            }
            if (tabControl1.SelectedTab == t3)//// eye Faa
            {
                trn_eye_exam_hdr obj2 = dbc.trn_eye_exam_hdrs.Where(c => c.tpr_id == TprID).FirstOrDefault();
                if (obj2 != null)
                {
                    var EyeAircrewFAA = (trn_eye_aircrew_faa)this.bindingSourcetrn_eye_aircrew_faa.Current;
                    EyeAircrewFAA.teh_id          = teh_id;
                    EyeAircrewFAA.taf_type        = obj2.teh_type;
                    EyeAircrewFAA.taf_color_vis   = Program.GetValueRadioTochar(pnlcolorvisionFa);
                    EyeAircrewFAA.taf_fw_lantern  = Program.GetValueRadioTochar(pnl_FW_FA);
                    EyeAircrewFAA.taf_vis_field   = Program.GetValueRadioTochar(pnlvisionfailedFa);
                    EyeAircrewFAA.taf_create_by   = Program.CurrentUser.mut_username;
                    EyeAircrewFAA.taf_create_date = datenowvalue;
                    EyeAircrewFAA.taf_update_by   = Program.CurrentUser.mut_username;
                    EyeAircrewFAA.taf_update_date = EyeAircrewFAA.taf_create_date;
                    bindingSourcetrn_eye_aircrew_faa.EndEdit();

                    saveIsCompleted = true;
                }
            }
            if (tabControl1.SelectedTab == t4)////eye can
            {
                trn_eye_exam_hdr obj3 = dbc.trn_eye_exam_hdrs.Where(c => c.tpr_id == TprID).FirstOrDefault();
                if (obj3 != null)
                {
                    var EyeAircrewCan = (trn_eye_aircrew_can)this.bindingSourcetrn_eye_aircrew_can.Current;
                    EyeAircrewCan.teh_id          = teh_id;
                    EyeAircrewCan.tac_type        = obj3.teh_type;
                    EyeAircrewCan.tac_color_vis   = Program.GetValueRadioTochar(pnlcolorcan);
                    EyeAircrewCan.tac_fw_lantern  = Program.GetValueRadioTochar(pnl_FW_CN);
                    EyeAircrewCan.tac_vis_field   = Program.GetValueRadioTochar(pnlvisionfailedcan);
                    EyeAircrewCan.tac_create_by   = Program.CurrentUser.mut_username;
                    EyeAircrewCan.tac_create_date = datenowvalue;
                    EyeAircrewCan.tac_update_by   = Program.CurrentUser.mut_username;
                    EyeAircrewCan.tac_update_date = EyeAircrewCan.tac_create_date;
                    bindingSourcetrn_eye_aircrew_can.EndEdit();
                    saveIsCompleted = true;
                }
            }
            if (tabControl1.SelectedTab == t5)////eye aus
            {
                trn_eye_exam_hdr obj4 = dbc.trn_eye_exam_hdrs.Where(c => c.tpr_id == TprID).FirstOrDefault();
                var EyeExamAus        = (trn_eye_aircrew_aus)this.bindingSourcetrn_eye_aircrew_aus.Current;//  this.bindingSourcetrn_eye_exam_hdr.Current;
                if (obj4 != null)
                {
                    var EyeAircrewAus = (trn_eye_aircrew_aus)this.bindingSourcetrn_eye_aircrew_aus.Current;
                    EyeAircrewAus.teh_id          = teh_id;
                    EyeAircrewAus.taa_type        = obj4.teh_type;
                    EyeAircrewAus.taa_color_vis   = Program.GetValueRadioTochar(pnlcolorAus);
                    EyeAircrewAus.taa_fw_lantern  = Program.GetValueRadioTochar(pnl_FW_AUS);
                    EyeAircrewAus.taa_vis_field   = Program.GetValueRadioTochar(pnlvisionfailedAus);
                    EyeAircrewAus.taa_create_by   = Program.CurrentUser.mut_username;
                    EyeAircrewAus.taa_create_date = datenowvalue;
                    EyeAircrewAus.taa_update_by   = Program.CurrentUser.mut_username;
                    EyeAircrewAus.taa_update_date = EyeAircrewAus.taa_create_date;
                    bindingSourcetrn_eye_aircrew_aus.EndEdit();
                    saveIsCompleted = true;
                }
            }

            if (saveIsCompleted == true)
            {
                dbc.SubmitChanges();
                lblMsg.Visible = true;
                timer1.Enabled = true;
                lblMsg.Text    = "Save Completed.";
            }
            else
            {
                lblMsg.Text = "Not Save Completed.";
            }
        }