private void GetITgList() { IWebProxy webProxy; webProxy = GlobalProxySelection.Select; webProxy.Credentials = CredentialCache.DefaultCredentials; //set up web service object LogicWebService.ITGLogicWebService ws; ws = new LogicWebService.ITGLogicWebService(); ws.Proxy = webProxy; ws.Url = "https://logic.itginc.com/services/CalculationService_v3_0?wsdl"; ws.PreAuthenticate = true; ws.Timeout = 60000; ws.Credentials = new NetworkCredential("Linedatatest", "Linedata3"); //set up the input arguments for the web service "calculate" method LogicWebService.CalcParameters calcParams = new LogicWebService.CalcParameters(); calcParams.riskParameters = new LogicWebService.RiskParameters(); calcParams.riskParameters.benchmarkId = "sp500"; calcParams.riskParameters.riskModelId = "USA.2.D"; calcParams.tradelist = new LogicWebService.Tradelist(); calcParams.tradelist.securitiesArray = new LogicWebService.Security[1]; LogicWebService.Security security = new LogicWebService.Security(); security.dayDate = System.DateTime.Now; calcParams.tradelist.name = "Test"; ws.setTradelist(calcParams.tradelist); string[] test = ws.getTradelistNames(); foreach (string s in test) { comboBox1.Items.Add(s); } comboBox1.SelectedIndex = 0; }
private void button2_Click(object sender, System.EventArgs e) { IWebProxy webProxy; webProxy = GlobalProxySelection.Select; webProxy.Credentials = CredentialCache.DefaultCredentials; //set up web service object LogicWebService.ITGLogicWebService ws; ws = new LogicWebService.ITGLogicWebService(); ws.Proxy = webProxy; ws.Url = "https://logic.itginc.com/services/CalculationService_v3_0?wsdl"; ws.PreAuthenticate = true; ws.Timeout = 60000; ws.Credentials = new NetworkCredential("Linedatatest", "Linedata3"); ws.deleteTradelist(comboBox1.Text); comboBox1.Items.Clear(); GetITgList(); }
private void cmdOK_Click(object sender, System.EventArgs e) { try { //set up webProxy object; these are default settings that will //work in most Windows environments; more custom code would be //necessary for more complex environments. IWebProxy webProxy; webProxy = GlobalProxySelection.Select; webProxy.Credentials = CredentialCache.DefaultCredentials; //set up web service object LogicWebService.ITGLogicWebService ws; ws = new LogicWebService.ITGLogicWebService(); ws.Proxy = webProxy; ws.Url = "https://logic.itginc.com/services/CalculationService_v3_0?wsdl"; ws.PreAuthenticate = true; ws.Timeout = 60000; ws.Credentials = new NetworkCredential( "Linedatatest", "Linedata3" ); //set up the input arguments for the web service "calculate" method LogicWebService.CalcParameters calcParams = new LogicWebService.CalcParameters(); calcParams.riskParameters = new LogicWebService.RiskParameters(); calcParams.riskParameters.benchmarkId = "sp500"; calcParams.riskParameters.riskModelId = "USA.3.D"; calcParams.tradelist = new LogicWebService.Tradelist(); calcParams.tradelist.securitiesArray = new LogicWebService.Security[_symbol.Length]; for (int i = 0; i < _symbol.Length; i++) { LogicWebService.Security security = new LogicWebService.Security(); security.stockId = _symbol[i]; security.country = _country[i]; security.amount = Convert.ToDouble(_quantity[i]); security.dayDate = System.DateTime.Now; calcParams.tradelist.securitiesArray[i] = security; calcParams.dayDate = security.dayDate; } calcParams.tradelist.name = comboBox1.Text; calcParams.sourceApp = "a"; ////make the call to web services LogicWebService.CalcResults calcResults = ws.calculate(calcParams); //int ex = if (calcResults.tradelistResults.exceptions.Count(); // int? ex1 = Convert.ToInt32(calcResults.tradelistResults.exceptions.Count()); int? ex1 = 0; //TODO:this int got rid of // var ex1 = (int?) calcResults.tradelistResults.exceptions.Count() > 0 ?calcResults.tradelistResults.exceptions.Count():0; //var ex1 = 0; for (int i = 0; i < ex1; i++) { LogicWebService.CalcException secExceptions = (LogicWebService.CalcException)calcResults.tradelistResults.exceptions.GetValue(i); System.Windows.MessageBox.Show("There was a problem with Security " + secExceptions.securityException.stockId.ToString() + ": " + secExceptions.message.ToString()); } ////get the results and show in the text boxes //LogicWebService.SecurityResults secResults = (LogicWebService.SecurityResults)calcResults.tradelistResults.securityResultsArray.GetValue(0); if (_symbol.Length > ex1) { System.Windows.MessageBox.Show("List Updated"); this.Close(); } else { System.Windows.MessageBox.Show("No Valid Securities selected."); this.Close(); } } catch( Exception ex ) { string a = string.Format("{0}",ex.Message); if(a != "Value cannot be null.\r\nParameter name: source") System.Windows.MessageBox.Show( ex.Message ); else System.Windows.MessageBox.Show("List Updated"); this.Close(); } }