コード例 #1
0
ファイル: TableGridEl.cs プロジェクト: stonezhu870/RapidCore
        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;
        }
コード例 #2
0
        private void listToolBarButton_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (e.CurrentValue == e.NewValue)
            {
                return;
            }

            CWindowControl WindowControl = (CWindowControl)ControlEl.Tag;
            IDesignEl      designEl      = (IDesignEl)ControlEl;

            if (designEl.GetCtrlType() == ControlType.TableGrid)
            {
                TableGridEl           te       = (TableGridEl)ControlEl;
                CTableInWindowControl tiwc     = (CTableInWindowControl)WindowControl.TableInWindowControlMgr.GetFirstObj();
                List <CBaseObject>    lstTBIWC = tiwc.TButtonInTableInWindowControlMgr.GetList();
                if (e.NewValue == CheckState.Checked)
                {
                    bool bHas = false;
                    foreach (CBaseObject obj in lstTBIWC)
                    {
                        CTButtonInTableInWindowControl tbiwc = (CTButtonInTableInWindowControl)obj;
                        if (tbiwc.Title.Equals(listToolBarButton.Items[e.Index].Text, StringComparison.OrdinalIgnoreCase))
                        {
                            bHas = true;
                            break;
                        }
                    }
                    if (!bHas)
                    {
                        CTButtonInTableInWindowControl tbiwc = new CTButtonInTableInWindowControl();
                        tbiwc.Title = listToolBarButton.Items[e.Index].Text;
                        tbiwc.UI_TableInWindowControl_id = tiwc.Id;
                        tbiwc.Ctx = Program.Ctx;
                        tiwc.TButtonInTableInWindowControlMgr.AddNew(tbiwc);
                        te.SetToolBarButtonVisible(listToolBarButton.Items[e.Index].Text, true);
                    }
                }
                else
                {
                    foreach (CBaseObject obj in lstTBIWC)
                    {
                        CTButtonInTableInWindowControl tbiwc = (CTButtonInTableInWindowControl)obj;
                        if (tbiwc.Title.Equals(listToolBarButton.Items[e.Index].Text, StringComparison.OrdinalIgnoreCase))
                        {
                            tiwc.TButtonInTableInWindowControlMgr.Delete(tbiwc);
                            te.SetToolBarButtonVisible(listToolBarButton.Items[e.Index].Text, false);
                            break;
                        }
                    }
                }
            }
            else if (designEl.GetCtrlType() == ControlType.TableTree)
            {
                TableTreeEl treeEl = (TableTreeEl)ControlEl;
            }
            else if (designEl.GetCtrlType() == ControlType.TableTab)
            {
                TableTabEl            tab      = (TableTabEl)ControlEl;
                TableGridEl           te       = tab.GetCurTableGridEl();
                CTableInWindowControl tiwc     = te.TableInWindowControl;
                List <CBaseObject>    lstTBIWC = tiwc.TButtonInTableInWindowControlMgr.GetList();
                if (e.NewValue == CheckState.Checked)
                {
                    bool bHas = false;
                    foreach (CBaseObject obj in lstTBIWC)
                    {
                        CTButtonInTableInWindowControl tbiwc = (CTButtonInTableInWindowControl)obj;
                        if (tbiwc.Title.Equals(listToolBarButton.Items[e.Index].Text, StringComparison.OrdinalIgnoreCase))
                        {
                            bHas = true;
                            break;
                        }
                    }
                    if (!bHas)
                    {
                        CTButtonInTableInWindowControl tbiwc = new CTButtonInTableInWindowControl();
                        tbiwc.Title = listToolBarButton.Items[e.Index].Text;
                        tbiwc.UI_TableInWindowControl_id = tiwc.Id;
                        tbiwc.Ctx = Program.Ctx;
                        tiwc.TButtonInTableInWindowControlMgr.AddNew(tbiwc);
                        te.SetToolBarButtonVisible(listToolBarButton.Items[e.Index].Text, true);
                    }
                }
                else
                {
                    foreach (CBaseObject obj in lstTBIWC)
                    {
                        CTButtonInTableInWindowControl tbiwc = (CTButtonInTableInWindowControl)obj;
                        if (tbiwc.Title.Equals(listToolBarButton.Items[e.Index].Text, StringComparison.OrdinalIgnoreCase))
                        {
                            tiwc.TButtonInTableInWindowControlMgr.Delete(tbiwc);
                            te.SetToolBarButtonVisible(listToolBarButton.Items[e.Index].Text, false);
                            break;
                        }
                    }
                }
            }
        }
