private bool Form_LoadControl(object sender, object data) { //交易指令表 TSDataGridViewHelper.AddColumns(this.gridView, _gridConfig.GetGid(GridId)); Dictionary <string, string> colDataMap = GridViewBindingHelper.GetPropertyBinding(typeof(CommandManagementItem)); TSDataGridViewHelper.SetDataBinding(this.gridView, colDataMap); //交易证券表 TSDataGridViewHelper.AddColumns(this.secuGridView, _gridConfig.GetGid(GridSecurityId)); colDataMap = GridViewBindingHelper.GetPropertyBinding(typeof(CommandManagementSecurityItem)); TSDataGridViewHelper.SetDataBinding(this.secuGridView, colDataMap); //委托证券表 TSDataGridViewHelper.AddColumns(this.entrustGridView, _gridConfig.GetGid(GridEntrustId)); colDataMap = GridViewBindingHelper.GetPropertyBinding(typeof(CommandManagementEntrustItem)); TSDataGridViewHelper.SetDataBinding(this.entrustGridView, colDataMap); //成交证券表 TSDataGridViewHelper.AddColumns(this.dealGridView, _gridConfig.GetGid(GridDealId)); colDataMap = GridViewBindingHelper.GetPropertyBinding(typeof(CommandManagementDealItem)); TSDataGridViewHelper.SetDataBinding(this.dealGridView, colDataMap); this.gridView.DataSource = _dataSource; this.secuGridView.DataSource = _secuDataSource; this.entrustGridView.DataSource = _entrustDataSource; this.dealGridView.DataSource = _dealDataSource; return(true); }
private void Form_Load(object sender, EventArgs e) { GridConfig gridConfig = ConfigManager.Instance.GetGridConfig(); TSGrid hsGrid = gridConfig.GetGid("templatestock"); TSDataGridViewHelper.AddColumns(this.tsDataGridView1, hsGrid); var dataTable = GenerateData(hsGrid); //TSDataGridViewHelper.SetData(this.tsDataGridView1, hsGrid, dataTable); }
private bool Form_LoadControl(object sender, object data) { TSDataGridViewHelper.AddColumns(this.dataGridView, _gridConfig.GetGid(GridId)); Dictionary <string, string> colDataMap = GridViewBindingHelper.GetPropertyBinding(typeof(MonitorUnit)); TSDataGridViewHelper.SetDataBinding(this.dataGridView, colDataMap); LoadBottomButton(); return(true); }
private bool Form_LoadControl(object sender, object data) { //Load Command Trading TSDataGridViewHelper.AddColumns(this.gridView, _gridConfig.GetGid(GridId)); Dictionary <string, string> gridColDataMap = GridViewBindingHelper.GetPropertyBinding(typeof(EntrustSecurityItem)); TSDataGridViewHelper.SetDataBinding(this.gridView, gridColDataMap); this.gridView.DataSource = _dataSource; return(true); }
private bool Form_LoadControl(object sender, object data) { TSDataGridViewHelper.AddColumns(this.gridView, _gridConfig.GetGid(GridId)); Dictionary <string, string> colDataMap = GridViewBindingHelper.GetPropertyBinding(typeof(InstanceItem)); TSDataGridViewHelper.SetDataBinding(this.gridView, colDataMap); this.gridView.DataSource = _dataSource; return(true); }
private void ToolStripButton_DeleteStock_Click(object sender, EventArgs e) { StockTemplate template = GetSelectTemplate(); if (template == null) { return; } List <int> selectIndex = TSDataGridViewHelper.GetSelectRowIndex(this.secuGridView); if (selectIndex.Count == 0) { MessageDialog.Warn(this, msgDeleteSecuritySelect); return; } string format = ConfigManager.Instance.GetLabelConfig().GetLabelText(msgDeleteSecurity); string msg = string.Format(format, template.TemplateId, template.TemplateName, selectIndex.Count); if (MessageDialog.Warn(this, msg, MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No) { return; } List <TemplateStock> deleteItems = new List <TemplateStock>(); for (int i = 0, count = selectIndex.Count; i < count; i++) { int rowIndex = selectIndex[i]; if (rowIndex >= 0 && rowIndex < _spotDataSource.Count) { deleteItems.Add(_spotDataSource[rowIndex]); } } int success = _templateBLL.DeleteStock(deleteItems); if (success > 0) { foreach (var deleteItem in deleteItems) { _spotDataSource.Remove(deleteItem); } MessageDialog.Info(this, msgSecurityDeleteSuccess); } else { MessageDialog.Info(this, msgSecurityDeleteFail); } SwitchTemplateStockSave(false); }
private bool Form_LoadControl(object sender, object data) { //Load Command Trading TSDataGridViewHelper.AddColumns(this.secuGridView, _gridConfig.GetGid(GridCancelRedoId)); Dictionary <string, string> gridColDataMap = GridViewBindingHelper.GetPropertyBinding(typeof(CancelRedoItem)); TSDataGridViewHelper.SetDataBinding(this.secuGridView, gridColDataMap); this.secuGridView.DataSource = _secuDataSource; //Load combobox LoadEntrustControl(); return(true); }
private void Form_Load(object sender, EventArgs e) { GridConfig gridConfig = ConfigManager.Instance.GetGridConfig(); TSGrid hsGrid = gridConfig.GetGid("templatestock"); TSDataGridViewHelper.AddColumns(this.tsDataGridView1, hsGrid); Dictionary <string, string> colFieldMap = GridViewBindingHelper.GetPropertyBinding(typeof(TemplateStock)); TSDataGridViewHelper.SetDataBinding(this.tsDataGridView1, colFieldMap); var stocks = GenerateData(hsGrid); _tempStocks = new SortableBindingList <TemplateStock>(stocks); this.tsDataGridView1.DataSource = _tempStocks; }
private void Form_Load(object sender, EventArgs e) { TSGrid hsGrid = GetGridConfig(); TSDataGridViewHelper.AddColumns(this.tsDataGridView1, hsGrid); Dictionary <string, string> columnMap = GridViewBindingHelper.GetPropertyBinding(typeof(NumericItem)); TSDataGridViewHelper.SetDataBinding(this.tsDataGridView1, columnMap); this.tsDataGridView1.DataSource = _dataSource; //Load Data var listData = GetData(); foreach (var item in listData) { _dataSource.Add(item); } }
private void Form_Load(object sender, EventArgs e) { TSGrid hsGrid = CBRowItemHelper.GetGridConfig(); TSDataGridViewHelper.AddColumns(this.tsDataGridView1, hsGrid); var listData = CBRowItemHelper.GetData(); for (int i = 0; i < listData.Count; i++) { int rowIndex = this.tsDataGridView1.Rows.Add(); var rowData = listData[i]; foreach (var column in hsGrid.Columns) { var row = this.tsDataGridView1.Rows[rowIndex]; var cell = row.Cells[column.Name]; switch (column.Name) { case "name": { cell.Value = rowData.Name; } break; case "id": { var cbCell = (DataGridViewComboBoxCell)cell; cbCell.DisplayMember = "Text"; cbCell.ValueMember = "Id"; foreach (var item in rowData.IdSource.Items) { cbCell.Items.Add(item); } cbCell.Value = cbCell.Items[0]; } break; default: break; } } } }
private void ToolStripButton_ModifyStock_Click(object sender, EventArgs e) { List <int> selectIndex = TSDataGridViewHelper.GetSelectRowIndex(secuGridView); if (selectIndex.Count == 0) { MessageDialog.Warn(this, msgSecurityModifySelect); return; } if (selectIndex.Count > 1) { MessageDialog.Warn(this, msgSecurityModifyOnlyOnce); return; } int rowIndex = selectIndex[0]; if (rowIndex < 0 || rowIndex > _spotDataSource.Count) { MessageDialog.Warn(this, msgInvalidSelect); return; } TemplateStock stock = _spotDataSource[rowIndex]; PortfolioSecurityDialog psDialog = new PortfolioSecurityDialog(); psDialog.OnLoadControl(psDialog, DialogType.Modify); psDialog.OnLoadData(psDialog, stock); psDialog.SaveData += new FormLoadHandler(Dialog_SpotSecu_SaveData); psDialog.ShowDialog(); if (psDialog.DialogResult == System.Windows.Forms.DialogResult.OK) { psDialog.Close(); psDialog.Dispose(); } else { psDialog.Close(); psDialog.Dispose(); } }
private bool Form_LoadControl(object sender, object data) { //set the tempGridView TSDataGridViewHelper.AddColumns(this.tempGridView, _gridConfig.GetGid(GridTemplate)); Dictionary <string, string> tempColDataMap = GridViewBindingHelper.GetPropertyBinding(typeof(StockTemplate)); TSDataGridViewHelper.SetDataBinding(this.tempGridView, tempColDataMap); //set the secuGridView TSDataGridViewHelper.AddColumns(this.secuGridView, _gridConfig.GetGid(GridStock)); Dictionary <string, string> securityColDataMap = GridViewBindingHelper.GetPropertyBinding(typeof(TemplateStock)); TSDataGridViewHelper.SetDataBinding(this.secuGridView, securityColDataMap); this.tempGridView.DataSource = _tempDataSource; this.secuGridView.DataSource = _spotDataSource; return(true); }
private void button1_Click(object sender, EventArgs e) { TemplateStock item = new TemplateStock { TemplateNo = 1, SecuCode = "600207", SecuName = "安彩高科", Amount = 12100, Exchange = "上海交易所", MarketCap = 4200125.02, MarketCapWeight = 30.31, SettingWeight = 30.0 }; _tempStocks.Add(item); List <int> selectIndex = TSDataGridViewHelper.GetSelectRowIndex(this.tsDataGridView1); Console.WriteLine(selectIndex); }
private bool Form_LoadControl(object sender, object data) { TSDataGridViewHelper.AddColumns(this.srcGridView, _gridConfig.GetGid(GridSourceId)); Dictionary <string, string> colDataMap = GridViewBindingHelper.GetPropertyBinding(typeof(SourceHoldingItem)); TSDataGridViewHelper.SetDataBinding(this.srcGridView, colDataMap); this.srcGridView.DataSource = _srcDataSource; TSDataGridViewHelper.AddColumns(this.destGridView, _gridConfig.GetGid(GridDestId)); colDataMap = GridViewBindingHelper.GetPropertyBinding(typeof(DestinationHoldingItem)); TSDataGridViewHelper.SetDataBinding(this.destGridView, colDataMap); this.destGridView.DataSource = _destDataSource; LoadTradeDirectionOption(); //Load child control LoadProductControl(); return(true); }
private bool Form_LoadControl(object sender, object data) { //set the monitorGridView TSDataGridViewHelper.AddColumns(this.monitorGridView, _gridConfig.GetGid(MonitorGridId)); Dictionary <string, string> monitorColDataMap = GridViewBindingHelper.GetPropertyBinding(typeof(OpenPositionItem)); TSDataGridViewHelper.SetDataBinding(this.monitorGridView, monitorColDataMap); //set the securityGridView TSDataGridViewHelper.AddColumns(this.securityGridView, _gridConfig.GetGid(SecurityGridId)); Dictionary <string, string> securityColDataMap = GridViewBindingHelper.GetPropertyBinding(typeof(OpenPositionSecurityItem)); TSDataGridViewHelper.SetDataBinding(this.securityGridView, securityColDataMap); //Load bottom button LoadBottomButton(); this.monitorGridView.DataSource = _monitorDataSource; this.securityGridView.DataSource = _securityDataSource; return(true); }
private void Form_Load(object sender, EventArgs e) { TSGrid hsGrid = GetGridConfig(); TSDataGridViewHelper.AddColumns(this.tsDataGridView1, hsGrid); Dictionary <string, string> columnMap = GridViewBindingHelper.GetPropertyBinding(typeof(TSDGVCbItem)); TSDataGridViewHelper.SetDataBinding(this.tsDataGridView1, columnMap); //List<ComboOptionItem> cbItems = new List<ComboOptionItem>() { "Cb1", "Cb2", "Cb3", "Cb4" }; ComboOption cbOption = GetComboBoxData(); TSDataGridViewHelper.SetDataBinding(this.tsDataGridView1, "combobox", cbOption); this.tsDataGridView1.DataSource = _dataSource; //Load Data var listData = GetData(); foreach (var item in listData) { _dataSource.Add(item); } }
private void LoadTradeDirectionOption() { var transferPriceType = ConfigManager.Instance.GetComboConfig().GetComboOption("transferpricetype"); TSDataGridViewHelper.SetDataBinding(this.srcGridView, "pricetype", transferPriceType); }
private void LoadEntrustDirectionOption() { var entrustDirectionOption = ConfigManager.Instance.GetComboConfig().GetComboOption("entrustdirection"); TSDataGridViewHelper.SetDataBinding(this.gridView, "entrustdirection", entrustDirectionOption); }
private void ButtonContainer_ButtonClick(object sender, EventArgs e) { if (!(sender is Button)) { return; } Button button = sender as Button; switch (button.Name) { case "SelectAll": { dataGridView.SelectAll(true); } break; case "UnSelect": { dataGridView.SelectAll(false); } break; case "Add": { _monitorType = MonitorType.New; MonitorUnitDialog dialog = new MonitorUnitDialog(); dialog.Owner = this; dialog.StartPosition = FormStartPosition.CenterParent; //dialog.OnLoadFormActived(json); //dialog.Visible = true; dialog.OnLoadControl(dialog, null); dialog.OnLoadData(dialog, null); dialog.SaveData += new FormSaveHandler(Dialog_SaveData); dialog.ShowDialog(); if (dialog.DialogResult == System.Windows.Forms.DialogResult.OK) { dialog.Dispose(); } else { dialog.Dispose(); } } break; case "Delete": { List <int> selectIndex = TSDataGridViewHelper.GetSelectRowIndex(dataGridView); if (selectIndex == null && selectIndex.Count == 0) { MessageDialog.Warn(this, msgDeleteSelect); return; } string format = ConfigManager.Instance.GetLabelConfig().GetLabelText(msgDeleteConfirm); string msg = string.Format(format, selectIndex.Count); if (MessageDialog.Warn(this, msg, MessageBoxButtons.YesNo) != System.Windows.Forms.DialogResult.Yes) { return; } for (int i = selectIndex.Count - 1; i >= 0; i--) { int rowIndex = selectIndex[i]; if (rowIndex >= 0 && rowIndex < _dataSource.Count) { MonitorUnit monitorUnit = _dataSource[rowIndex]; int ret = _monitorUnitBLL.Delete(monitorUnit.MonitorUnitId); if (ret > 0) { _dataSource.RemoveAt(rowIndex); } } } } break; case "Modify": { _monitorType = MonitorType.Modify; if (dataGridView.CurrentRow == null) { return; } int index = dataGridView.CurrentRow.Index; if (index < 0 || index > _dataSource.Count) { return; } MonitorUnit monitorUnit = _dataSource[index]; MonitorUnitDialog dialog = new MonitorUnitDialog(); dialog.Owner = this; dialog.StartPosition = FormStartPosition.CenterParent; //dialog.OnLoadFormActived(json); //dialog.Visible = true; dialog.OnLoadControl(dialog, null); dialog.OnLoadData(dialog, monitorUnit); dialog.SaveData += new FormSaveHandler(Dialog_SaveData); dialog.ShowDialog(); if (dialog.DialogResult == System.Windows.Forms.DialogResult.OK) { dialog.Close(); dialog.Dispose(); } else { dialog.Close(); dialog.Dispose(); } } break; case "Refresh": { _dataSource.Clear(); var monitorUnits = _monitorUnitBLL.GetAll(); if (monitorUnits != null) { foreach (var item in monitorUnits) { _dataSource.Add(item); } } } break; case "Confirm": { List <int> selectIndex = TSDataGridViewHelper.GetSelectRowIndex(dataGridView); if (selectIndex == null && selectIndex.Count == 0) { MessageDialog.Warn(this, msgSelectSetting); return; } for (int rowIndex = 0; rowIndex < _dataSource.Count; rowIndex++) { MonitorUnit monitorUnit = _dataSource[rowIndex]; if (selectIndex.Contains(rowIndex)) { int ret = _monitorUnitBLL.Active(monitorUnit.MonitorUnitId, MonitorUnitStatus.Active); } else { int ret = _monitorUnitBLL.Active(monitorUnit.MonitorUnitId, MonitorUnitStatus.Inactive); } } } break; case "Cancel": break; } }