/// <summary> /// Ticket #120 - this algorithm is used to help determine how many records /// to pull from the NEW PERSON file in site 583 (Indy) /// </summary> /// <returns></returns> public String getEndPointFromBinarySearch(String startPoint, String maxRex) { _iterations++; Int32 maxRexAsInt = Convert.ToInt32(maxRex); if ((maxRexAsInt / 2) < 3 || _iterations > PRECISION) // if we're within a few IENs, go ahead and return start point { return(startPoint); } try { String[] testQuery = _dao.ddrLister("583", "200", "", ".01", "IP", maxRex, startPoint, "", "#", "", ""); String lastSuccessfulIen = testQuery[testQuery.Length - 1].Split(new char[] { '^' })[0]; return(getEndPointFromBinarySearch(lastSuccessfulIen, (maxRexAsInt / 2).ToString())); } catch (gov.va.medora.mdo.exceptions.MdoException mdoExc) { if (mdoExc.Message.Contains("M ERROR")) { return(getEndPointFromBinarySearch(startPoint, (maxRexAsInt / 2).ToString())); } else { throw mdoExc; } } catch (Exception) { throw; } throw new BinarySearchException(); }
internal static IList <String> getIensFromVistaFile(IVistaDao dao, String siteId, String vistaFile) { //IVistaDao dao = new VistaDaoFactory().getVistaDao(ConfigurationManager.AppSettings[config.AppConfigSettingsConstants.VistaDaoType]); String startIen = "0"; IList <String> result = new List <String>(); Char[] ddrDelim = new Char[] { '^' }; Decimal greatestIen = 0; bool infiniteLoopFlag = false; while (!infiniteLoopFlag) { String[] results = dao.ddrLister(siteId, vistaFile, "", ".01", "IP", "5000", startIen, "", "#", "", ""); if (results == null || results.Length == 0) { break; } foreach (String s in results) { String currentIen = s.Split(ddrDelim)[0]; Decimal currentIenAsDecimal = Convert.ToDecimal(currentIen); if (currentIenAsDecimal <= greatestIen) { infiniteLoopFlag = true; break; } greatestIen = currentIenAsDecimal; result.Add(currentIen); } startIen = greatestIen.ToString(); } return(result); }
public QueryResults query(VistaQuery query) { // if we're querying unpacked, we should add the "WID" field to our fields string so DDR LISTER will return the identifier values String[] ddrResults = _dao.ddrLister(query.SiteCode, query.VistaFile, query.IENS, query.Fields, query.Flags, query.MaxRecords, query.From, query.Part, query.XREF, query.Screen, query.Identifier); // special 63.04 handling if (String.Equals(query.VistaFile, "63.04")) { _labChemIens.Add(query.IENS.Replace(",", "")); // add the file 63 IEN to this collection for ticket #76 //return new LabChemUtils(_labChemDataDictionary).parseLabChemDdrResults(query, ddrResults); return(new LabChemUtils().parseLabChemDdrResults(query, ddrResults)); } // end special 63.04 handling // first check to see if we should fetch key/val (aka vertical) results DataTable verticalResults = null; if (!String.IsNullOrEmpty(query.WP_Or_Computed_Fields) && !String.IsNullOrEmpty(query.Gets_Alignment)) // KEY/VAL SUB QUERIES { verticalResults = getVerticalResultsForQueries(query, ddrResults, query.IENS); } // if not looking for vertical, do we need to fetch WP or other large fields and add them to DDR? else if (!String.IsNullOrEmpty(query.WP_Or_Computed_Fields)) // WP fields { ddrResults = addWpOrComputed(query, ddrResults); } QueryResults qr = null; // if we are fetching WP fields AND this configuration isn't building a key value table AND there are subfiles then we need to call our super special method in DataTableUtils! ticket #16 if (!String.IsNullOrEmpty(query.WP_Or_Computed_Fields) && String.IsNullOrEmpty(query.Gets_Alignment) && !String.IsNullOrEmpty(query.IdentifiedFiles)) { DataTableUtils.adjustDdrResultsWithWpAndIdentifiedFiles(query, ddrResults); qr = DataTableUtils.toQueryResultsFromDdr(query, ddrResults); // ddrResults is "fixed" by adjust function } else // for most cases, just building this up without special logic above { qr = DataTableUtils.toQueryResultsFromDdr(query, ddrResults); } // ugh - this seems ugly and hackish doing this out of process from the subqueries for WP fields above... oh, well, seems ok for now at least if (!String.IsNullOrEmpty(query.WP_Or_Computed_Fields) && _exceptionBag != null) { foreach (Exception e in _exceptionBag) { _report.Exceptions.Add(e); } } // did we have any key/val queries? if so, add the table to our results if (verticalResults != null) { qr.DdrResults.Add(verticalResults); } return(qr); // DataTableUtils.toQueryResultsFromDdr(query, ddrResults); }
internal string get120x5Seed(string sitecode) { String[] results = _dao.ddrLister(sitecode, "120.5", "", ".01", "IP", "1", VistaIenSeeder._seedStartDate, "", "B", "", ""); String startIen = results[0].Split(new char[] { '^' })[0]; //_dao.getReport().addDebug(String.Format("Seeding query for file {0} at site {1} - XREF:{2}, Result:{3}", "405", sitecode, "B", startIen)); return(startIen); }