public DbDataSet.额度分配Row UpdateLimit(AASServiceReference.DbDataSet.额度分配DataTable dtUpdate, out string errMsg) { errMsg = string.Empty; DbDataSet.额度分配Row result = null; if (!string.IsNullOrEmpty(this.ConnectGUID) && IsConnected) { lock (Sync) { try { string strRequest = string.Format("2|{0}|{1}", ConnectGUID, dtUpdate.ToJson()); string strReceive = SendRequest(socket, strRequest); if (strReceive.StartsWith("2|1|")) { var dt = strReceive.Substring(4).FromJson <DbDataSet.额度分配DataTable>(); result = dt.First(); } else { errMsg = strReceive.Substring(4); } } catch (Exception ex) { errMsg = string.Format("UpdateLimit 异常:{0}", ex.Message); } } } else { errMsg = string.Format("server {0}({1}) 未连接,无法执行修改命令,请在主界面手动重新连接!", Remark, Ip); } return(result); }
public DbDataSet.额度分配DataTable QueryLimit(out string errMsg) { errMsg = string.Empty; AASServiceReference.DbDataSet.额度分配DataTable dt = null; if (!string.IsNullOrEmpty(this.ConnectGUID) && IsConnected) { lock (Sync) { try { string strRequest = string.Format("1|{0}", ConnectGUID); string strReceive = SendRequest(socket, strRequest); if (strReceive.StartsWith("1|1|")) { dt = strReceive.Substring(4).FromJson <AASServiceReference.DbDataSet.额度分配DataTable>(); } else { errMsg = strReceive.Substring(4); } } catch (Exception ex) { errMsg = string.Format("QueryLimit 异常:{0}", ex.Message); } } } else { errMsg = string.Format("server {0}({1}) 未连接,无法执行删除命令,请在主界面手动重新连接!", Remark, Ip); } return(dt); }
public string AddLimit(AASServiceReference.DbDataSet.额度分配DataTable dt) { string errMsg = string.Empty; if (!string.IsNullOrEmpty(this.ConnectGUID) && IsConnected) { lock (Sync) { try { var row1 = dt.First(); string strRequest = string.Format("4|{0}|{1}", ConnectGUID, dt.ToJson()); socket.ReceiveTimeout = new TimeSpan(0, 2, 0); string strReceive = SendRequest(socket, strRequest); return(strReceive.Substring(4)); } catch (Exception ex) { errMsg = string.Format("Add Limit 异常:{0}", ex.Message); } } } else { errMsg = string.Format("server {0}({1}) 未连接,无法执行导入命令,请在主界面手动重新连接!", Remark, Ip); } return(errMsg); }
private void 除交易额度ToolStripMenuItem_Click(object sender, EventArgs e) { labelLoading.Text = "删除中……"; labelLoading.Visible = true; AASServiceReference.DbDataSet.额度分配DataTable dt = new AASServiceReference.DbDataSet.额度分配DataTable(); foreach (DataGridViewRow row in this.dataGridView交易额度.SelectedRows) { var o = (row.DataBoundItem as DataRowView).Row as AASServiceReference.DbDataSet.额度分配Row; if (o != null) { dt.Add额度分配Row(o.交易员, o.证券代码, o.组合号, o.市场, o.证券名称, o.拼音缩写, o.买模式, o.卖模式, o.交易额度, o.手续费率); } } Task.Run(() => { foreach (var row in dt) { try { string loadingInfo = string.Format("正在删除项:组合号{0},证券代码{1},交易员{2}", row.组合号, row.证券代码, row.交易员); this.BeginInvoke(new Action(() => { labelLoading.Text = loadingInfo; })); Program.AASServiceClient.DeleteTradeLimit(row.交易员, row.证券代码, row.组合号); } catch (Exception ex) { this.BeginInvoke(new Action(() => { labelLoading.Text = string.Format("删除额度分配项时发生异常,组合号{0},证券代码{1},交易员{2}\r\n异常信息:{3}", row.组合号, row.证券代码, row.交易员, ex.Message); })); } } this.BeginInvoke(new Action(() => { this.bindingSource交易额度.DataSource = Program.AASServiceClient.QueryTradeLimit(); labelLoading.Text = "加载中……"; labelLoading.Visible = false; })); }); }