private void button8_Click(object sender, EventArgs e) { this.panel2.Focus(); LicenseServiceClient licenseServiceClient = new LicenseServiceClient(); foreach (DataGridViewRow row in (IEnumerable)this.lwInstruments.Rows) { try { string s = row.Cells["InstrumentId"].Value.ToString(); licenseServiceClient.setInstumentState(long.Parse(s), (bool)row.Cells["Active"].Value); } catch { } } licenseServiceClient.Close(); SettingsProvider.Settings.LocalSetting.GetInstruments(); if (!MainWindow.processes.ContainsKey("Lmax")) { return; } MainWindow.stopProcess("Lmax"); MainWindow.startProcess("Lmax", ""); }
public void sendLogin() { LicenseServiceClient licenseServiceClient = new LicenseServiceClient(); licenseServiceClient.sendLogin(new Trader() { Account = this.User, Signature = this.Config }); licenseServiceClient.Close(); }
private void bSubmit_Click(object sender, EventArgs e) { bool flag = true; string text = ""; if (this.tbInstrumentId.Text == "") { text += "Instrument id must be defined\n"; flag = false; } if (this.tbExchange.Text == "" && this.cbProvider.Text == "Rithmic") { text += "Exchange must be defined"; flag = false; } if (this.tbName.Text == "") { text += "Name must be defined"; flag = false; } if (this.cbProvider.Text == "") { text += "Provider must be defined"; flag = false; } if (!flag) { Error2.showError(text); } else { LicenseServiceClient licenseServiceClient = new LicenseServiceClient(); int num = licenseServiceClient.addInstrument(new InstrumentsContract() { DisplayId = this.tbInstrumentId.Text, Description = this.tbName.Text, Parametr1 = this.tbExchange.Text, ProviderId = this.providerDict[this.cbProvider.Text] }); licenseServiceClient.Close(); if (num == 0) { Error2.showError("Instument already under revision"); } else { if (num != 1) { return; } Error2.showError("Your request has been added"); } } }
private void button8_Click(object sender, EventArgs e) { this.panel2.Focus(); LicenseServiceClient licenseServiceClient = new LicenseServiceClient(); foreach (DataGridViewRow row in (IEnumerable)this.lwInstruments.Rows) { licenseServiceClient.setInstumentState(long.Parse(row.Cells["InstrumentId"].Value.ToString()), (bool)row.Cells["Active"].Value); } licenseServiceClient.Close(); SettingsProvider.Settings.LocalSetting.GetInstruments(); MainWindow.stopProcess("Saxo"); MainWindow.startProcess("Saxo", ""); }
public static bool checkLicense(string Account, string SKU) { LicenseServiceClient licenseServiceClient1 = new LicenseServiceClient(); LicenseServiceClient licenseServiceClient2 = licenseServiceClient1; Trader _traderData = new Trader(); _traderData.Account = Account; _traderData.Signature = SettingsProvider.Security.CalcHash(Account); string SKU1 = SKU; int num = licenseServiceClient2.checkLicense(_traderData, SKU1) == 0 ? 1 : 0; licenseServiceClient1.Close(); return(num == 0); }
public static ICollection <InstrumentsContract> getInstuments(string Account, string SKU, string Product = "") { LicenseServiceClient licenseServiceClient1 = new LicenseServiceClient(); LicenseServiceClient licenseServiceClient2 = licenseServiceClient1; Trader _traderData = new Trader(); _traderData.Account = Account; _traderData.Signature = SettingsProvider.Security.CalcHash(Account); string SKU1 = SKU; string ProviderName = Product; InstrumentsContract[] instumentsSku = licenseServiceClient2.getInstumentsSKU(_traderData, SKU1, ProviderName); licenseServiceClient1.Close(); return((ICollection <InstrumentsContract>)instumentsSku); }
public string addNewInstrument(string _InstrumentId, string _Name, string _Parametr1, int _Provider, string _Parametr2 = "") { bool flag = true; string str1 = ""; if (_InstrumentId == "") { str1 += "Instrument id must be defined\n"; flag = false; } if (_Parametr1 == "" && _Provider == 3) { str1 += "Exchange must be defined"; flag = false; } if (_Name == "") { str1 += "Name must be defined"; flag = false; } if (!flag) { return(str1); } string str2 = ""; LicenseServiceClient licenseServiceClient = new LicenseServiceClient(); int num = licenseServiceClient.addInstrument(new InstrumentsContract() { DisplayId = _InstrumentId, Description = _Name, Parametr1 = _Parametr1, Parametr2 = _Parametr2, ProviderId = _Provider }); licenseServiceClient.Close(); switch (num) { case 0: str2 = "Instument already under revision"; break; case 1: str2 = "Your request has been added"; break; } return(str2); }
public bool connectToServer() { bool flag = false; LicenseServiceClient licenseServiceClient = new LicenseServiceClient(); if (licenseServiceClient.checkUser(new Trader() { Account = Settings.LocalSetting.User, Signature = Settings.LocalSetting.Config }) == 0) { flag = true; } licenseServiceClient.Close(); return(true); }
public bool canUseFeed(UserData _user) { LicenseServiceClient licenseServiceClient = new LicenseServiceClient(); bool flag; try { flag = (uint)licenseServiceClient.canUseFeed(new Trader() { Account = _user.User, Signature = _user.Signature }) > 0U; licenseServiceClient.Close(); } catch { flag = false; } return(true); }
public bool Authorize(UserData _user) { LicenseServiceClient licenseServiceClient = new LicenseServiceClient(); bool flag; try { flag = licenseServiceClient.checkUser(new Trader() { Account = _user.User, Signature = _user.Signature }) == 0; licenseServiceClient.Close(); } catch { flag = false; } return(true); }
public NewInstrumentRequest() { this.InitializeComponent(); this.providerDict = new Dictionary <string, int>(); LicenseServiceClient licenseServiceClient = new LicenseServiceClient(); ProviderContract[] providers = licenseServiceClient.getProviders(new Trader() { Account = Settings.LocalSetting.User, Signature = Settings.LocalSetting.Config }); if (providers != null) { foreach (ProviderContract providerContract in providers) { this.providerDict.Add(providerContract.Name, providerContract.Id); this.cbProvider.Items.Add((object)providerContract.Name); } } licenseServiceClient.Close(); }
public void GetInstruments() { if (this.CQGInstruments != null) { this.CQGInstruments.Clear(); } if (this.SaxoInstruments != null) { this.SaxoInstruments.Clear(); } if (this.LmaxInstruments != null) { this.LmaxInstruments.Clear(); } if (this.rithmicSubscriptions != null) { this.rithmicSubscriptions.Clear(); } if (this.TWSInstruments != null) { this.TWSInstruments.Clear(); } if (this.IQInstruments != null) { this.IQInstruments.Clear(); } if (!new Security().connectToServer()) { return; } LicenseServiceClient licenseServiceClient = new LicenseServiceClient(); List <ProviderContract> list1 = ((IEnumerable <ProviderContract>)licenseServiceClient.getProviders(new Trader() { Account = this.User, Signature = this.Config })).ToList <ProviderContract>(); List <InstrumentsContract> list2 = ((IEnumerable <InstrumentsContract>)licenseServiceClient.getInstuments(new Trader() { Account = this.User, Signature = this.Config })).ToList <InstrumentsContract>(); licenseServiceClient.Close(); if (list1 != null && list2 != null) { foreach (InstrumentsContract instrumentsContract in list2) { InstrumentsContract p = instrumentsContract; IEnumerable <ProviderContract> source = list1.Where <ProviderContract>((Func <ProviderContract, bool>)(pr => pr.Id == p.ProviderId)); if (source != null && source.Count <ProviderContract>() == 1) { string name = source.First <ProviderContract>().Name; if (!(name == "Lmax")) { if (!(name == "CQG")) { if (!(name == "Saxo")) { if (!(name == "Rithmic")) { if (!(name == "TWS")) { if (name == "IQFeed") { this.IQInstruments.Add(new Settings.IQFeedInstruments() { Id = p.Id, Symbol = p.DisplayId, Name = p.Description, Enabled = p.Enabled }); } } else { string[] strArray = p.DisplayId.Split('%'); this.TWSInstruments.Add(new Settings.TWSSubscription() { InstumentId = p.Id, Symbol = strArray[0], Currency = strArray[1], SecType = p.Parametr1, Exchange = p.Parametr2, Enabled = p.Enabled }); } } else { this.rithmicSubscriptions.Add(new Settings.rithmicSubscription() { InstumentId = p.Id, symbol = p.DisplayId, Description = p.Description, exchange = p.Parametr1, Enabled = p.Enabled }); } } else { this.SaxoInstruments.Add(new Settings.SaxoValues() { InstumentId = p.Id, InstrumentType = p.DisplayId, Name = p.Description, Enabled = p.Enabled }); } } else { this.CQGInstruments.Add(new Settings.CQGInstrument() { InstumentId = p.Id, Instrument = p.DisplayId, Enabled = p.Enabled }); } } else { int result = 0; if (int.TryParse(p.DisplayId, out result) && !this.LmaxInstruments.ContainsKey(result)) { this.LmaxInstruments.Add(result, new Settings.LmaxValues() { InstrumentId = p.Id, Name = p.Description, Enabled = p.Enabled }); } } } } } Settings.LocalSetting.rithmicSubscriptions = this.rithmicSubscriptions; }