Esempio n. 1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            var targetPrincipal = this.luTarget.SelectedValue();

            var bandPrincipal = this.luBand.SelectedValue();

            var logModel = new StockPoolLog()
            {
                StockId         = _stockId,
                BandPrincipal   = bandPrincipal,
                TargetPrincipal = targetPrincipal,
                OperatorCode    = LoginInfo.CurrentUser.UserCode,
                OperateTime     = _commonService.GetCurrentServerTime(),
            };

            //修改股票池的场合
            if (this._isEdit)
            {
                var stockPool = _stockService.GetStockPoolInfoByStockId(this._stockId);
                stockPool.BandPrincipal   = bandPrincipal;
                stockPool.TargetPrincipal = targetPrincipal;
                stockPool.StockId         = _stockId;
                stockPool.Remarks         = this.memoRemarks.Text.Trim();

                _stockService.UpdateStockPoolInfo(stockPool);

                logModel.Type = (int)EnumLibrary.OperateType.Edit;
            }
            //添加股票池的场合
            else
            {
                var stockPool = new StockPoolInfo
                {
                    BandPrincipal   = bandPrincipal,
                    TargetPrincipal = targetPrincipal,
                    StockId         = _stockId,
                    Remarks         = this.memoRemarks.Text.Trim(),
                };

                _stockService.AddStockPoolInfo(stockPool);

                logModel.Type = (int)EnumLibrary.OperateType.Add;
            }

            //添加股票池操作日志
            _stockService.AddStockPoolLog(logModel);

            RefreshEvent?.Invoke();

            this.Close();
        }
Esempio n. 2
0
        /// <summary>
        /// 加入、移出股票池
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPool_Click(object sender, EventArgs e)
        {
            var myView = this.gridView1;

            var selectedHandles = myView.GetSelectedRows();

            if (selectedHandles.Length != 1)
            {
                DXMessage.ShowTips("请选择一支要操作的股票!");
                return;
            }

            if (bool.Parse(myView.GetRowCellValue(selectedHandles[0], colIsInPool).ToString()))
            {
                if (DXMessage.ShowYesNoAndTips("确定将该股票移出股票池吗?") == DialogResult.Yes)
                {
                    var stockId = int.Parse(myView.GetRowCellValue(selectedHandles[0], colId).ToString());

                    _stockService.DeleteStockPoolInfoByStockId(stockId);

                    BindStockInfo();

                    var logModel = new StockPoolLog
                    {
                        StockId      = stockId,
                        Type         = (int)EnumLibrary.OperateType.Add,
                        OperatorCode = LoginInfo.CurrentUser.UserCode,
                        OperateTime  = _commonService.GetCurrentServerTime(),
                    };

                    _stockService.AddStockPoolLog(logModel);
                }
            }
            else
            {
                var stockId = int.Parse(myView.GetRowCellValue(selectedHandles[0], colId).ToString());

                DisplayPoolEditDialog(stockId);
            }
        }