コード例 #3
0
ファイル: TableGridEl.cs プロジェクト: stonezhu870/RapidCore
        void LoadTable()
        {
            dataGridView.Columns.Clear();
            if (WindowControl == null)
            {
                return;
            }
            CTableInWindowControl tiwc = null;

            if (TableInWindowControl == null)
            {
                tiwc = (CTableInWindowControl)WindowControl.TableInWindowControlMgr.GetFirstObj();
                if (tiwc == null)
                {
                    return;
                }
            }
            else
            {
                tiwc = TableInWindowControl;
            }

            CTable table = (CTable)Program.Ctx.TableMgr.Find(tiwc.FW_Table_id);

            if (table == null)
            {
                return;
            }

            {
                bool bHas = false;
                List <CBaseObject> lstCIWC = tiwc.ColumnInTableInWindowControlMgr.GetList();
                if (lstCIWC.Count > 0)
                {
                    bHas = true;
                    foreach (CBaseObject obj in lstCIWC)
                    {
                        CColumnInTableInWindowControl ciwc = (CColumnInTableInWindowControl)obj;
                        CColumn col = (CColumn)table.ColumnMgr.Find(ciwc.FW_Column_id);
                        dataGridView.Columns.Add(col.Code, col.Name);
                    }
                }

                if (!bHas)
                {
                    List <CBaseObject> lstCol = table.ColumnMgr.GetList();
                    foreach (CColumn col in lstCol)
                    {
                        //if (!col.IsVisible)
                        //    continue;
                        DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn();
                        column.Name       = col.Code;
                        column.HeaderText = col.Name;
                        column.Tag        = col;
                        dataGridView.Columns.Add(column);
                    }
                }
            }

            List <CBaseObject> lstTButton = tiwc.TButtonInTableInWindowControlMgr.GetList();

            foreach (ToolStripItem tbutton in toolStrip.Items)
            {
                bool bHas = false;
                foreach (CBaseObject obj in lstTButton)
                {
                    CTButtonInTableInWindowControl tbiwc = (CTButtonInTableInWindowControl)obj;
                    if (tbiwc.Title.Equals(tbutton.Text, StringComparison.OrdinalIgnoreCase))
                    {
                        bHas = true;
                        break;
                    }
                }
                if (!bHas)
                {
                    tbutton.Visible = false;
                }
            }
        }
