Beispiel #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();
        }