예제 #1
0
        private void FormInit()
        {
            var now = _commonService.GetCurrentServerTime();

            //申请日期
            this.deApply.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False;

            //股票
            var stocks = _stockService.GetAllStocks(showDeleted: true)
                         .Select(x => new StockInfoModel
            {
                Id            = x.Id,
                Code          = x.Code,
                FullCode      = x.FullCode,
                Name          = x.Name,
                DisplayMember = x.FullCode + " - " + x.Name,
            }
                                 ).OrderBy(x => x.FullCode).ToList();

            this.luStock.Initialize(stocks, "FullCode", "DisplayMember", enableSearch: true);

            //操作类型
            var operateTypes = new List <ComboBoxItemModel>
            {
                new ComboBoxItemModel
                {
                    Text  = "目标",
                    Value = "1",
                },
                new ComboBoxItemModel
                {
                    Text  = "波段",
                    Value = "2",
                },
                new ComboBoxItemModel
                {
                    Text  = "隔日短差",
                    Value = "3",
                },
            };

            this.txtOperateUser.Text = LoginInfo.CurrentUser.UserName;
            this.cbOperateType.Initialize(operateTypes);

            //操作日期
            this.deOperate.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False;

            switch (ApplyType)
            {
            case EnumLibrary.IDOperationApplyType.Buy:
                this.chkBuy.Checked  = true;
                this.chkSell.Enabled = false;
                break;

            case EnumLibrary.IDOperationApplyType.Sell:
                this.chkSell.Checked = true;
                this.chkBuy.Enabled  = false;
                break;

            case EnumLibrary.IDOperationApplyType.Both:
                break;

            default:
                break;
            }

            this.txtPrice.SetNumericMask(2);
            this.txtPrice.Text = string.Empty;
            this.spinPriceBound.SetProperties();
            this.txtVolume.SetNumberMask();
            this.txtVolume.Text = string.Empty;
            this.txtProfitPrice.SetNumericMask(2);
            this.txtProfitPrice.Text = string.Empty;
            this.spinProfitBound.SetProperties();
            this.txtLossPrice.SetNumericMask(2);
            this.txtLossPrice.Text = string.Empty;
            this.spinLossBound.SetProperties();

            //理由类别
            var categories = _IDService.GetIDReasonCategories();

            this.treeListLookUpEdit1.Properties.DisplayMember = "FullName";
            this.treeListLookUpEdit1.Properties.ValueMember   = "Id";
            this.treeListLookUpEdit1TreeList.Initialize(categories, "Id", "ParentId", editable: false, autoWidth: true, showColumns: false, showVertLines: false, showHorzLines: false, multiSelect: true);
            categories = null;

            if (string.IsNullOrEmpty(ApplyNo))
            {
                //申请单号
                this.txtApplyNo.Text = _IDService.GenerateIDApplicationApplyNo();

                //申请人员
                this.txtApplyUser.Text = LoginInfo.CurrentUser.UserName;

                //申请日期
                this.deApply.EditValue = now.Date;

                //操作类型
                this.cbOperateType.DefaultSelected("1");
            }
            else
            {
                this.lcgImport.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;

                SetApplicationInfo(ApplyNo);
            }

            if (string.IsNullOrEmpty(OperateNo))
            {
                //操作编号
                this.txtOperateNo.Text = _IDService.GenerateIDOperationNo();

                //操作人员
                this.txtOperateUser.Text = LoginInfo.CurrentUser.UserName;

                //操作日期
                this.deOperate.EditValue = now.Date;

                SetLimitBound();
            }
            else
            {
                this.lcgApply.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;

                SetOperationInfo(OperateNo);
            }
        }