public List <KeyValuePair <string, string> > GetDavl(string dataname, string davlType, string sqlStatement, string[] sqlParameters) { UserContext Context = (UserContext)HttpContext.Current.Session["UserContext"]; TransactionExecution Execution = new TransactionExecution(Context); List <KeyValuePair <string, string> > ReturnValue = new List <KeyValuePair <string, string> >(); DataTable FieldChoiceValues = null; string CacheKey = ""; if (davlType == "SQL") { CacheKey = davlType + "_" + sqlStatement.GetHashCode().ToString() + "_" + sqlStatement.ToUpperInvariant().GetHashCode().ToString() + "_" + Context.TroposServer + "_" + Context.TroposDatabase + "_" + Context.TroposSession.Language; if (sqlParameters != null) { int i = 0; foreach (string sqlParameter in sqlParameters) { i = i ^ sqlParameter.GetHashCode(); } CacheKey = CacheKey + "_" + i.ToString(); } } else { CacheKey = davlType + "_" + dataname + "_" + Context.TroposServer + "_" + Context.TroposDatabase + "_" + Context.TroposSession.Language; } if (HttpContext.Current.Cache[CacheKey] == null) { switch (davlType) { case "UOM": FieldChoiceValues = Execution.GetUOMChoices(); break; case "YorN": case "YorM": FieldChoiceValues = Execution.GetFieldChoiceValues(davlType.ToUpper(CultureInfo.InvariantCulture)); break; case "SQL": FieldChoiceValues = GetSqlFieldChoices(Context, sqlStatement, sqlParameters); break; case "Yes": FieldChoiceValues = Execution.GetFieldChoiceValues(dataname); break; default: FieldChoiceValues = new DataTable(); break; } HttpContext.Current.Cache.Insert(CacheKey, FieldChoiceValues, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(60)); } else { FieldChoiceValues = (DataTable)HttpContext.Current.Cache[CacheKey]; } if (FieldChoiceValues.Rows.Count == 0) { ReturnValue.Add(new KeyValuePair <string, string>("?", "No field choices available")); ; } else { foreach (DataRow Row in FieldChoiceValues.Rows) { ReturnValue.Add(new KeyValuePair <string, string>((string)Row["Code"], (string)Row["Description"])); } } return(ReturnValue); }