예제 #1
0
        public virtual void DeleteIDStockPool(IList <string> stockCodes, string operateCode)
        {
            if (stockCodes == null)
            {
                throw new NullReferenceException(nameof(stockCodes));
            }

            foreach (var stockCode in stockCodes)
            {
                var info = _IDStockPoolRepository.Table.Where(x => x.StockCode == stockCode).SingleOrDefault();

                if (info == null)
                {
                    continue;
                }

                _IDStockPoolRepository.Delete(info);

                var logModel = new InvestmentDecisionStockPoolLog
                {
                    StockCode    = stockCode,
                    Type         = (int)EnumLibrary.OperateType.Delete,
                    OperatorCode = operateCode,
                    OperateTime  = _commonService.GetCurrentServerTime(),
                };

                AddIDStockPoolLog(logModel);
            }
        }
예제 #2
0
        public virtual void AddIDStockPoolLog(InvestmentDecisionStockPoolLog entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            _IDStockPoolLogRepository.Insert(entity);
        }
예제 #3
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();
        }