Exemplo n.º 1
0
        public void OnEdit()
        {
            SelTableForm frm = new SelTableForm();

            if (frm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            SelColumnForm frm2 = new SelColumnForm();

            frm2.m_Table = frm.m_SelTable;
            if (frm2.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string sCtrlName = ChildenForm.GetDistinctName(frm.m_SelTable.Name, (CFormControlMgr)FormControl.m_ObjectMgr);


            FormControl.TableInFormControlMgr.RemoveAll();
            string sText             = string.Format("[{0}]", frm2.m_SelColumn.Code);
            CTableInFormControl tiwc = new CTableInFormControl();

            tiwc.Ctx               = Program.Ctx;
            tiwc.FW_Table_id       = frm.m_SelTable.Id;
            tiwc.UI_FormControl_id = FormControl.Id;
            tiwc.Text              = sText;
            FormControl.TableInFormControlMgr.AddNew(tiwc);

            CaptionText = sCtrlName;
        }
Exemplo n.º 2
0
        private void btSelTable_Click(object sender, EventArgs e)
        {
            SelTableForm frm = new SelTableForm();

            if (frm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            txtTable.Text             = frm.m_SelTable.Name;
            m_WorkflowDef.FW_Table_id = frm.m_SelTable.Id;
        }
Exemplo n.º 3
0
        public void OnEdit()
        {
            SelTableForm frm = new SelTableForm();

            if (frm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            WindowControl.TableInWindowControlMgr.RemoveAll();

            CTableInWindowControl tiwc = new CTableInWindowControl();

            tiwc.Ctx                 = Program.Ctx;
            tiwc.FW_Table_id         = frm.m_SelTable.Id;
            tiwc.UI_WindowControl_id = WindowControl.Id;
            tiwc.Text                = frm.m_SelTable.Name;
            WindowControl.TableInWindowControlMgr.AddNew(tiwc);

            foreach (CColumn col in frm.m_SelTable.ColumnMgr.GetList())
            {
                //if (!col.IsVisible)
                //    continue;
                CColumnInTableInWindowControl ciwc = new CColumnInTableInWindowControl();
                ciwc.Ctx          = Program.Ctx;
                ciwc.FW_Column_id = col.Id;
                ciwc.UI_TableInWindowControl_id = tiwc.Id;
                tiwc.ColumnInTableInWindowControlMgr.AddNew(ciwc);
            }
            foreach (ToolStripItem tbutton in toolStrip.Items)
            {
                CTButtonInTableInWindowControl tbiwc = new CTButtonInTableInWindowControl();
                tbiwc.Ctx   = Program.Ctx;
                tbiwc.Title = tbutton.Text;
                tbiwc.UI_TableInWindowControl_id = tiwc.Id;
                tiwc.TButtonInTableInWindowControlMgr.AddNew(tbiwc);
            }

            TableInWindowControl = tiwc;
        }
Exemplo n.º 4
0
        private void btSelTable_Click(object sender, EventArgs e)
        {
            SelTableForm frm = new SelTableForm();

            if (frm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            m_Table       = frm.m_SelTable;
            txtTable.Text = m_Table.Name;

            List <CBaseObject> lstObj = m_Table.ColumnMgr.GetList();
            bool bHasName = false, bHasCode = false;

            foreach (CBaseObject obj in lstObj)
            {
                CColumn column = (CColumn)obj;
                if (column.Code.Equals("name", StringComparison.OrdinalIgnoreCase))
                {
                    bHasName = true;
                }
                if (column.Code.Equals("code", StringComparison.OrdinalIgnoreCase))
                {
                    bHasCode = true;
                }
            }
            if (bHasName)
            {
                txtText.Text = "[Name]";
            }
            else if (bHasCode)
            {
                txtText.Text = "[Code]";
            }

            LoadColumn();
        }
Exemplo n.º 5
0
        public void OnDragDrop(DockStyle dock, ListViewItem item)
        {
            Panel panel = panelFill;

            if (dock == DockStyle.Top)
            {
                panel = panelTop;
            }
            else if (dock == DockStyle.Bottom)
            {
                panel = panelBottom;
            }
            else if (dock == DockStyle.Left)
            {
                panel = panelLeft;
            }
            else if (dock == DockStyle.Right)
            {
                panel = panelRight;
            }

            if (item.Text.Equals("ToolBar", StringComparison.OrdinalIgnoreCase))
            {
                string sCtrlName = GetDistinctName("导航栏", Window.WindowControlMgr);

                CWindowControl WindowControl = new CWindowControl();
                WindowControl.CtrlType     = ControlType.NavBar;
                WindowControl.Ctx          = Program.Ctx;
                WindowControl.Name         = sCtrlName;
                WindowControl.Dock         = (int)dock;
                WindowControl.UI_Window_id = Window.Id;
                Window.WindowControlMgr.AddNew(WindowControl);

                NavigateBarEl nb = new NavigateBarEl();
                nb.WindowControl = WindowControl;
                nb.Tag           = WindowControl;
                panel.Controls.Add(nb);
                nb.Dock = DockStyle.Fill;
                nb.BringToFront();

                nb.flowLayoutPanel.MouseClick += new MouseEventHandler(childCtrl_MouseClick);

                SelectElement(nb);
            }
            else if (item.Text.Equals("DataGrid", StringComparison.OrdinalIgnoreCase))
            {
                SelTableForm frm = new SelTableForm();
                if (frm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                string sCtrlName = GetDistinctName(frm.m_SelTable.Name, Window.WindowControlMgr);

                CWindowControl WindowControl = new CWindowControl();
                WindowControl.CtrlType     = ControlType.TableGrid;
                WindowControl.Ctx          = Program.Ctx;
                WindowControl.Name         = sCtrlName;
                WindowControl.Dock         = (int)dock;
                WindowControl.UI_Window_id = Window.Id;
                Window.WindowControlMgr.AddNew(WindowControl);

                CTableInWindowControl tiwc = new CTableInWindowControl();
                tiwc.Ctx                 = Program.Ctx;
                tiwc.FW_Table_id         = frm.m_SelTable.Id;
                tiwc.UI_WindowControl_id = WindowControl.Id;
                tiwc.Text                = frm.m_SelTable.Name;
                WindowControl.TableInWindowControlMgr.AddNew(tiwc);

                TableGridEl te = new TableGridEl();
                te.WindowControl = WindowControl;
                te.CaptionText   = sCtrlName;
                te.ShowTitleBar  = true;
                te.ShowToolBar   = true;
                te.Tag           = WindowControl;
                panel.Controls.Add(te);
                te.Dock = DockStyle.Fill;
                te.BringToFront();


                //联动表
                ListViewItem itemLT = new ListViewItem();
                itemLT.Text = te.CaptionText;
                itemLT.Tag  = WindowControl;
                m_AttributeToolWindow.listLinkageWindowControl.Items.Add(itemLT);
                //

                //List<CBaseObject> lstColumn = table.ColumnMgr.GetList();
                //foreach (CBaseObject obj in lstColumn)
                //{
                //    CColumn col = (CColumn)obj;
                //    CColumnInWindowControl ciw = new CColumnInWindowControl();
                //    ciw.FW_Column_id = col.Id;
                //    ciw.UI_TableInWindow_id = TableInWindow.Id;
                //    if (!TableInWindow.ColumnInWindowMgr.AddNew(ciw))
                //    {
                //        MessageBox.Show("设置显示字段失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                //        //return false;
                //    }
                //    te.m_lstShowColumn.Add(ciw.FW_Column_id);
                //}
                //foreach (ToolStripItem tbutton in te.tableCtrlEl.toolStrip.Items)
                //{
                //    CToolbarButtonInWindowControl tbiw = new CToolbarButtonInWindowControl();
                //    tbiw.Title = tbutton.Text;
                //    tbiw.UI_TableInWindow_id = TableInWindow.Id;
                //    if (!TableInWindow.ToolbarButtonInWindowMgr.AddNew(tbiw))
                //    {
                //        MessageBox.Show("设置工具栏按钮失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                //        //return false;
                //    }
                //    te.m_lstShowToolBarButton.Add(tbiw.Title);
                //}

                te.tbTitle.MouseClick += new MouseEventHandler(childCtrl_MouseClick);

                SelectElement(te);
            }
            else if (item.Text.Equals("TreeCtrl", StringComparison.OrdinalIgnoreCase))
            {
                TableTreeSet frm = new TableTreeSet();
                if (frm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                string sCtrlName = GetDistinctName(frm.m_WindowControl.Name, Window.WindowControlMgr);

                CWindowControl WindowControl = frm.m_WindowControl;
                WindowControl.Name         = sCtrlName;
                WindowControl.CtrlType     = ControlType.TableTree;
                WindowControl.Ctx          = Program.Ctx;
                WindowControl.Dock         = (int)dock;
                WindowControl.UI_Window_id = Window.Id;
                Window.WindowControlMgr.AddNew(WindowControl);


                TableTreeEl tt = new TableTreeEl();
                tt.CaptionText  = sCtrlName;
                tt.ShowTitleBar = true;
                tt.Tag          = WindowControl;
                panel.Controls.Add(tt);
                tt.Dock = DockStyle.Fill;
                tt.BringToFront();

                tt.tbTitle.MouseClick += new MouseEventHandler(childCtrl_MouseClick);

                SelectElement(tt);
            }
            else if (item.Text.Equals("TabCtrl", StringComparison.OrdinalIgnoreCase))
            {
                SelMultTableForm frm = new SelMultTableForm();
                if (frm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                string sCtrlName = GetDistinctName("标签", Window.WindowControlMgr);

                CWindowControl WindowControl = new CWindowControl();
                WindowControl.CtrlType     = ControlType.TableTab;
                WindowControl.Ctx          = Program.Ctx;
                WindowControl.Name         = sCtrlName;
                WindowControl.Dock         = (int)dock;
                WindowControl.UI_Window_id = Window.Id;
                Window.WindowControlMgr.AddNew(WindowControl);

                foreach (CTable table in frm.m_lstSelTable)
                {
                    CTableInWindowControl tiwc = new CTableInWindowControl();
                    tiwc.Ctx                 = Program.Ctx;
                    tiwc.FW_Table_id         = table.Id;
                    tiwc.UI_WindowControl_id = WindowControl.Id;
                    tiwc.Text                = table.Name;
                    WindowControl.TableInWindowControlMgr.AddNew(tiwc);
                }

                TableTabEl tab = new TableTabEl();
                tab.WindowControl = WindowControl;
                tab.CaptionText   = sCtrlName;
                tab.ShowTitleBar  = false;
                tab.Tag           = WindowControl;
                panel.Controls.Add(tab);
                tab.Dock = DockStyle.Fill;
                tab.BringToFront();

                tab.tabControl.MouseClick += new MouseEventHandler(childCtrl_MouseClick);
                SelectElement(tab);
            }
            else if (item.Text.Equals("ComboBox", StringComparison.OrdinalIgnoreCase))
            {
                SelTableForm frm = new SelTableForm();
                if (frm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                SelColumnForm frm2 = new SelColumnForm();
                frm2.m_Table = frm.m_SelTable;
                if (frm2.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                string sCtrlName = GetDistinctName(frm.m_SelTable.Name, Window.WindowControlMgr);

                CWindowControl WindowControl = new CWindowControl();
                WindowControl.CtrlType     = ControlType.ComboBox;
                WindowControl.Ctx          = Program.Ctx;
                WindowControl.Name         = sCtrlName;
                WindowControl.Dock         = (int)dock;
                WindowControl.UI_Window_id = Window.Id;
                Window.WindowControlMgr.AddNew(WindowControl);


                string sText = string.Format("[{0}]", frm2.m_SelColumn.Code);

                CTableInWindowControl tiwc = new CTableInWindowControl();
                tiwc.Ctx                 = Program.Ctx;
                tiwc.FW_Table_id         = frm.m_SelTable.Id;
                tiwc.UI_WindowControl_id = WindowControl.Id;
                tiwc.Text                = sText;
                WindowControl.TableInWindowControlMgr.AddNew(tiwc);

                UIComboBoxEl cb = new UIComboBoxEl();
                cb.CaptionText   = frm.m_SelTable.Name + ":";
                cb.WindowControl = WindowControl;
                cb.Tag           = WindowControl;
                panel.Controls.Add(cb);
                cb.Dock = DockStyle.Top;
                cb.BringToFront();

                cb.lbTitle.MouseClick  += new MouseEventHandler(childCtrl_MouseClick);
                cb.comboBox.MouseClick += new MouseEventHandler(childCtrl_MouseClick);

                SelectElement(cb);
            }
            else if (item.Text.Equals("ListBox", StringComparison.OrdinalIgnoreCase))
            {
                SelTableForm frm = new SelTableForm();
                if (frm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                SelColumnForm frm2 = new SelColumnForm();
                frm2.m_Table = frm.m_SelTable;
                if (frm2.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                string sCtrlName = GetDistinctName(frm.m_SelTable.Name, Window.WindowControlMgr);

                CWindowControl WindowControl = new CWindowControl();
                WindowControl.CtrlType     = ControlType.ListBox;
                WindowControl.Ctx          = Program.Ctx;
                WindowControl.Name         = sCtrlName;
                WindowControl.Dock         = (int)dock;
                WindowControl.UI_Window_id = Window.Id;
                Window.WindowControlMgr.AddNew(WindowControl);


                string sText = string.Format("[{0}]", frm2.m_SelColumn.Code);
                //string sText = "";
                //List<CBaseObject> lstObj = frm.m_SelTable.ColumnMgr.GetList();
                //bool bHasName = false, bHasCode = false;
                //foreach (CBaseObject obj in lstObj)
                //{
                //    CColumn column = (CColumn)obj;
                //    if (column.Code.Equals("name", StringComparison.OrdinalIgnoreCase))
                //    {
                //        bHasName = true;
                //    }
                //    if (column.Code.Equals("code", StringComparison.OrdinalIgnoreCase))
                //    {
                //        bHasCode = true;
                //    }
                //}
                //if (bHasName)
                //    sText = "[Name]";
                //else if (bHasCode)
                //    sText = "[Code]";

                CTableInWindowControl tiwc = new CTableInWindowControl();
                tiwc.Ctx                 = Program.Ctx;
                tiwc.FW_Table_id         = frm.m_SelTable.Id;
                tiwc.UI_WindowControl_id = WindowControl.Id;
                tiwc.Text                = sText;
                WindowControl.TableInWindowControlMgr.AddNew(tiwc);

                UIListBoxEl listBox = new UIListBoxEl();
                listBox.CaptionText   = sCtrlName;
                listBox.WindowControl = WindowControl;
                listBox.Tag           = WindowControl;
                panel.Controls.Add(listBox);
                listBox.Dock = DockStyle.Fill;
                listBox.BringToFront();

                listBox.tbTitle.MouseClick += new MouseEventHandler(childCtrl_MouseClick);

                SelectElement(listBox);
            }
        }