public HoldingTransferedForm(GridConfig gridConfig, UFXBLLManager bLLManager)
            : this()
        {
            _gridConfig = gridConfig;
            _accountBLL = bLLManager.AccountBLL;

            this.LoadControl += new FormLoadHandler(Form_LoadControl);
            this.LoadData    += new FormLoadHandler(Form_LoadData);

            this.srcGridView.UpdateRelatedDataGridHandler += new UpdateRelatedDataGrid(GridView_Source_UpdateRelatedDataGridHandler);
            this.srcGridView.MouseDown  += new MouseEventHandler(GridView_MouseDown);
            this.destGridView.MouseDown += new MouseEventHandler(GridView_MouseDown);

            this.cbOpertionType.SelectedIndexChanged  += new EventHandler(ComboBox_OpertionType_SelectedIndexChanged);
            this.cbSrcFundCode.SelectedIndexChanged   += new EventHandler(ComboBox_FundCode_SelectedIndexChanged);
            this.cbDestFundCode.SelectedIndexChanged  += new EventHandler(ComboBox_FundCode_SelectedIndexChanged);
            this.cbSrcPortfolio.SelectedIndexChanged  += new EventHandler(ComboBox_Portfolio_SelectedIndexChanged);
            this.cbDestPortfolio.SelectedIndexChanged += new EventHandler(ComboBox_Portfolio_SelectedIndexChanged);
            this.cbSrcTradeInst.SelectedIndexChanged  += new EventHandler(ComboBox_TradeInst_SelectedIndexChanged);
            this.cbDestTradeInst.SelectedIndexChanged += new EventHandler(ComboBox_TradeInst_SelectedIndexChanged);

            //this.cbSrcTradeInst.DropDownClosed += new EventHandler(ComboBox_TradeInst_DropDownClosed);
            //this.cbDestTradeInst.DropDownClosed += new EventHandler(ComboBox_TradeInst_DropDownClosed);
            //this.cbSrcTradeInst.LostFocus += new EventHandler(ComboBox_TradeInst_LostFocus);
            //this.cbDestTradeInst.LostFocus += new EventHandler(ComboBox_TradeInst_LostFocus);

            //button click
            this.btnTransfer.Click += new EventHandler(Button_Transfer_Click);
            this.btnRefresh.Click  += new EventHandler(Button_Refresh_Click);
            this.btnCalc.Click     += new EventHandler(Button_Calc_Click);
        }
Example #2
0
        public ProductForm(GridConfig gridConfig, UFXBLLManager bLLManager)
            : this()
        {
            _gridConfig = gridConfig;
            _accountBLL = bLLManager.AccountBLL;

            this.LoadControl += new FormLoadHandler(Form_LoadControl);
            this.LoadData    += new FormLoadHandler(Form_LoadData);
        }
        public BaseForm ActiveForm(Form parentForm, Panel parentPanel, string formKey, GridConfig gridConfig, UFXBLLManager bLLManager)
        {
            Forms.BaseForm form     = null;
            Type           formType = null;
            bool           hasGrid  = false;
            bool           needBLL  = false;
            string         json     = string.Empty;

            if (_childFormMap.ContainsKey(formKey))
            {
                form = _childFormMap[formKey];
            }
            else
            {
                switch (formKey)
                {
                case "cmdtrading":
                {
                    formType = typeof(StrategyTradingForm);
                    hasGrid  = true;
                }
                break;

                case "open":
                {
                    formType = typeof(OpenPositionForm);
                    hasGrid  = true;
                }
                break;

                case "close":
                {
                    formType = typeof(ClosePositionForm);
                    hasGrid  = true;
                }
                break;

                case "commandmanager":
                {
                    formType = typeof(CommandManagementForm);
                    hasGrid  = true;
                }
                break;

                case "monitorunit":
                {
                    formType = typeof(MonitorUnitForm);
                    hasGrid  = true;
                }
                break;

                case "portfoliomaintain":
                {
                    formType = typeof(PortfolioForm);
                    hasGrid  = true;
                    needBLL  = true;
                }
                break;

                case "fundmanagement":
                {
                    formType = typeof(ProductForm);
                    hasGrid  = true;
                    needBLL  = true;
                }
                break;

                case "assetunitmanagement":
                {
                    formType = typeof(AssetUnitForm);
                    hasGrid  = true;
                    needBLL  = true;
                }
                break;

                case "spottemplate":
                {
                    formType = typeof(SpotTemplateForm);
                    hasGrid  = true;
                }
                break;

                //case "currenttemplate":
                //    {
                //        formType = typeof(StockTemplateForm);
                //        hasGrid = true;
                //        //StockTemplateDAO _dbdao = new StockTemplateDAO();
                //        //var items = _dbdao.GetTemplate(-1);
                //        //json = JsonUtil.SerializeObject(items);
                //    }
                //    break;
                case "historicaltemplate":
                {
                    formType = typeof(HistSpotTemplateForm);
                    hasGrid  = true;
                }
                break;

                case "instancemanagement":
                {
                    formType = typeof(InstanceManagementForm);
                    hasGrid  = true;
                }
                break;

                case "holdingtransfer":
                {
                    formType = typeof(HoldingTransferedForm);
                    hasGrid  = true;
                    needBLL  = true;
                }
                break;

                default:
                    break;
                }
            }

            if (formType != null && form == null)
            {
                if (needBLL && hasGrid)
                {
                    form = LoadForm(parentForm, formType, new object[] { gridConfig, bLLManager }, json);
                }
                else if (hasGrid)
                {
                    form = LoadForm(parentForm, formType, new object[] { gridConfig }, json);
                }
                else
                {
                    form = LoadForm(parentForm, formType, null, json);
                }

                _childFormMap[formKey] = form;
            }

            if (form != null)
            {
                ILoadData loadData = form as ILoadData;
                if (loadData != null)
                {
                    loadData.OnLoadData(form, null);
                }

                IFormActived formActived = form as IFormActived;
                if (formActived != null)
                {
                    //TODO: add the step to load data and refresh the child form
                    formActived.OnFormActived("");
                }

                form.MdiParent = parentForm;
                form.Parent    = parentPanel;
                form.Dock      = DockStyle.Fill;
                form.BringToFront();
                form.Show();
            }
            else
            {
                //default form
                throw new NotSupportedException("The type is not support!");
            }

            return(form);
        }