コード例 #4
0
        public void LoadData()
        {
            if (m_AttrType == AttrType.WindowControl)
            {
                if (ControlEl == null || ControlEl.Tag == null)
                {
                    return;
                }
            }
            else
            {
                if (WindowEl == null || WindowEl.Window == null)
                {
                    return;
                }
            }

            m_bIsLoading = true;

            UpdateTabCtrl();

            UpdatePropertyGrid();

            if (m_AttrType == AttrType.WindowControl)
            {
                IDesignEl      designEl      = (IDesignEl)ControlEl;
                CWindowControl WindowControl = (CWindowControl)ControlEl.Tag;
                if (designEl.GetCtrlType() == ControlType.NavBar)
                {
                }
                else if (designEl.GetCtrlType() == ControlType.TableGrid)
                {
                    TableGridEl           tableGridEl          = (TableGridEl)ControlEl;
                    CTableInWindowControl TableInWindowControl = (CTableInWindowControl)WindowControl.TableInWindowControlMgr.GetFirstObj();
                    CTable table = (CTable)Program.Ctx.TableMgr.Find(TableInWindowControl.FW_Table_id);
                    if (table != null)
                    {
                        listColumn.Items.Clear();
                        List <CBaseObject> lstColumn = table.ColumnMgr.GetList();
                        foreach (CBaseObject obj in lstColumn)
                        {
                            CColumn      col  = (CColumn)obj;
                            ListViewItem item = new ListViewItem();
                            item.Text = col.Name;
                            item.Tag  = col;
                            listColumn.Items.Add(item);

                            List <CBaseObject> lstCIWC = TableInWindowControl.ColumnInTableInWindowControlMgr.GetList();
                            bool bHas = false;
                            foreach (CBaseObject obj2 in lstCIWC)
                            {
                                CColumnInTableInWindowControl ciwc = (CColumnInTableInWindowControl)obj2;
                                if (ciwc.FW_Column_id == col.Id)
                                {
                                    item.Checked = true;
                                    if (tableGridEl.dataGridView.Columns[col.Code] == null)
                                    {
                                        tableGridEl.dataGridView.Columns.Add(col.Code, col.Name);
                                    }
                                    bHas = true;
                                    break;
                                }
                            }
                            if (!bHas)
                            {
                                if (tableGridEl.dataGridView.Columns[col.Code] != null)
                                {
                                    tableGridEl.dataGridView.Columns.Remove(col.Code);
                                }
                            }
                        }
                    }

                    List <CBaseObject> lstTButton = TableInWindowControl.TButtonInTableInWindowControlMgr.GetList();
                    listToolBarButton.Items.Clear();
                    foreach (ToolStripItem tbutton in tableGridEl.toolStrip.Items)
                    {
                        ListViewItem item = new ListViewItem();
                        item.Text = tbutton.Text;
                        listToolBarButton.Items.Add(item);
                        bool bHas = false;
                        foreach (CBaseObject obj in lstTButton)
                        {
                            CTButtonInTableInWindowControl tbiwc = (CTButtonInTableInWindowControl)obj;
                            if (tbiwc.Title.Equals(tbutton.Text, StringComparison.OrdinalIgnoreCase))
                            {
                                item.Checked = true;
                                bHas         = true;
                                break;
                            }
                        }
                        if (!bHas)
                        {
                            tbutton.Visible = false;
                        }
                    }

                    richTextFilter.Text = TableInWindowControl.QueryFilter;


                    List <CBaseObject> lstLWC = WindowControl.LinkageWindowControlMgr.GetList();
                    for (int i = 0; i < listLinkageWindowControl.Items.Count; i++)
                    {
                        listLinkageWindowControl.Items[i].Checked = false;
                    }
                    foreach (ListViewItem item in listLinkageWindowControl.Items)
                    {
                        CWindowControl wc = (CWindowControl)item.Tag;
                        foreach (CBaseObject obj in lstLWC)
                        {
                            CLinkageWindowControl lwc = (CLinkageWindowControl)obj;
                            if (lwc.SlaveID == wc.Id)
                            {
                                item.Checked = true;
                                break;
                            }
                        }
                    }
                }
                else if (designEl.GetCtrlType() == ControlType.TableTree)
                {
                    TableTreeEl treeEl = (TableTreeEl)ControlEl;

                    List <CBaseObject> lstLWC = WindowControl.LinkageWindowControlMgr.GetList();
                    for (int i = 0; i < listLinkageWindowControl.Items.Count; i++)
                    {
                        listLinkageWindowControl.Items[i].Checked = false;
                    }
                    foreach (ListViewItem item in listLinkageWindowControl.Items)
                    {
                        CWindowControl wc = (CWindowControl)item.Tag;
                        foreach (CBaseObject obj in lstLWC)
                        {
                            CLinkageWindowControl lwc = (CLinkageWindowControl)obj;
                            if (lwc.SlaveID == wc.Id)
                            {
                                item.Checked = true;
                                break;
                            }
                        }
                    }
                }
                else if (designEl.GetCtrlType() == ControlType.ListBox)
                {
                    CTableInWindowControl TableInWindowControl = (CTableInWindowControl)WindowControl.TableInWindowControlMgr.GetFirstObj();

                    richTextFilter.Text = TableInWindowControl.QueryFilter;


                    List <CBaseObject> lstLWC = WindowControl.LinkageWindowControlMgr.GetList();
                    for (int i = 0; i < listLinkageWindowControl.Items.Count; i++)
                    {
                        listLinkageWindowControl.Items[i].Checked = false;
                    }
                    foreach (ListViewItem item in listLinkageWindowControl.Items)
                    {
                        CWindowControl wc = (CWindowControl)item.Tag;
                        foreach (CBaseObject obj in lstLWC)
                        {
                            CLinkageWindowControl lwc = (CLinkageWindowControl)obj;
                            if (lwc.SlaveID == wc.Id)
                            {
                                item.Checked = true;
                                break;
                            }
                        }
                    }
                }
                else if (designEl.GetCtrlType() == ControlType.ComboBox)
                {
                    CTableInWindowControl TableInWindowControl = (CTableInWindowControl)WindowControl.TableInWindowControlMgr.GetFirstObj();

                    richTextFilter.Text = TableInWindowControl.QueryFilter;


                    List <CBaseObject> lstLWC = WindowControl.LinkageWindowControlMgr.GetList();
                    for (int i = 0; i < listLinkageWindowControl.Items.Count; i++)
                    {
                        listLinkageWindowControl.Items[i].Checked = false;
                    }
                    foreach (ListViewItem item in listLinkageWindowControl.Items)
                    {
                        CWindowControl wc = (CWindowControl)item.Tag;
                        foreach (CBaseObject obj in lstLWC)
                        {
                            CLinkageWindowControl lwc = (CLinkageWindowControl)obj;
                            if (lwc.SlaveID == wc.Id)
                            {
                                item.Checked = true;
                                break;
                            }
                        }
                    }
                }
                else if (designEl.GetCtrlType() == ControlType.TableTab)
                {
                    TableTabEl            tab                  = (TableTabEl)ControlEl;
                    TableGridEl           tableGridEl          = tab.GetCurTableGridEl();
                    CTableInWindowControl TableInWindowControl = tableGridEl.TableInWindowControl;
                    CTable table = (CTable)Program.Ctx.TableMgr.Find(TableInWindowControl.FW_Table_id);
                    if (table != null)
                    {
                        listColumn.Items.Clear();
                        List <CBaseObject> lstColumn = table.ColumnMgr.GetList();
                        foreach (CBaseObject obj in lstColumn)
                        {
                            CColumn      col  = (CColumn)obj;
                            ListViewItem item = new ListViewItem();
                            item.Text = col.Name;
                            item.Tag  = col;
                            listColumn.Items.Add(item);

                            bool bHas = false;
                            List <CBaseObject> lstCIWC = TableInWindowControl.ColumnInTableInWindowControlMgr.GetList();
                            foreach (CBaseObject obj2 in lstCIWC)
                            {
                                CColumnInTableInWindowControl ciwc = (CColumnInTableInWindowControl)obj2;
                                if (ciwc.FW_Column_id == col.Id)
                                {
                                    item.Checked = true;
                                    bHas         = true;
                                    if (tableGridEl.dataGridView.Columns[col.Code] == null)
                                    {
                                        tableGridEl.dataGridView.Columns.Add(col.Code, col.Name);
                                    }
                                    break;
                                }
                            }
                            if (!bHas)
                            {
                                if (tableGridEl.dataGridView.Columns[col.Code] != null)
                                {
                                    tableGridEl.dataGridView.Columns.Remove(col.Code);
                                }
                            }
                        }
                    }

                    List <CBaseObject> lstTButton = TableInWindowControl.TButtonInTableInWindowControlMgr.GetList();
                    listToolBarButton.Items.Clear();
                    foreach (ToolStripItem tbutton in tableGridEl.toolStrip.Items)
                    {
                        ListViewItem item = new ListViewItem();
                        item.Text = tbutton.Text;
                        listToolBarButton.Items.Add(item);
                        bool bHas = false;
                        foreach (CBaseObject obj in lstTButton)
                        {
                            CTButtonInTableInWindowControl tbiwc = (CTButtonInTableInWindowControl)obj;
                            if (tbiwc.Title.Equals(tbutton.Text, StringComparison.OrdinalIgnoreCase))
                            {
                                item.Checked = true;
                                bHas         = true;
                                break;
                            }
                        }
                        if (!bHas)
                        {
                            tbutton.Visible = false;
                        }
                    }

                    richTextFilter.Text = TableInWindowControl.QueryFilter;


                    List <CBaseObject> lstLWC = WindowControl.LinkageWindowControlMgr.GetList();
                    for (int i = 0; i < listLinkageWindowControl.Items.Count; i++)
                    {
                        listLinkageWindowControl.Items[i].Checked = false;
                    }
                    foreach (ListViewItem item in listLinkageWindowControl.Items)
                    {
                        CWindowControl wc = (CWindowControl)item.Tag;
                        foreach (CBaseObject obj in lstLWC)
                        {
                            CLinkageWindowControl lwc = (CLinkageWindowControl)obj;
                            if (lwc.SlaveID == wc.Id)
                            {
                                item.Checked = true;
                                break;
                            }
                        }
                    }
                }
            }
            else
            {
            }

            m_bIsLoading = false;
        }