Exemplo n.º 1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (this.luPrincipal.EditValue == null || this.luPrincipal.EditValue.ToString() == "nulltext")
            {
                DXMessage.ShowTips("请选择主要负责人!");
                return;
            }

            var principal = this.luPrincipal.SelectedValue();

            var logModel = new InvestmentDecisionStockPoolLog()
            {
                StockCode    = StockCode,
                Principal    = principal,
                OperatorCode = LoginInfo.CurrentUser.UserCode,
                OperateTime  = _commonService.GetCurrentServerTime(),
            };

            //修改股票池的场合
            if (this._isEdit)
            {
                var stockPool = _IDService.GetIDStockPoolByCode(StockCode);
                stockPool.Principal = principal;
                stockPool.Remarks   = this.memoRemarks.Text.Trim();

                _IDService.UpdateIDStockPool(stockPool);

                logModel.Type = (int)EnumLibrary.OperateType.Edit;
            }
            //添加股票池的场合
            else
            {
                var stockPool = new InvestmentDecisionStockPool
                {
                    StockCode = this.txtCode.Text.Trim(),
                    StockName = this.txtName.Text.Trim(),
                    Principal = principal,
                    Remarks   = this.memoRemarks.Text.Trim(),
                };

                _IDService.AddIDStockPool(stockPool);

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

            //添加股票池操作日志
            _IDService.AddIDStockPoolLog(logModel);

            RefreshEvent?.Invoke();

            this.Close();
        }