Esempio n. 1
0
        /// <summary>
        /// 打开业务对象(如果没有则创建)
        /// </summary>
        public void openBusinessObject(string bo001, object parm)
        {
            if (openedTabPage.ContainsKey(bo001))
            {
                xtraTabControl1.SelectedTabPage = openedTabPage[bo001];
                if (parm != null)
                {
                    foreach (Control control in openedTabPage[bo001].Controls)
                    {
                        if (control is BaseBusiness)
                        {
                            ((BaseBusiness)control).swapdata["parm"] = parm;
                            ((BaseBusiness)control).Business_Init();
                            return;
                        }
                    }
                }
            }
            else             //如果尚未打开,则new
            {
                XtraTabPage newPage    = new XtraTabPage();
                var         searchList = from c in BO01_list
                                         where (c.BO001 == bo001) orderby c.BO001
                                         select c;


                if (searchList.Count() <= 0)
                {
                    XtraMessageBox.Show("功能参数错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                BO01 target_bo = searchList.ElementAt <BO01>(0);
                newPage.Text            = target_bo.BO003;
                newPage.Tag             = bo001;
                newPage.ShowCloseButton = DevExpress.Utils.DefaultBoolean.True;

                BaseBusiness bo = (BaseBusiness)Activator.CreateInstance(Type.GetType("Lime.BusinessObject." + bo001));

                bo.Dock   = DockStyle.Fill;
                bo.Parent = newPage;
                bo.swapdata.Add("parm", parm);

                newPage.Controls.Add(bo);

                xtraTabControl1.TabPages.Add(newPage);
                xtraTabControl1.SelectedTabPage = newPage;
                bo.Business_Init();

                ////////登记已打开 Tabpage ////////
                openedTabPage.Add(bo001, newPage);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 打开业务对象(如果没有则创建)
        /// </summary>
        public void openBusinessObject(string bo001, object parm)
        {
            if (openedTabPage.ContainsKey(bo001))
            {
                xtraTabControl1.SelectedTabPage = openedTabPage[bo001];
                if (parm != null)
                {
                    foreach (Control control in openedTabPage[bo001].Controls)
                    {
                        if (control is BaseBusiness)
                        {
                            ((BaseBusiness)control).swapdata["parm"] = parm;
                            ((BaseBusiness)control).Business_Init();
                            return;
                        }
                    }
                }
            }
            else             //如果尚未打开,则new
            {
                XtraTabPage newPage = new XtraTabPage();
                newPage.Text            = businessTab[bo001].bo003;
                newPage.Tag             = bo001;
                newPage.ShowCloseButton = DevExpress.Utils.DefaultBoolean.True;


                BaseBusiness bo = (BaseBusiness)Activator.CreateInstance(Type.GetType("JEast.BusinessObject." + bo001));

                Envior.mform = this;

                bo.Dock   = DockStyle.Fill;
                bo.Parent = newPage;
                bo.swapdata.Add("parm", parm);

                newPage.Controls.Add(bo);

                xtraTabControl1.TabPages.Add(newPage);
                xtraTabControl1.SelectedTabPage = newPage;

                bo.Business_Init();

                ////////登记已打开 Tabpage ////////
                openedTabPage.Add(bo001, newPage);
            }
        }