public TaggedCytologyRptArrays(IndexedHashtable t) { if (t.Count == 0) { return; } arrays = new TaggedCytologyRptArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) == null) { arrays[i] = new TaggedCytologyRptArray((string)t.GetKey(i)); } else if (MdwsUtils.isException(t.GetValue(i))) { arrays[i] = new TaggedCytologyRptArray((string)t.GetKey(i), (Exception)t.GetValue(i)); } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedCytologyRptArray((string)t.GetKey(i), (CytologyReport[])t.GetValue(i)); } else { arrays[i] = new TaggedCytologyRptArray((string)t.GetKey(i), (CytologyReport)t.GetValue(i)); } } count = t.Count; }
public TaggedImagingExamArrays(IndexedHashtable ihs) { if (ihs == null || ihs.Count <= 0) { return; } this.count = ihs.Count; arrays = new TaggedImagingExamArray[ihs.Count]; for (int i = 0; i < ihs.Count; i++) { if (ihs.GetValue(i) == null) { arrays[i] = new TaggedImagingExamArray((string)ihs.GetKey(i)); } else if (MdwsUtils.isException(ihs.GetValue(i))) { arrays[i] = new TaggedImagingExamArray((string)ihs.GetKey(i), ihs.GetValue(i) as Exception); } else if (ihs.GetValue(i).GetType() == typeof(Hashtable)) { arrays[i] = new TaggedImagingExamArray((string)ihs.GetKey(i), ((Hashtable)ihs.GetValue(i))["radiologyExams"] as IList <ImagingExam>); } } }
/// <summary> /// Use this contructor for results from the VPR so only the correct note type is built for a request. "documents" for all notes, "dischargeSummaries" for that specific note type /// </summary> /// <param name="t"></param> /// <param name="noteType"></param> public TaggedNoteArrays(IndexedHashtable t, string noteType) { if (t == null || t.Count == 0) { return; } count = t.Count; arrays = new TaggedNoteArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) == null) { arrays[i] = new TaggedNoteArray((string)t.GetKey(i)); } else if (MdwsUtils.isException(t.GetValue(i))) { arrays[i] = new TaggedNoteArray((string)t.GetKey(i), (Exception)t.GetValue(i)); } else if (t.GetValue(i).GetType() == typeof(System.Collections.Hashtable)) { if (noteType.Equals("documents")) { buildAllNotes(t, i); } else if (noteType.Equals("dischargeSummaries")) { buildDischargeSummaries(t, i); } } } }
public TaggedOefOifArrays(IndexedHashtable t) { if (t.Count == 0) { return; } arrays = new TaggedOefOifArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (MdwsUtils.isException(t.GetValue(i))) { fault = new FaultTO((Exception)t.GetValue(i)); } else if (t.GetValue(i) == null) { arrays[i] = new TaggedOefOifArray((string)t.GetKey(i)); } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedOefOifArray((string)t.GetKey(i), (OEF_OIF[])t.GetValue(i)); } else { arrays[i] = new TaggedOefOifArray((string)t.GetKey(i), (OEF_OIF)t.GetValue(i)); } } count = t.Count; }
public TaggedImmunizationArrays(IndexedHashtable t) { if (t == null || t.Count == 0) { return; } count = t.Count; arrays = new TaggedImmunizationArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) == null) { arrays[i] = new TaggedImmunizationArray((string)t.GetKey(i)); } else if (MdwsUtils.isException(t.GetValue(i))) { arrays[i] = new TaggedImmunizationArray((string)t.GetKey(i), (Exception)t.GetValue(i)); } else if (t.GetValue(i).GetType() == typeof(System.Collections.Hashtable)) { arrays[i] = new TaggedImmunizationArray((string)t.GetKey(i), ((System.Collections.Hashtable)t.GetValue(i))["immunizations"] as IList <Immunization>); } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedImmunizationArray((string)t.GetKey(i), ((Immunization[])t.GetValue(i)).ToList()); } else if (t.GetValue(i).GetType() == typeof(IList <Immunization>)) { arrays[i] = new TaggedImmunizationArray((string)t.GetKey(i), (IList <Immunization>)t.GetValue(i)); } } }
public TaggedClaimArrays(IndexedHashtable t) { if (t.Count == 0) { return; } arrays = new TaggedClaimArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) == null) { arrays[i] = new TaggedClaimArray((string)t.GetKey(i)); } else if (t.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { arrays[i] = new TaggedClaimArray((string)t.GetKey(i), (Exception)t.GetValue(i)); } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedClaimArray((string)t.GetKey(i), (Claim[])t.GetValue(i)); } else { arrays[i] = new TaggedClaimArray((string)t.GetKey(i), (Claim)t.GetValue(i)); } } count = t.Count; }
public static IndexedHashtable execute2(IndexedHashtable cxnTable, string daoName, string methodName, Object[] args) { if (cxnTable == null || cxnTable.Count == 0) { throw new Exception("No connections!"); } int lth = cxnTable.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { if (cxnTable.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { continue; } Connection cxn = (Connection)cxnTable.GetValue(i); if (!cxn.IsConnected) { continue; } Object dao = ((Connection)cxnTable.GetValue(i)).getDao(daoName); if (dao == null) { continue; } queries[i] = new QueryThread(dao, methodName, args); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(cxnTable.Count); for (int i = 0; i < threads.Length; i++) { if (cxnTable.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { result.Add((string)cxnTable.GetKey(i), (Exception)cxnTable.GetValue(i)); continue; } Connection cxn = (Connection)cxnTable.GetValue(i); if (!cxn.IsConnected) { result.Add((string)cxnTable.GetKey(i), new Exception("Source is not connected")); continue; } Object dao = ((Connection)cxnTable.GetValue(i)).getDao(daoName); if (dao == null) { result.Add((string)cxnTable.GetKey(i), new Exception("Invalid dao: " + daoName)); continue; } threads[i].Join(); result.Add((String)cxnTable.GetKey(i), queries[i].Result); } return(result); }
internal void buildAllNotes(IndexedHashtable ihs, int index) { IList <Note> temp = ((System.Collections.Hashtable)ihs.GetValue(index))["documents"] as IList <Note>; if (temp == null || temp.Count == 0) { arrays[index] = new TaggedNoteArray((string)ihs.GetKey(index)); } else { Note[] ary = new Note[temp.Count]; temp.CopyTo(ary, 0); arrays[index] = new TaggedNoteArray((string)ihs.GetKey(index), ary); } }
public IndexedHashtable connect() { int lth = cxnTbl.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { queries[i] = new QueryThread(cxnTbl.GetValue(i), "connect", new Object[0]); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int i = 0; i < lth; i++) { string key = (string)cxnTbl.GetKey(i); threads[i].Join(); //Need to report result whether it's a connection or an exception. if (queries[i].isExceptionResult()) { result.Add(key, queries[i].Result); Connection cxn = (Connection)cxnTbl.GetValue(i); cxn.ErrorMessage = ((Exception)queries[i].Result).Message; cxn.IsConnected = false; } else { result.Add(key, ((Connection)cxnTbl.GetValue(key)).DataSource); } } return(result); }
public TaggedFaultArray(IndexedHashtable ihs) { if (ihs == null || ihs.Count == 0) { return; } IList <TaggedFault> temp = new List <TaggedFault>(); for (int i = 0; i < ihs.Count; i++) { if (MdwsUtils.isException(ihs.GetValue(i))) { temp.Add(new TaggedFault((string)ihs.GetKey(i), (Exception)ihs.GetValue(i))); } } if (temp.Count > 0) { // we want to remove the exceptions from the hashtable because, in container objects, the constructors // for each of the property objects handle exception info. we need to keep the tag though so results collections are consistent foreach (TaggedFault tf in temp) { ihs.Remove(tf.tag); ihs.Add(tf.tag, null); } faults = new TaggedFault[temp.Count]; temp.CopyTo(faults, 0); } }
public TaggedLabTestArrays(IndexedHashtable labTests) { if (labTests == null || labTests.Count == 0) { return; } arrays = new TaggedLabTestArray[labTests.Count]; for (int i = 0; i < labTests.Count; i++) { string tag = (string)labTests.GetKey(i); if (labTests.GetValue(i) == null) { arrays[i] = new TaggedLabTestArray(tag); } if (labTests.GetValue(i) is IList <LabTest> ) { arrays[i] = new TaggedLabTestArray(tag, (IList <LabTest>)labTests.GetValue(i)); } else if (labTests.GetValue(i) is LabTest[]) { arrays[i] = new TaggedLabTestArray(tag); } else if (labTests.GetValue(i) is LabTest) { arrays[i] = new TaggedLabTestArray(tag); } else { return; } } }
public TaggedClinicalProcedureArrays(IndexedHashtable ihs) { if (ihs == null || ihs.Count == 0) { return; } arrays = new TaggedClinicalProcedureArray[ihs.Count]; for (int i = 0; i < ihs.Count; i++) { string tag = (string)ihs.GetKey(i); if (ihs.GetValue(i) == null) { arrays[i] = new TaggedClinicalProcedureArray(tag); } else if (MdwsUtils.isException(ihs.GetValue(i))) { arrays[i] = new TaggedClinicalProcedureArray(tag, (Exception)ihs.GetValue(i)); } else if (ihs.GetValue(i) is Hashtable && ((Hashtable)ihs.GetValue(i)).ContainsKey("ekgs")) { IList <ClinicalProcedure> results = ((Hashtable)ihs.GetValue(i))["ekgs"] as IList <ClinicalProcedure>; arrays[i] = new TaggedClinicalProcedureArray(tag, results); } } }
private IndexedHashtable mergeNotesAndDischargeSummaries(IndexedHashtable tNotes, IndexedHashtable tSummaries) { if (tNotes == null) { return(tSummaries); } if (tSummaries == null) { return(tNotes); } IndexedHashtable result = new IndexedHashtable(tNotes.Count + tSummaries.Count); for (int i = 0; i < tNotes.Count; i++) { Note[] notes = (Note[])tNotes.GetValue(i); int notesLength = (notes == null ? 0 : notes.Length); string key = (string)tNotes.GetKey(i); Note[] summaries = (Note[])tSummaries.GetValue(key); int summariesLength = (summaries == null ? 0 : summaries.Length); ArrayList lst = new ArrayList(notesLength + summariesLength); for (int j = 0; j < notesLength; j++) { lst.Add(notes[j]); } for (int j = 0; j < summariesLength; j++) { lst.Add(summaries[j]); } result.Add(key, (Note[])lst.ToArray(typeof(Note))); } return(result); }
public TaggedLabReportArrays(IndexedHashtable ihs) { if (ihs == null || ihs.Count == 0) { return; } this.count = ihs.Count; arrays = new TaggedLabReportArray[ihs.Count]; for (int i = 0; i < ihs.Count; i++) { string tag = (string)ihs.GetKey(i); if (ihs.GetValue(i) == null) { arrays[i] = new TaggedLabReportArray(); } else if (MdwsUtils.isException(ihs.GetValue(i))) { arrays[i] = new TaggedLabReportArray(tag, ihs.GetValue(i) as Exception); } else if (ihs.GetValue(i).GetType().Equals(typeof(Hashtable))) { arrays[i] = new TaggedLabReportArray(tag, (IList <LabReport>)((Hashtable)ihs.GetValue(i))["accessions"]); } } }
public IndexedHashtable connect(AbstractCredentials credentials, AbstractPermission permission, DataSource validationDataSource) { permission.IsPrimary = true; QueryTemplate qt = new ConnectQuery(this); if (validationDataSource == null) { validationDataSource = new DataSource(); } qt.QueryMethod("AbstractConnection", "authorizedConnect", new object[] { credentials, permission, validationDataSource }); IndexedHashtable t = buildResults(); // KLUGE: This is here to make the number of connections come out right. // Note that the first element in the table will be a connection, but // the rest either User or Exception. if (HasBaseConnection && myResults.Count < myCxns.Count) { IndexedHashtable t2 = new IndexedHashtable(myCxns.Count); t2.Add(BaseConnection.DataSource.SiteId.Id, BaseConnection); for (int i = 0; i < t.Count; i++) { t2.Add(t.GetKey(i), t.GetValue(i)); } t = t2; } return(t); }
public PatientMedicalRecordTO(IndexedHashtable ihs) { initCollections(); if (ihs == null || ihs.Count == 0) { return; } for (int i = 0; i < ihs.Count; i++) { object key = ihs.GetKey(i); if (!(key is string)) { continue; } string sitecode = key as string; if (!(ihs.GetValue(i) is Hashtable)) { continue; } Hashtable domains = ihs.GetValue(i) as Hashtable; Meds.add(sitecode, domains["meds"] as IList <Medication>); Patient = new PatientTO(domains["demographics"] as Patient); Allergies.add(sitecode, domains["reactions"] as IList <Allergy>); Notes.add(sitecode, domains["documents"] as IList <Note>); Problems.add(sitecode, domains["problems"] as IList <Problem>); Appointments.add(sitecode, domains["appointments"] as IList <Appointment>); ChemHemReports.add(sitecode, domains["labs"] as IList <LabReport>); IList <HealthSummary> healthSummaries = domains["healthFactors"] as IList <HealthSummary>; // TODO - implement the remaining hashtable keys //results.Add("healthFactors", healthSummaries); //results.Add("flags", flags); //results.Add("consults", consults); //results.Add("procedures", null); //results.Add("visits", visits); //results.Add("appointments", appointments); //results.Add("problems", problems); //results.Add("vitals", vitals); //results.Add("labs", labs); //results.Add("immunizations", null); } }
public TaggedPatientArrays(IndexedHashtable t) { if (t.Count == 0) { return; } if (t.Count == 1 && MdwsUtils.isException(t.GetValue(0))) { fault = new FaultTO((Exception)t.GetValue(0)); return; } arrays = new TaggedPatientArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) == null) { arrays[i] = new TaggedPatientArray((string)t.GetKey(i)); } else if (MdwsUtils.isException(t.GetValue(i))) { arrays[i] = new TaggedPatientArray((string)t.GetKey(i), (Exception)t.GetValue(i)); } else if (t.GetValue(i).GetType() == typeof(System.Collections.Hashtable)) { arrays[i] = new TaggedPatientArray((string)t.GetKey(i), ((System.Collections.Hashtable)t.GetValue(i))["demographics"] as Patient); } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedPatientArray((string)t.GetKey(i), (Patient[])t.GetValue(i)); } else { arrays[i] = new TaggedPatientArray((string)t.GetKey(i), (Patient)t.GetValue(i)); } } count = t.Count; }
public TaggedHospitalLocationArrays(IndexedHashtable t) { if (t.Count == 0) { return; } arrays = new TaggedHospitalLocationArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) == null) { arrays[i] = new TaggedHospitalLocationArray((string)t.GetKey(i)); } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedHospitalLocationArray((string)t.GetKey(i), (HospitalLocation[])t.GetValue(i)); } else { arrays[i] = new TaggedHospitalLocationArray((string)t.GetKey(i), (HospitalLocation)t.GetValue(i)); } } count = t.Count; }
public IndexedHashtable setLocalPids(ConnectionSet cxns, string mpiPid) { IndexedHashtable result = cxns.query(DAO_NAME, "getLocalPid", new object[] { mpiPid }); for (int i = 0; i < result.Count; i++) { if (result.GetValue(i).GetType().Name.EndsWith("Exception")) { continue; } string siteId = (string)result.GetKey(i); AbstractConnection cxn = cxns.getConnection(siteId); cxn.Pid = (string)result.GetValue(i); } return(result); }
public IndexedHashtable disconnectRemoteSites() { if (cxnTbl.Count < 2) { throw new Exception("No remote connections"); } // Only disconnect from the ones that are connected IndexedHashtable myCxns = getConnections(); int lth = myCxns.Count - 1; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int threadIdx = 0, cxnIdx = 1; threadIdx < lth; threadIdx++, cxnIdx++) { queries[threadIdx] = new QueryThread(myCxns.GetValue(cxnIdx), "disconnect", new Object[0]); threads[threadIdx] = new Thread(new ThreadStart(queries[threadIdx].execute)); threads[threadIdx].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int threadIdx = 0, cxnIdx = 1; threadIdx < lth; threadIdx++, cxnIdx++) { string key = (string)myCxns.GetKey(cxnIdx); threads[threadIdx].Join(); if (queries[threadIdx].isExceptionResult()) { result.Add(key, queries[threadIdx].Result); } else { result.Add(key, "OK"); } } // Now remove all but the logon connection from the table Connection loginCxn = LoginConnection; cxnTbl = new IndexedHashtable(); cxnTbl.Add(loginCxn.SiteId.Key, loginCxn); return(result); }
internal IndexedHashtable buildResults() { IndexedHashtable result = new IndexedHashtable(); if (myResults != null) { for (int i = 0; i < myResults.Count; i++) { result.Add(myResults.GetKey(i), myResults.GetValue(i)); } } if (myExceptions != null) { for (int i = 0; i < myExceptions.Count; i++) { result.Add(myExceptions.GetKey(i), myExceptions.GetValue(i)); } } return(result); }
public IndexedHashtable disconnect() { if (cxnTbl.Count == 0) { throw new Exception("No connections"); } // Only disconnect from the ones that are connected IndexedHashtable myCxns = getConnections(); int lth = myCxns.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { queries[i] = new QueryThread(myCxns.GetValue(i), "disconnect", new Object[0]); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int i = 0; i < lth; i++) { string key = (string)myCxns.GetKey(i); threads[i].Join(); if (queries[i].isExceptionResult()) { result.Add(key, queries[i].Result); } else { result.Add(key, "OK"); } } // We only disconnected from connected connections, but we want to clear // the entire table cxnTbl = new IndexedHashtable(); return(result); }
public TaggedPersonArrays(IndexedHashtable t) { if (t.Count == 0) { return; } if (t.Count == 1 && MdwsUtils.isException(t.GetValue(0))) { fault = new FaultTO((Exception)t.GetValue(0)); return; } arrays = new TaggedPersonArray[t.Count]; for (int i = 0; i < t.Count; i++) { string ky = (string)t.GetKey(i); if (t.GetValue(i) == null) { arrays[i] = new TaggedPersonArray(ky); } else if (MdwsUtils.isException(t.GetValue(i))) { arrays[i] = new TaggedPersonArray(ky, (Exception)t.GetValue(i)); } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedPersonArray(ky, (Person[])t.GetValue(i)); } else if (t.GetValue(i).GetType().IsInstanceOfType(new List <Person>())) { arrays[i] = new TaggedPersonArray(ky, (List <Person>)t.GetValue(i)); } else { arrays[i] = new TaggedPersonArray(ky, (Person)t.GetValue(i)); } } count = t.Count; }
internal IndexedHashtable removeDups(IndexedHashtable t) { IndexedHashtable result = new IndexedHashtable(); for (int i = 0; i < t.Count; i++) { string source = (string)t.GetKey(i); if (t.GetValue(i) == null) { result.Add(source, null); continue; } if (t.GetValue(i).GetType().Name.EndsWith("Exception")) { gov.va.medora.mdo.exceptions.MdoException e = new gov.va.medora.mdo.exceptions.MdoException( gov.va.medora.mdo.exceptions.MdoExceptionCode.DATA_INVALID, (Exception)t.GetValue(i)); result.Add(source, e); continue; } List <Person> persons = (List <Person>)t.GetValue(i); List <DemographicsRecord> rex = new List <DemographicsRecord>(persons.Count); Hashtable ht = new Hashtable(persons.Count); foreach (Person p in persons) { PersonTO pto = new PersonTO(p); DemographicsRecord rec = new DemographicsRecord(pto, source); long hashcode = new TOReflection.TOEqualizer(rec).HashCode; if (!ht.ContainsKey(hashcode)) { ht.Add(hashcode, rec); rex.Add(rec); } } result.Add(source, rex); } return(result); }
public IndexedHashtable disconnectRemoteSites() { int lth = cxnTable.Count - 1; if (lth <= 0) { return(null); } QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { queries[i] = new QueryThread(cxnTable.GetValue(i + 1), "disconnect", new Object[0]); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int i = 0; i < lth; i++) { string key = (string)cxnTable.GetKey(i + 1); threads[i].Join(); if (queries[i].isExceptionResult()) { result.Add(key, queries[i].Result); } else { result.Add(key, "OK"); } } for (int i = 0; i < result.Count; i++) { cxnTable.Remove(result.GetKey(i)); } return(result); }
public TaggedMedicationArrays(IndexedHashtable t) { if (t == null || t.Count == 0) { return; } arrays = new TaggedMedicationArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) == null) { arrays[i] = new TaggedMedicationArray((string)t.GetKey(i)); } else if (MdwsUtils.isException(t.GetValue(i))) { arrays[i] = new TaggedMedicationArray((string)t.GetKey(i), (Exception)t.GetValue(i)); } else if (t.GetValue(i).GetType() == typeof(System.Collections.Hashtable)) { IList <Medication> meds = ((System.Collections.Hashtable)t.GetValue(i))["meds"] as IList <Medication>; if (meds == null || meds.Count == 0) { arrays[i] = new TaggedMedicationArray((string)t.GetKey(i)); } else { Medication[] ary = new Medication[meds.Count]; meds.CopyTo(ary, 0); arrays[i] = new TaggedMedicationArray((string)t.GetKey(i), ary); } } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedMedicationArray((string)t.GetKey(i), (Medication[])t.GetValue(i)); } else { arrays[i] = new TaggedMedicationArray((string)t.GetKey(i), (Medication)t.GetValue(i)); } } count = t.Count; }
public TaggedChemHemRptArrays(IndexedHashtable t) { if (t.Count == 0) { return; } arrays = new TaggedChemHemRptArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) == null) { arrays[i] = new TaggedChemHemRptArray((string)t.GetKey(i)); } else if (MdwsUtils.isException(t.GetValue(i))) { arrays[i] = new TaggedChemHemRptArray((string)t.GetKey(i), (Exception)t.GetValue(i)); } else if (t.GetValue(i).GetType() == typeof(System.Collections.Hashtable)) { IList <ChemHemReport> temp = ((System.Collections.Hashtable)t.GetValue(i))["labs"] as IList <ChemHemReport>; if (temp == null || temp.Count == 0) { arrays[i] = new TaggedChemHemRptArray((string)t.GetKey(i)); } else { ChemHemReport [] ary = new ChemHemReport[temp.Count]; temp.CopyTo(ary, 0); arrays[i] = new TaggedChemHemRptArray((string)t.GetKey(i), ary); } } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedChemHemRptArray((string)t.GetKey(i), (ChemHemReport[])t.GetValue(i)); } else { arrays[i] = new TaggedChemHemRptArray((string)t.GetKey(i), (ChemHemReport)t.GetValue(i)); } } count = t.Count; }
public TaggedNoteArrays(IndexedHashtable t) { if (t == null || t.Count == 0) { return; } arrays = new TaggedNoteArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) == null) { arrays[i] = new TaggedNoteArray((string)t.GetKey(i)); } else if (MdwsUtils.isException(t.GetValue(i))) { arrays[i] = new TaggedNoteArray((string)t.GetKey(i), (Exception)t.GetValue(i)); } else if (t.GetValue(i).GetType() == typeof(System.Collections.Hashtable)) { IList <Note> temp = ((System.Collections.Hashtable)t.GetValue(i))["documents"] as IList <Note>; if (temp == null || temp.Count == 0) { arrays[i] = new TaggedNoteArray((string)t.GetKey(i)); } else { Note[] ary = new Note[temp.Count]; temp.CopyTo(ary, 0); arrays[i] = new TaggedNoteArray((string)t.GetKey(i), ary); } } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedNoteArray((string)t.GetKey(i), (Note[])t.GetValue(i)); } else { arrays[i] = new TaggedNoteArray((string)t.GetKey(i), (Note)t.GetValue(i)); } } count = t.Count; }
public String getDefaultSiteId() { return((String)cxnTable.GetKey(0)); }
public IndexedHashtable disconnectRemoteSites() { int lth = cxnTable.Count - 1; if (lth <= 0) { return null; } QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { queries[i] = new QueryThread(cxnTable.GetValue(i+1), "disconnect", new Object[0]); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int i = 0; i < lth; i++) { string key = (string)cxnTable.GetKey(i + 1); threads[i].Join(); if (queries[i].isExceptionResult()) { result.Add(key, queries[i].Result); } else { result.Add(key, "OK"); } } for (int i = 0; i < result.Count; i++) { cxnTable.Remove(result.GetKey(i)); } return result; }
public static IndexedHashtable execute2(IndexedHashtable cxnTable, string daoName, string methodName, Object[] args) { if (cxnTable == null || cxnTable.Count == 0) { throw new Exception("No connections!"); } int lth = cxnTable.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { if (cxnTable.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { continue; } Connection cxn = (Connection)cxnTable.GetValue(i); if (!cxn.IsConnected) { continue; } Object dao = ((Connection)cxnTable.GetValue(i)).getDao(daoName); if (dao == null) { continue; } queries[i] = new QueryThread(dao, methodName, args); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(cxnTable.Count); for (int i = 0; i < threads.Length; i++) { if (cxnTable.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { result.Add((string)cxnTable.GetKey(i), (Exception)cxnTable.GetValue(i)); continue; } Connection cxn = (Connection)cxnTable.GetValue(i); if (!cxn.IsConnected) { result.Add((string)cxnTable.GetKey(i), new Exception("Source is not connected")); continue; } Object dao = ((Connection)cxnTable.GetValue(i)).getDao(daoName); if (dao == null) { result.Add((string)cxnTable.GetKey(i), new Exception("Invalid dao: " + daoName)); continue; } threads[i].Join(); result.Add((String)cxnTable.GetKey(i), queries[i].Result); } return result; }
private void setProps(IndexedHashtable t) { this.results = new TaggedText[t.Count]; for (int i = 0; i < t.Count; i++) { this.results[i] = new TaggedText(); this.results[i].tag = (string)t.GetKey(i); if (t.GetValue(i) == null) { continue; } Type vType = t.GetValue(i).GetType(); if (vType == typeof(string)) { this.results[i].text = (string)t.GetValue(i); } else if (vType == typeof(string[])) { string[] a = (string[])t.GetValue(i); this.results[i].taggedResults = new TaggedText[a.Length]; for (int j = 0; j < a.Length; j++) { if (textOnly) { this.results[i].taggedResults[j] = new TaggedText("", a[j]); } else { this.results[i].taggedResults[j] = new TaggedText(a[j]); } } } else if (vType == typeof(Dictionary <string, ArrayList>)) { Dictionary <string, ArrayList> d = (Dictionary <string, ArrayList>)t.GetValue(i); this.results[i].taggedResults = new TaggedText[d.Count]; int j = 0; foreach (KeyValuePair <string, ArrayList> kvp in d) { this.results[i].taggedResults[j++] = new TaggedText(kvp); } } else if (vType == typeof(IndexedHashtable)) { IndexedHashtable tbl = (IndexedHashtable)t.GetValue(i); this.results[i].taggedResults = new TaggedText[tbl.Count]; for (int j = 0; j < tbl.Count; j++) { this.results[i].taggedResults[j] = new TaggedText((string)tbl.GetKey(j), (string)tbl.GetValue(j)); } } else if (vType == typeof(DictionaryHashList)) { DictionaryHashList d = (DictionaryHashList)t.GetValue(i); this.results[i].taggedResults = new TaggedText[d.Count]; for (int j = 0; j < d.Count; j++) { this.results[i].taggedResults[j] = new TaggedText(d[j]); } } else if (vType == typeof(KeyValuePair <int, string>)) { if (t.Count == 1) { this.results = new TaggedText[] { new TaggedText((KeyValuePair <int, string>)t.GetValue(i)) }; } else { this.results[i].taggedResults = new TaggedText[] { new TaggedText((KeyValuePair <int, string>)t.GetValue(i)) }; } } else if (vType == typeof(DateTime)) { string s = ((DateTime)t.GetValue(i)).ToString("yyyyMMdd.HHmmss"); if (t.Count == 1) { this.results = new TaggedText[] { new TaggedText(t.GetKey(i).ToString(), s) }; } else { this.results[i].taggedResults = new TaggedText[] { new TaggedText(t.GetKey(i).ToString(), s) }; } } else if (vType == typeof(StringDictionary)) { StringDictionary sd = (StringDictionary)t.GetValue(i); this.results[i] = new TaggedText(this.results[i].tag, sd); } else if (vType == typeof(OrderedDictionary)) { OrderedDictionary d = (OrderedDictionary)t.GetValue(i); this.results[i] = new TaggedText(this.results[i].tag, d); } else if (vType == typeof(User)) { string s = ((User)t.GetValue(i)).Uid; this.results[i].text = s; } else if (MdwsUtils.isException(t.GetValue(i))) { this.results[i].fault = new FaultTO((Exception)t.GetValue(i)); } else if (vType == typeof(gov.va.medora.mdo.domain.ccd.ContinuityOfCareRecord)) { // serialize CCR as XML MemoryStream memStream = new MemoryStream(); XmlSerializer serializer = new XmlSerializer(typeof(ContinuityOfCareRecord)); serializer.Serialize(memStream, new ContinuityOfCareRecord()); this.results[i] = new TaggedText(this.results[i].tag, "<![CDATA[" + System.Text.Encoding.UTF8.GetString(memStream.ToArray()) + "]]>"); } } this.count = t.Count; }