Esempio n. 1
0
 private void autoCompleteUC1_SelectedValueChanged(object sender, object e)
 {
     try
     {
         trn_teeth_hdr teeth = BsPatientTeeth.OfType <trn_teeth_hdr>().FirstOrDefault();
         if (teeth != null)
         {
             if (e == null)
             {
                 txtDoctorCode.Text       = "";
                 teeth.tth_doctor_code    = null;
                 teeth.tth_doctor_license = null;
                 teeth.tth_doctor_name_en = null;
                 teeth.tth_doctor_name_th = null;
             }
             else
             {
                 txtDoctorCode.Text       = ((DoctorProfile)e).SSUSR_Initials;
                 teeth.tth_doctor_code    = ((DoctorProfile)e).SSUSR_Initials;
                 teeth.tth_doctor_license = ((DoctorProfile)e).CTPCP_SMCNo;
                 DoctorName dn = obj.GetDoctorName(((DoctorProfile)e).CTPCP_Desc);
                 teeth.tth_doctor_name_en = dn.NameEN;
                 teeth.tth_doctor_name_th = dn.NameTH;
             }
         }
     }
     catch (Exception ex)
     {
         Program.MessageError(this.Name, "autoCompleteUC1_SelectedValueChanged", ex, false);
     }
 }
Esempio n. 2
0
        public void EndEdit()
        {
            try
            {
                DateTime      dateNow      = Program.GetServerDateTime();
                trn_teeth_hdr patientTeeth = BsPatientTeeth.OfType <trn_teeth_hdr>().FirstOrDefault();

                if (patientTeeth.tth_create_by == null)
                {
                    patientTeeth.tth_create_date = dateNow;
                }
                patientTeeth.tth_update_date = dateNow;

                List <trn_teeth_dtl> listTeethDtl = BSTeethDtl.OfType <trn_teeth_dtl>().OrderBy(x => x.ttd_teeth_up).ThenBy(x => x.ttd_teeth_location).ToList();
                int seq = 0;
                listTeethDtl.ForEach(x =>
                {
                    x.ttd_seq         = seq++;
                    x.ttd_create_date = dateNow;
                    x.ttd_update_date = dateNow;
                });

                List <trn_teeth_doc_result> listTeethDoctor = BsTeethDoctor.OfType <trn_teeth_doc_result>().ToList();
                listTeethDoctor.ForEach(x =>
                {
                    x.tdr_create_date = dateNow;
                    x.tdr_update_date = dateNow;
                });
                bsPatientRegis.EndEdit();
            }
            catch (Exception ex)
            {
                Program.MessageError(this.Name, "SaveData", ex, false);
            }
        }
Esempio n. 3
0
        private void selectProblem_Click(object sender, EventArgs e)
        {
            if (_PatientRegis != null)
            {
                if (sender.GetType() == typeof(Button))
                {
                    Button btn = (Button)sender;
                    if (btn.Tag != null)
                    {
                        string[] tag = btn.Tag.ToString().Split(',');
                        if (tag.Count() == 2)
                        {
                            string teeth_up       = tag[0].ToString().Trim();
                            int    teeth_location = Convert.ToInt32(tag[1]);

                            List <trn_teeth_dtl> result_teeth = BSTeethDtl.OfType <trn_teeth_dtl>()
                                                                .Where(x => x.ttd_teeth_up.Trim() == teeth_up &&
                                                                       x.ttd_teeth_location == teeth_location).ToList();

                            List <DentalSelectProblemFrm.sourceProblem> old_problem = result_teeth.Select(x => new DentalSelectProblemFrm.sourceProblem
                            {
                                mdr_id   = x.mdr_id,
                                mdr_code = x.mdr_code
                            }).ToList();

                            DentalSelectProblemFrm.selectProblem selectProblem = new DentalSelectProblemFrm.selectProblem
                            {
                                Selected = false,
                                mhs_id   = bsPatientRegis.OfType <trn_patient_regi>().FirstOrDefault().mhs_id,
                                Problem  = old_problem
                            };

                            DentalSelectProblemFrm frm = new DentalSelectProblemFrm();
                            DentalSelectProblemFrm.selectProblem new_selected = frm.getProblem(selectProblem);
                            if (new_selected.Selected == true)
                            {
                                List <DentalSelectProblemFrm.sourceProblem> new_problem = new_selected.Problem;

                                List <trn_teeth_dtl> list_remove_dtl = BSTeethDtl.OfType <trn_teeth_dtl>()
                                                                       .Where(x => x.ttd_teeth_up.Trim() == teeth_up &&
                                                                              x.ttd_teeth_location == teeth_location &&
                                                                              !new_problem.Contains(new DentalSelectProblemFrm.sourceProblem
                                {
                                    mdr_id   = x.mdr_id,
                                    mdr_code = x.mdr_code
                                })).ToList();
                                if (list_remove_dtl.Count() > 0)
                                {
                                    list_remove_dtl.ForEach(x => BSTeethDtl.Remove(x));
                                }

                                List <DentalSelectProblemFrm.sourceProblem> list_add_dtl = new_problem.Where(x => !old_problem.Contains(x)).ToList();
                                if (list_add_dtl.Count() > 0)
                                {
                                    list_add_dtl.ForEach(x =>
                                    {
                                        BSTeethDtl.Add(new trn_teeth_dtl
                                        {
                                            mdr_id             = x.mdr_id,
                                            mdr_code           = x.mdr_code,
                                            ttd_teeth_up       = teeth_up,
                                            ttd_teeth_location = teeth_location,
                                            ttd_create_by      = username,
                                            ttd_update_by      = username
                                        });
                                    });
                                }

                                trn_teeth_hdr patient_teeth = BsPatientTeeth.OfType <trn_teeth_hdr>().FirstOrDefault();
                                patient_teeth.tth_bad_tooth_total     = BSTeethDtl.OfType <trn_teeth_dtl>().Where(x => x.mdr_code != null && x.mdr_code.ToUpper() == "F").Count();
                                patient_teeth.tth_down_tooth_total    = BSTeethDtl.OfType <trn_teeth_dtl>().Where(x => x.mdr_code != null && x.mdr_code.ToUpper() == "A").Count();
                                patient_teeth.tth_thimble_total       = BSTeethDtl.OfType <trn_teeth_dtl>().Where(x => x.mdr_code != null && x.mdr_code.ToUpper() == "R").Count();
                                patient_teeth.tth_replace_tooth_total = BSTeethDtl.OfType <trn_teeth_dtl>().Where(x => x.mdr_code != null && x.mdr_code.ToUpper() == "S").Count();
                                patient_teeth.tth_thimble_out_total   = BSTeethDtl.OfType <trn_teeth_dtl>().Where(x => x.mdr_code != null && x.mdr_code.ToUpper() == "C").Count();
                                patient_teeth.tth_put_tooth_total     = BSTeethDtl.OfType <trn_teeth_dtl>().Where(x => x.mdr_code != null && x.mdr_code.ToUpper() == "X").Count();

                                List <string> result = new_problem.Select(x => x.mdr_code).ToList();
                                if (result.Count() > 0)
                                {
                                    btn.Text = string.Join(",", result);
                                }
                                else
                                {
                                    btn.Text = "";
                                }
                            }
                        }
                    }
                }
            }
        }