private void GridView_Source_UpdateRelatedDataGridHandler(UpdateDirection direction, int rowIndex, int columnIndex)
        {
            if (rowIndex < 0 || rowIndex >= _srcDataSource.Count)
            {
                return;
            }

            SourceHoldingItem selectedItem = _srcDataSource[rowIndex];

            switch (direction)
            {
            case UpdateDirection.Select:
            {
                GridView_Source_Select(selectedItem);
            }
            break;

            case UpdateDirection.UnSelect:
            {
                GridView_Source_UnSelect(selectedItem);
            }
            break;

            default:
                break;
            }

            this.srcGridView.Invalidate();
        }
Пример #2
0
        private void GridView_Command_UpdateRelatedDataGridHandler(UpdateDirection direction, int rowIndex, int columnIndex)
        {
            if (rowIndex < 0 || rowIndex >= _dataSource.Count)
            {
                return;
            }

            CommandManagementItem cmdMngItem = _dataSource[rowIndex];

            switch (direction)
            {
            case UpdateDirection.Select:
            {
                LoadCommandSecurities(cmdMngItem);

                var firstCmdItem = _dataSource.First(p => p.Selection);
                if (firstCmdItem != null)
                {
                    LoadCommandSummary(firstCmdItem);
                }
            }
            break;

            case UpdateDirection.UnSelect:
            {
                var secuItems = _secuDataSource.Where(p => p.CommandId == cmdMngItem.CommandId).ToList();
                foreach (var secuItem in secuItems)
                {
                    _secuDataSource.Remove(secuItem);
                }

                var entrustItems = _entrustDataSource.Where(p => p.CommandId == cmdMngItem.CommandId).ToList();
                foreach (var entrustItem in entrustItems)
                {
                    _entrustDataSource.Remove(entrustItem);
                }

                var dealItems = _dealDataSource.Where(p => p.CommandId == cmdMngItem.CommandId).ToList();
                foreach (var dealItem in dealItems)
                {
                    _dealDataSource.Remove(dealItem);
                }

                var selectedItems = _dataSource.Where(p => p.Selection).ToList();
                if (selectedItems != null && selectedItems.Count > 0)
                {
                    LoadCommandSummary(selectedItems[0]);
                }
                else
                {
                    LoadCommandSummary(_dataSource[0]);
                }
            }
            break;

            default:
                break;
            }
        }
 public void UpdateColliderPosition(UpdateDirection direction)
 {
     if (direction == UpdateDirection.FORWARD)
     {
         _collider.localPosition += _step;
     }
     else
     {
         _collider.localPosition -= _step;
     }
 }
Пример #4
0
        public void DataGridViewCmdTrading_Select(UpdateDirection direction, Model.Data.DataRow dataRow)
        {
            string colKey = "instance_no";

            if (dataRow == null || dataRow.Columns == null || dataRow.Columns.ContainsKey(colKey))
            {
                return;
            }

            if (direction == UpdateDirection.Add)
            {
                Dictionary <string, string> colDataMap = new Dictionary <string, string>();
                Model.Data.DataSet          eDataSet   = new Model.Data.DataSet();
                eDataSet.Rows = new List <Model.Data.DataRow>();
                Model.Data.DataRow eRow = new Model.Data.DataRow();
                eRow.Columns = new Dictionary <string, Model.Data.DataValue>();

                foreach (var column in this.dataGridViewBuySell.GridColumns)
                {
                    if (column.ColumnType == Model.UI.HSGridColumnType.None)
                    {
                        continue;
                    }

                    Model.Data.DataValue dataValue = new Model.Data.DataValue();
                    dataValue.Type = column.ValueType;
                    if (column.Name == "bs_commandno")
                    {
                        dataValue.Value = dataRow.Columns["tc_commandno"].Value;
                    }
                    else if (column.ColumnType == Model.UI.HSGridColumnType.Image)
                    {
                        dataValue.Value = column.DefaultValue;
                    }
                    else
                    {
                        dataValue.Value = 0;
                    }

                    colDataMap.Add(column.Name, column.Name);
                    eRow.Columns.Add(column.Name, dataValue);
                }

                eDataSet.Rows.Add(eRow);
                this.dataGridViewBuySell.FillData(eDataSet, colDataMap);
            }
            else if (direction == UpdateDirection.Remove)
            {
                var targetValue = dataRow.Columns["tc_commandno"];
                this.dataGridViewBuySell.DeleteData("bs_commandno", targetValue);
            }
        }
        private void MonitorGridView_UpdateRelatedDataGrid(UpdateDirection direction, int rowIndex, int columnIndex)
        {
            if (rowIndex < 0 || rowIndex >= _monitorDataSource.Count)
            {
                return;
            }

            OpenPositionItem monitorItem = _monitorDataSource[rowIndex];

            switch (direction)
            {
            case UpdateDirection.Select:
            {
                LoadSecurityData(monitorItem);
            }
            break;

            case UpdateDirection.UnSelect:
            {
                RemoveSecurityData(monitorItem);
            }
            break;

            case UpdateDirection.Increase:
            {
                CalcEntrustAmount(monitorItem);

                //monitorGridView.Invalidate();
                securityGridView.Invalidate();
            }
            break;

            case UpdateDirection.Decrease:
            {
                CalcEntrustAmount(monitorItem);
                //monitorGridView.Invalidate();
                securityGridView.Invalidate();
            }
            break;
            }
        }