Esempio n. 1
0
        public ContractInfo[] GetDocInfo(string feedType, string docKey, string tradingSystem, Dictionary <string, string> queries)
        {
            GetDocInfoForQueryRequest request = new GetDocInfoForQueryRequest
            {
                DocumentKey       = docKey,
                FeedType          = feedType,
                TradingSystemCode = tradingSystem,
                QueryValues       = queries
            };

            GetDocInfoForQueryResponse response = _client.GetDocInfoForQuery(request);

            return(response.QueryResult);
        }
Esempio n. 2
0
        public List <Dictionary <string, string> > GetDocumentInfoList(string pTradingSysCode, string pTicketNo, Dictionary <string, string> pQueryValues)
        {
            List <Dictionary <string, string> > dicList = new List <Dictionary <string, string> >();

            VaultSvcClient client = new VaultSvcClient(VAULTVIEWER_ENDPOINT, urlStr);

            client.ClientCredentials.UserName.UserName = svcUserName;
            client.ClientCredentials.UserName.Password = svcPassword;

            GetDocInfoForQueryRequest request = new GetDocInfoForQueryRequest
            {
                TradingSystemCode = pTradingSysCode,
                DocumentKey       = pTicketNo,
                FeedType          = "CONTRACTS",
                QueryValues       = pQueryValues
            };

            GetDocInfoForQueryResponse response = new GetDocInfoForQueryResponse();

            /*
             * response.QueryResult is a list of ContractInfo objects, i.e., documents
             * Iterate through them and for each document find every valid data field which contains data.
             * Add the field name and data value to a dictionary for the document.
             * Return the list of dictionary items, containing one dictionary item for each document
             * For now, display all boolean fields whether true or false.
             */
            response = client.GetDocInfoForQuery(request);
            if (response != null && response.QueryResult != null)
            {
                foreach (var docInfo in response.QueryResult)
                {
                    Type           docInfoType     = docInfo.GetType();
                    PropertyInfo[] propsForDocInfo = docInfoType.GetProperties();

                    Dictionary <string, string> dicItem = new Dictionary <string, string>();
                    foreach (PropertyInfo prop in propsForDocInfo)
                    {
                        var  propType   = prop.PropertyType;
                        bool getValueOk = false;

                        //Ignore all non-data-containing fields
                        if (propType.IsPrimitive || propType == typeof(Decimal) || propType == typeof(String))
                        {
                            string propValue = String.Empty;
                            if (prop.GetValue(docInfo, null) != null)
                            {
                                propValue = prop.GetValue(docInfo, null).ToString();
                            }

                            if (VVUtils.IsNumericPropertyType(propType.Name))
                            {
                                //propValue = prop.GetValue(docInfo, null).ToString();
                                if (propValue != "0")
                                {
                                    getValueOk = true;
                                }
                            }
                            else if (!String.IsNullOrEmpty(propValue))
                            {
                                //propValue = prop.GetValue(docInfo, null).ToString();
                                getValueOk = true;
                            }

                            if (getValueOk)
                            {
                                string propName = prop.Name;
                                dicItem.Add(propName, propValue);
                            }
                        }

                        //Test stub
                        //dicItem.Add("DocType", "CONFIRM-OUTBOUND");
                        //dicItem.Add("URL", "abd912732kjdyes932po95ahd883wsgf52");
                    }
                    dicList.Add(dicItem);
                }
            }

            return(dicList);
        }
Esempio n. 3
0
        public List<Dictionary<string, string>> GetDocumentInfoList(string pTradingSysCode, string pTicketNo, Dictionary<string, string> pQueryValues)
        {
            List<Dictionary<string, string>> dicList = new List<Dictionary<string, string>>();

            VaultSvcClient client = new VaultSvcClient(VAULTVIEWER_ENDPOINT, urlStr);
            client.ClientCredentials.UserName.UserName = svcUserName;
            client.ClientCredentials.UserName.Password = svcPassword;

            GetDocInfoForQueryRequest request = new GetDocInfoForQueryRequest
            {
                TradingSystemCode = pTradingSysCode,
                DocumentKey = pTicketNo,
                FeedType = "CONTRACTS",
                QueryValues = pQueryValues
            };

            GetDocInfoForQueryResponse response = new GetDocInfoForQueryResponse();
            /*
             * response.QueryResult is a list of ContractInfo objects, i.e., documents
             * Iterate through them and for each document find every valid data field which contains data.
             * Add the field name and data value to a dictionary for the document.
             * Return the list of dictionary items, containing one dictionary item for each document
             * For now, display all boolean fields whether true or false.
             */
            response = client.GetDocInfoForQuery(request);
            if (response != null && response.QueryResult != null)
            {
                foreach (var docInfo in response.QueryResult)
                {
                    Type docInfoType = docInfo.GetType();
                    PropertyInfo[] propsForDocInfo = docInfoType.GetProperties();

                    Dictionary<string, string> dicItem = new Dictionary<string, string>();
                    foreach (PropertyInfo prop in propsForDocInfo)
                    {
                        var propType = prop.PropertyType;
                        bool getValueOk = false;

                        //Ignore all non-data-containing fields
                        if (propType.IsPrimitive || propType == typeof(Decimal) || propType == typeof(String))
                        {
                            string propValue = String.Empty;
                            if (prop.GetValue(docInfo, null) != null)
                                propValue = prop.GetValue(docInfo, null).ToString();

                            if (VVUtils.IsNumericPropertyType(propType.Name))
                            {
                                //propValue = prop.GetValue(docInfo, null).ToString();
                                if (propValue != "0")
                                    getValueOk = true;
                            }
                            else if (!String.IsNullOrEmpty(propValue))
                            {
                                //propValue = prop.GetValue(docInfo, null).ToString();
                                getValueOk = true;
                            }

                            if (getValueOk)
                            {
                                string propName = prop.Name;
                                dicItem.Add(propName, propValue);
                            }
                        }

                        //Test stub
                        //dicItem.Add("DocType", "CONFIRM-OUTBOUND");
                        //dicItem.Add("URL", "abd912732kjdyes932po95ahd883wsgf52");
                    }
                    dicList.Add(dicItem);
                }
            }

            return dicList;
        }