public void retrieveHistory(trn_RefreshLabHistory trl) { try { using (Service.WS_CheckupCls ws = new Service.WS_CheckupCls()) { ws.RetrieveImaging((int)trl.tpr_id, "JobImage"); } //using (InhCheckupDataContext cdc = new InhCheckupDataContext()) //{ // System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US"); // var patient = cdc.trn_patient_regis // .Where(x => x.tpr_id == trl.tpr_id) // .Select(x => new // { // hn = x.trn_patient.tpt_hn_no, // en = x.tpr_en_no, // arrived = x.trn_patient_regis_detail == null ? x.tpr_arrive_date.Value.Date : x.trn_patient_regis_detail.tpr_real_arrived_date.Value.Date // }).FirstOrDefault(); // using (Service.WS_CheckupCls ws = new Service.WS_CheckupCls()) // { // ws.InsertDBEmrCheckupResultXray(patient.hn, patient.en, patient.arrived.AddYears(-5), patient.arrived, false); // } //} } catch (Exception ex) { Program.MessageError("GetResultTextFileCls", "retrieveHistory", ex, false); } }
private void btnContinue_Click(object sender, EventArgs e) { try { btnContinue.Enabled = false; btnSearch.Enabled = false; btnCancel.Enabled = false; lbAlert.Text = "Processing..."; Application.DoEvents(); //tmp_getptarrived result = getArrivedByHn(hn_no); if (currentGetArrived != null) { using (InhCheckupDataContext cdc = new InhCheckupDataContext()) { //tmp_getptarrived tga = cdc.tmp_getptarriveds.Where(x => x.row_id == result.row_id).FirstOrDefault(); //tga.flag_success = 'Y'; DateTime dateNow = Program.GetServerDateTime(); List <tmp_getptarrived> tmpArrived = cdc.tmp_getptarriveds.Where(x => x.papmi_no == currentGetArrived.papmi_no).ToList(); // && x.paadm_admdate.Value.Date == dateNow.Date if (tmpArrived.Where(x => x.flag_success == 'Y').Count() == 0) { tmpArrived.ForEach(x => x.flag_success = 'Y'); cdc.tmp_getptarriveds.InsertOnSubmit(currentGetArrived); EmrClass.GetDataFromWSTrakCare cls = new EmrClass.GetDataFromWSTrakCare(); trn_patient tpt = cdc.trn_patients.Where(x => x.tpt_hn_no == currentGetArrived.papmi_no).FirstOrDefault(); bool flagNewPatient = true; if (tpt != null) { flagNewPatient = false; } cls.otherClinicSkipToCheckB(currentGetArrived, ref tpt); if (flagNewPatient == true) { cdc.trn_patients.InsertOnSubmit(tpt); } cdc.SubmitChanges(); trn_patient_regi tpr = tpt.trn_patient_regis.OrderByDescending(x => x.tpr_create_date).FirstOrDefault(); trn_RefreshLabHistory refreshHis = new trn_RefreshLabHistory() { tpr_id = tpr.tpr_id, CreateDate = dateNow, HN_no = tpt.tpt_hn_no, status = false }; cdc.trn_RefreshLabHistories.InsertOnSubmit(refreshHis); cdc.SubmitChanges(); new EmrClass.GetPTPackageCls().setRelationOrderSet(ref tpr); cdc.SubmitChanges(); btnContinue.Enabled = true; btnSearch.Enabled = true; btnCancel.Enabled = true; returnHN = currentGetArrived.papmi_no; this.Close(); } else { } } } } catch { } }