public static Hashtable GetHashtableFromQueryInfoObj(QueryInfo queryInfo) { Hashtable queryInfoTable = new Hashtable(); if (queryInfo == null) { return null; } // putting back null values int nullIndex = 0; string[] queryAttribValues=new string[queryInfo.attributes.Count]; queryInfo.attributes.CopyTo(queryAttribValues); foreach (string attrib in queryAttribValues) { if (attrib == "NCNULL") { queryInfo.attributes.Insert(nullIndex, null); queryInfo.attributes.RemoveAt(nullIndex + 1); } nullIndex++; } ArrayList attributes = new ArrayList(); foreach (string attrib in queryInfo.attributes) { attributes.Add(attrib); } queryInfoTable.Add(queryInfo.handleId, attributes); return queryInfoTable; }
public static QueryInfo GetQueryInfoObj(Hashtable queryInfoDic) { if (queryInfoDic == null) { return null; } if (queryInfoDic.Count == 0) { return null; } QueryInfo queryInfo = new QueryInfo(); IDictionaryEnumerator queryInfoEnum = queryInfoDic.GetEnumerator(); while (queryInfoEnum.MoveNext()) { queryInfo.handleId = (int)queryInfoEnum.Key; IEnumerator valuesEnum = ((ArrayList)queryInfoEnum.Value).GetEnumerator(); while (valuesEnum.MoveNext()) { string value = null; if (valuesEnum.Current != null) { if (valuesEnum.Current is DateTime) { value = ((DateTime)valuesEnum.Current).Ticks.ToString(); } else { value = valuesEnum.Current.ToString(); } } else // we need to send null values too as a special placeholder { value = "NCNULL"; } queryInfo.attributes.Add(value); } } return queryInfo; }