public OTCDataSet(DatabaseManager dm) : this() { this.dbManager = dm; this.sql_connection = dm.GetSQLConnection(); this.redis_connection = dm.GetRedisConnection(); this.redis_db = CreateRedisConnection(); GetData(); }
public OTCDataSet(DatabaseManager dm) : this() { this.dbManager = dm; this.sql_connection = dm.GetSQLConnection(); this.redis_connection = dm.GetRedisConnection(); this.redis_db = CreateRedisConnection(); GetData(); }
private void buttonOK_Click(object sender, EventArgs e) { decimal commision = 0; decimal margin = 0; decimal multiplier = 0; decimal volatility = 0; if (String.IsNullOrEmpty(this.textBoxFuturesContractCode.Text)) { MessageBox.Show("期货合约代码不能为空。", "错误"); } else if (String.IsNullOrEmpty(this.comboBoxUnderlyingCode.Text)) { MessageBox.Show("标的不能为空。", "错误"); } else if (!decimal.TryParse(this.textBoxCommission.Text, out commision)) { MessageBox.Show("手续费格式错误。", "错误"); } else if (!decimal.TryParse(this.textBoxMarginRate.Text, out margin)) { MessageBox.Show("保证金格式错误。", "错误"); } else if (!decimal.TryParse(this.textBoxMultiplier.Text, out multiplier)) { MessageBox.Show("合约乘数格式错误。", "错误"); } else if (!decimal.TryParse(this.textBoxVolatility.Text, out volatility)) { MessageBox.Show("波动率格式错误。", "错误"); } else { DatabaseManager dm = new DatabaseManager(); var conn = dm.GetRedisConnection(); var db = conn.GetDatabase(); if (db.KeyExists(this.textBoxFuturesContractCode.Text)) { double pre_settle = double.Parse(db.HashGet(this.textBoxFuturesContractCode.Text, "PreSettlementPrice").ToString()); string commission_mode = this.radioButtonAbsCommission.Checked ? "abs" : "pct"; table.Rows.Add(this.textBoxFuturesContractCode.Text, this.comboBoxUnderlyingCode.Text.Split('-')[1], commission_mode, commision, margin, pre_settle, multiplier, volatility, false); this.dataset.Commit("futures_contracts"); this.dataset.Update("futures_contracts"); this.dataset.Update("futures_contracts_view"); this.Close(); } else { MessageBox.Show("期货合约不存在。", "错误"); } } }
private void buttonOK_Click(object sender, EventArgs e) { decimal commision = 0; decimal margin = 0; decimal multiplier = 0; decimal volatility = 0; if (String.IsNullOrEmpty(this.textBoxFuturesContractCode.Text)) { MessageBox.Show("期货合约代码不能为空。", "错误"); } else if (String.IsNullOrEmpty(this.comboBoxUnderlyingCode.Text)) { MessageBox.Show("标的不能为空。", "错误"); } else if (!decimal.TryParse(this.textBoxCommission.Text, out commision)) { MessageBox.Show("手续费格式错误。", "错误"); } else if (!decimal.TryParse(this.textBoxMarginRate.Text, out margin)) { MessageBox.Show("保证金格式错误。", "错误"); } else if (!decimal.TryParse(this.textBoxMultiplier.Text, out multiplier)) { MessageBox.Show("合约乘数格式错误。", "错误"); } else if (!decimal.TryParse(this.textBoxVolatility.Text, out volatility)) { MessageBox.Show("波动率格式错误。", "错误"); } else { DatabaseManager dm = new DatabaseManager(); var conn = dm.GetRedisConnection(); var db = conn.GetDatabase(); if (db.KeyExists(this.textBoxFuturesContractCode.Text)) { double pre_settle = double.Parse(db.HashGet(this.textBoxFuturesContractCode.Text, "PreSettlementPrice").ToString()); string commission_mode = this.radioButtonAbsCommission.Checked ? "abs" : "pct"; table.Rows.Add(this.textBoxFuturesContractCode.Text, this.comboBoxUnderlyingCode.Text.Split('-')[1], commission_mode, commision, margin, pre_settle, multiplier, volatility, false); this.dataset.Commit("futures_contracts"); this.dataset.Update("futures_contracts"); this.dataset.Update("futures_contracts_view"); this.Close(); } else { MessageBox.Show("期货合约不存在。", "错误"); } } }