Esempio n. 1
0
        private bool SubmitProcess()
        {
            if (string.IsNullOrEmpty(this.luInvestor.SelectedValue()))
            {
                DXMessage.ShowTips("请选择投资发起人!");
                this.luInvestor.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.luStock.SelectedValue()))
            {
                DXMessage.ShowTips("请选择股票信息!");
                this.luStock.Focus();
                return(false);
            }

            if (this.txtPrice.Text.Trim().Length == 0)
            {
                DXMessage.ShowTips("请输入单价!");
                this.txtPrice.Focus();
                return(false);
            }

            if (decimal.Parse(this.txtPrice.Text.Trim()) <= 0)
            {
                DXMessage.ShowTips("单价应该大于0!");
                this.txtPrice.Focus();
                return(false);
            }

            if (this.txtPriceBound.Text.Trim().Length == 0)
            {
                DXMessage.ShowTips("请输入单价上下限!");
                this.txtPriceBound.Focus();
                return(false);
            }

            int priceBound;

            if (!int.TryParse(txtPriceBound.Text.Trim(), out priceBound))
            {
                DXMessage.ShowTips("单价上下限应该输入数字!");
                this.txtPriceBound.Focus();
                return(false);
            }

            if (int.Parse(this.txtPriceBound.Text.Trim()) <= 0)
            {
                DXMessage.ShowTips("单价上下限应该大于0!");
                this.txtPriceBound.Focus();
                return(false);
            }

            if (this.txtVolume.Text.Trim().Length == 0)
            {
                DXMessage.ShowTips("请输入数量!");
                this.txtVolume.Focus();
                return(false);
            }

            if (decimal.Parse(this.txtVolume.Text.Trim()) <= 0)
            {
                DXMessage.ShowTips("数量应该大于0!");
                this.txtVolume.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.memoReason.Text.Trim()))
            {
                DXMessage.ShowTips("请输入申请理由!");
                this.memoReason.Focus();
                return(false);
            }

            var investorInfo = this.luInvestor.GetSelectedDataRow() as UserInfo;
            var applyDate    = CommonHelper.StringToDateTime(this.deApply.EditValue.ToString());
            var tradeType    = int.Parse(this.cbOperateType.SelectedValue());
            var price        = decimal.Parse(this.txtPrice.Text.Trim());
            var volume       = decimal.Parse(this.txtVolume.Text.Trim());
            var amount       = Math.Abs(decimal.Parse(this.txtAmount.Text.Trim()) * (int)EnumLibrary.NumericUnit.TenThousand);

            var stock = this.luStock.GetSelectedDataRow() as StockInfoModel;
            var now   = _commonService.GetCurrentServerTime();

            var form = new InvestmentDecisionForm
            {
                Amount            = this.chkBuy.Checked ? amount : -amount,
                ApplyDate         = applyDate,
                ApplyUser         = investorInfo.Code,
                CreateTime        = now,
                DealFlag          = this.chkBuy.Checked ? true : false,
                DepartmentId      = investorInfo.DepartmentId,
                Price             = price,
                PriceBound        = (decimal)priceBound / (int)EnumLibrary.NumericUnit.Hundred,
                Reason            = this.memoReason.Text.Trim(),
                RelateTradePlanNo = txtPlanNo.Text.Trim(),
                SerialNo          = string.Empty,
                Status            = (int)EnumLibrary.IDFormStatus.Submited,
                StockFullCode     = stock.FullCode,
                StockName         = stock.Name,
                TradeType         = tradeType,
                UpdateTime        = now,
                Volume            = volume,
            };

            _IDService.SubmitInvestmentDecisionApplication(form);

            return(true);
        }