public RefDataEntities Search(string query, int start, int limit) { relativeUri = string.Format("/search/{0}/{1}/{2}", query, start, limit); return(_referenceDataServiceClient.Get <RefDataEntities>(relativeUri)); }
public DataDictionary GetDictionary(string scopeName, string applicationName) { string dictKey = string.Format("Dictionary.{0}.{1}", scopeName, applicationName); DataDictionary dictionary = (DataDictionary)Session[dictKey]; if (dictionary != null) { return(dictionary); } try { WebHttpClient client = CreateWebClient(_dataServiceUri); string isAsync = _settings["Async"]; if (isAsync != null && isAsync.ToLower() == "true") { client.Async = true; string statusUrl = client.Get <string>(String.Format("/{0}/{1}/dictionary?format=xml", applicationName, scopeName)); if (string.IsNullOrEmpty(statusUrl)) { throw new Exception("Asynchronous status URL not found."); } dictionary = WaitForRequestCompletion <DataDictionary>(_dataServiceUri, statusUrl); } else { dictionary = client.Get <DataDictionary>(String.Format("/{0}/{1}/dictionary?format=xml", applicationName, scopeName), true); } } catch (Exception ex) { _logger.Error(ex.ToString()); throw ex; } // sort data objects and properties if (dictionary != null && dictionary.dataObjects != null) { dictionary.dataObjects.Sort(new DataObjectComparer()); foreach (DataObject dataObject in dictionary.dataObjects) { dataObject.dataProperties.Sort(new DataPropertyComparer()); // move key elements to top of the List. List <String> keyPropertyNames = new List <String>(); foreach (KeyProperty keyProperty in dataObject.keyProperties) { keyPropertyNames.Add(keyProperty.keyPropertyName); } var value = ""; for (int i = 0; i < keyPropertyNames.Count; i++) { value = keyPropertyNames[i]; List <DataProperty> DataProperties = dataObject.dataProperties; DataProperty prop = null; for (int j = 0; j < DataProperties.Count; j++) { if (DataProperties[j].propertyName == value) { prop = DataProperties[j]; DataProperties.RemoveAt(j); break; } } if (prop != null) { DataProperties.Insert(0, prop); } } } } Session[dictKey] = dictionary; return(dictionary); }