Exemple #1
0
 public bool CheckTrakcarePassword(string username, string password)
 {
     try
     {
         using (WS_Trakcare.WS_GetDataBytrakSoapClient ws = new WS_Trakcare.WS_GetDataBytrakSoapClient())
         {
             DataTable dt = ws.LogonTrakcare(username, password);
             if (dt.Rows.Count > 0)
             {
                 SetLogUser sl = new SetLogUser();
                 sl.setItem(CheckupAppCode, username);
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #2
0
 public MapPatientResult MappingPatient(int tpr_id, List <int> listID)
 {
     try
     {
         using (InhCheckupDataContext cdc = new InhCheckupDataContext())
         {
             var patient = cdc.trn_patient_regis
                           .Where(x => x.tpr_id == tpr_id)
                           .Select(x => new
             {
                 en      = x.tpr_en_no,
                 arrived = x.trn_patient_regis_detail.tpr_real_arrived_date,
                 loc     = x.mst_hpc_site.mhs_code
             }).FirstOrDefault();
             if (patient != null)
             {
                 using (WS_Trakcare.WS_GetDataBytrakSoapClient ws = new WS_Trakcare.WS_GetDataBytrakSoapClient())
                 {
                     var result = ws.GetPTArrivedCheckUpFilter(patient.loc, patient.en, patient.arrived.Value.ToString("yyyy-MM-dd")).AsEnumerable()
                                  .Select(x => new
                     {
                         titlename      = x.Field <string>("TTL_Desc") == null ? "" : x.Field <string>("TTL_Desc").Trim(),
                         firstname      = x.Field <string>("PAPMI_Name") == null ? "" : x.Field <string>("PAPMI_Name").Trim(),
                         lastname       = x.Field <string>("PAPMI_Name2") == null ? "" : x.Field <string>("PAPMI_Name2").Trim(),
                         firstname_eng  = x.Field <string>("PAPER_Name5") == null ? "" : x.Field <string>("PAPER_Name5").Trim(),
                         middlename_eng = x.Field <string>("PAPER_Name7") == null ? "" : x.Field <string>("PAPER_Name7").Trim(),
                         lastname_eng   = x.Field <string>("PAPER_Name6") == null ? "" : x.Field <string>("PAPER_Name6").Trim(),
                         idcard         = x.Field <string>("PAPER_ID") == null ? "" : x.Field <string>("PAPER_ID").Trim()
                     }).FirstOrDefault();
                     if (result != null)
                     {
                         using (InhToDoListDataContext tdc = new InhToDoListDataContext())
                         {
                             MapPatientResult person;
                             if (!string.IsNullOrEmpty(result.idcard))
                             {
                                 person = tdc.trn_name_checks
                                          .Where(x => listID.Contains(x.tcd_id) &&
                                                 x.tnc_personal_id.Trim() == result.idcard)
                                          .Select(x => new MapPatientResult
                                 {
                                     document_no = x.trn_company_detail.tcd_document_no,
                                     emp_id      = x.tnc_emp_id,
                                     position    = x.tnc_position,
                                     department  = x.tnc_department
                                 }).FirstOrDefault();
                                 if (person != null)
                                 {
                                     return(person);
                                 }
                             }
                             if (!string.IsNullOrEmpty(result.firstname) && !string.IsNullOrEmpty(result.lastname))
                             {
                                 person = tdc.trn_name_checks
                                          .Where(x => listID.Contains(x.tcd_id) &&
                                                 x.tnc_fname.Trim() == result.firstname &&
                                                 x.tnc_lname.Trim() == result.lastname)
                                          .Select(x => new MapPatientResult
                                 {
                                     document_no = x.trn_company_detail.tcd_document_no,
                                     emp_id      = x.tnc_emp_id,
                                     position    = x.tnc_position,
                                     department  = x.tnc_department
                                 }).FirstOrDefault();
                                 if (person != null)
                                 {
                                     return(person);
                                 }
                             }
                             if (!string.IsNullOrEmpty(result.firstname_eng) && !string.IsNullOrEmpty(result.lastname_eng))
                             {
                                 person = tdc.trn_name_checks
                                          .Where(x => listID.Contains(x.tcd_id) &&
                                                 x.tnc_fname.Trim() == result.firstname_eng &&
                                                 x.tnc_lname.Trim() == result.lastname_eng)
                                          .Select(x => new MapPatientResult
                                 {
                                     document_no = x.trn_company_detail.tcd_document_no,
                                     emp_id      = x.tnc_emp_id,
                                     position    = x.tnc_position,
                                     department  = x.tnc_department
                                 }).FirstOrDefault();
                                 if (person != null)
                                 {
                                     return(person);
                                 }
                             }
                             if (!string.IsNullOrEmpty(result.firstname_eng) && !string.IsNullOrEmpty(result.middlename_eng) && !string.IsNullOrEmpty(result.lastname_eng))
                             {
                                 person = tdc.trn_name_checks
                                          .Where(x => listID.Contains(x.tcd_id) &&
                                                 x.tnc_fname.Trim() == result.firstname_eng + " " + result.middlename_eng &&
                                                 x.tnc_lname.Trim() == result.lastname_eng)
                                          .Select(x => new MapPatientResult
                                 {
                                     document_no = x.trn_company_detail.tcd_document_no,
                                     emp_id      = x.tnc_emp_id,
                                     position    = x.tnc_position,
                                     department  = x.tnc_department
                                 }).FirstOrDefault();
                                 if (person != null)
                                 {
                                     return(person);
                                 }
                             }
                             if (!string.IsNullOrEmpty(result.firstname) && !string.IsNullOrEmpty(result.lastname))
                             {
                                 person = tdc.trn_name_checks
                                          .Where(x => listID.Contains(x.tcd_id) &&
                                                 x.tnc_fname.Trim().EndsWith(result.firstname) &&
                                                 x.tnc_lname.Trim() == result.lastname)
                                          .Select(x => new MapPatientResult
                                 {
                                     document_no = x.trn_company_detail.tcd_document_no,
                                     emp_id      = x.tnc_emp_id,
                                     position    = x.tnc_position,
                                     department  = x.tnc_department
                                 }).FirstOrDefault();
                                 if (person != null)
                                 {
                                     return(person);
                                 }
                             }
                             if (!string.IsNullOrEmpty(result.firstname_eng) && !string.IsNullOrEmpty(result.lastname_eng))
                             {
                                 person = tdc.trn_name_checks
                                          .Where(x => listID.Contains(x.tcd_id) &&
                                                 x.tnc_fname.Trim().EndsWith(result.firstname_eng) &&
                                                 x.tnc_lname.Trim() == result.lastname_eng)
                                          .Select(x => new MapPatientResult
                                 {
                                     document_no = x.trn_company_detail.tcd_document_no,
                                     emp_id      = x.tnc_emp_id,
                                     position    = x.tnc_position,
                                     department  = x.tnc_department
                                 }).FirstOrDefault();
                                 if (person != null)
                                 {
                                     return(person);
                                 }
                             }
                             if (!string.IsNullOrEmpty(result.firstname_eng) && !string.IsNullOrEmpty(result.middlename_eng) && !string.IsNullOrEmpty(result.lastname_eng))
                             {
                                 person = tdc.trn_name_checks
                                          .Where(x => listID.Contains(x.tcd_id) &&
                                                 x.tnc_fname.Trim().EndsWith(result.firstname_eng + " " + result.middlename_eng) &&
                                                 x.tnc_lname.Trim() == result.lastname_eng)
                                          .Select(x => new MapPatientResult
                                 {
                                     document_no = x.trn_company_detail.tcd_document_no,
                                     emp_id      = x.tnc_emp_id,
                                     position    = x.tnc_position,
                                     department  = x.tnc_department
                                 }).FirstOrDefault();
                                 if (person != null)
                                 {
                                     return(person);
                                 }
                             }
                         }
                     }
                 }
             }
             return(new MapPatientResult());
         }
     }
     catch (Exception ex)
     {
         return(new MapPatientResult());
     }
 }