Ejemplo n.º 1
0
 private VaultSvcAccessor(string pBaseUrl, string pSvcUserName, string pSvcPassword)
  {          
      _client = new VaultSvcClient(VAULT_SVC_ENDPOINT, pBaseUrl + @"/" + VAULT_SVC_URL_EXT);
      //why user id pwd...
      _client.ClientCredentials.UserName.UserName = pSvcUserName;
      _client.ClientCredentials.UserName.Password = pSvcPassword;
  }
Ejemplo n.º 2
0
        public byte[] GetDocumentForFileName(string pFileName, string pMetadata, string pDocURL)
        {
            VaultSvcClient client = new VaultSvcClient(VAULTVIEWER_ENDPOINT, urlStr);

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

            Dictionary <string, string> docDetails = extractDataFromMetaData(pMetadata);
            GetDocumentForURLRequest    request    = new GetDocumentForURLRequest();

            //{
            //    TradingSystemCode = "",
            //    DocumentKey = "",
            //    FeedType = "",
            //    FileName = pFileName,
            //    URL = ""
            //};
            request.FileName          = pFileName;
            request.FeedType          = "CONTRACTS";//(docDetails.ContainsKey("FileType") ==true ? docDetails["FileType"].ToString() : "");
            request.DocumentKey       = (docDetails.ContainsKey("TradeNum") == true ? docDetails["TradeNum"].ToString() : "");
            request.TradingSystemCode = (docDetails.ContainsKey("Source") == true ? docDetails["Source"].ToString() : "");
            request.URL = pDocURL;

            GetDocumentForURLResponse response = client.GetDocumentForURL(request);

            return(response.ObjectStream);
        }
Ejemplo n.º 3
0
 private VaultSvcAccessor(string pBaseUrl, string pSvcUserName, string pSvcPassword)
 {
     _client = new VaultSvcClient(VAULT_SVC_ENDPOINT, pBaseUrl + @"/" + VAULT_SVC_URL_EXT);
     //why user id pwd...
     _client.ClientCredentials.UserName.UserName = pSvcUserName;
     _client.ClientCredentials.UserName.Password = pSvcPassword;
 }
Ejemplo n.º 4
0
        public byte[] GetDocumentForURL(string pUrl)
        {
            VaultSvcClient client = new VaultSvcClient(VAULTVIEWER_ENDPOINT, urlStr);

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

            GetDocumentForURLRequest request = new GetDocumentForURLRequest
            {
                TradingSystemCode = "",
                DocumentKey       = "",
                FeedType          = "",
                FileName          = "",
                URL = pUrl
            };

            GetDocumentForURLResponse response = client.GetDocumentForURL(request);

            return(response.ObjectStream);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
        private VaultSvcAccessor()
        {
            string pBaseUrl = String.Empty;//TODO :get this from config local

            _client = new VaultSvcClient(VAULT_SVC_ENDPOINT, pBaseUrl + @"/" + VAULT_SVC_URL_EXT);
        }
Ejemplo n.º 7
0
 private VaultSvcAccessor(string pBaseUrl)
 {
     _client = new VaultSvcClient(VAULT_SVC_ENDPOINT, pBaseUrl + @"/" + VAULT_SVC_URL_EXT);
 }
Ejemplo n.º 8
0
 private VaultSvcAccessor()            
 {
     string pBaseUrl = String.Empty;//TODO :get this from config local
     _client = new VaultSvcClient(VAULT_SVC_ENDPOINT, pBaseUrl + @"/" + VAULT_SVC_URL_EXT);
 }
Ejemplo n.º 9
0
 private VaultSvcAccessor(string pBaseUrl)
 {      
     _client = new VaultSvcClient(VAULT_SVC_ENDPOINT, pBaseUrl + @"/" + VAULT_SVC_URL_EXT);
 }
Ejemplo n.º 10
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;
        }
Ejemplo n.º 11
0
        public byte[] GetDocumentForFileName(string pFileName, string pMetadata, string pDocURL)
        {
            VaultSvcClient client = new VaultSvcClient(VAULTVIEWER_ENDPOINT, urlStr);
            client.ClientCredentials.UserName.UserName = svcUserName;
            client.ClientCredentials.UserName.Password = svcPassword;           

            Dictionary<string,string> docDetails = extractDataFromMetaData(pMetadata);
            GetDocumentForURLRequest request = new GetDocumentForURLRequest();
            //{
            //    TradingSystemCode = "",
            //    DocumentKey = "",
            //    FeedType = "",
            //    FileName = pFileName,
            //    URL = ""
            //};
            request.FileName = pFileName;
            request.FeedType = "CONTRACTS";//(docDetails.ContainsKey("FileType") ==true ? docDetails["FileType"].ToString() : "");
            request.DocumentKey = (docDetails.ContainsKey("TradeNum") == true ? docDetails["TradeNum"].ToString() : "");
            request.TradingSystemCode = (docDetails.ContainsKey("Source") == true ? docDetails["Source"].ToString() : "");
            request.URL = pDocURL;

            GetDocumentForURLResponse response = client.GetDocumentForURL(request);

            return response.ObjectStream;
        }
Ejemplo n.º 12
0
        public byte[] GetDocumentForURL(string pUrl)
        {
            VaultSvcClient client = new VaultSvcClient(VAULTVIEWER_ENDPOINT, urlStr);
            client.ClientCredentials.UserName.UserName = svcUserName;
            client.ClientCredentials.UserName.Password = svcPassword;

            GetDocumentForURLRequest request = new GetDocumentForURLRequest
            {
                TradingSystemCode = "",
                DocumentKey = "",
                FeedType = "",
                FileName = "",
                URL = pUrl 
            };

            GetDocumentForURLResponse response = client.GetDocumentForURL(request);

            return response.ObjectStream;
        }