Ejemplo n.º 1
0
        void LoadHeader()
        {
            if (BaseObjectMgr == null)
            {
                return;
            }
            if (dataGridView == null)
            {
                return;
            }
            dataGridView.Columns.Clear();

            bool bHas = false;

            if (TableInWindowControl != null)
            {
                List <CBaseObject> lstCIWC = TableInWindowControl.ColumnInTableInWindowControlMgr.GetList();
                if (lstCIWC.Count > 0)
                {
                    bHas = true;
                    foreach (CBaseObject obj in lstCIWC)
                    {
                        CColumnInTableInWindowControl ciwc = (CColumnInTableInWindowControl)obj;
                        CColumn col = (CColumn)BaseObjectMgr.Table.ColumnMgr.Find(ciwc.FW_Column_id);
                        if (col == null)
                        {
                            continue;
                        }
                        DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn();
                        column.Name       = col.Code;
                        column.HeaderText = col.Name;
                        column.Tag        = col;
                        dataGridView.Columns.Add(column);
                    }
                }
            }
            if (!bHas)
            {
                List <CBaseObject> lstCol = baseObjectMgr.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);
                }
            }
            //工作流
            DataGridViewTextBoxColumn columnWF = new DataGridViewTextBoxColumn();

            columnWF.Name       = "workflow";
            columnWF.HeaderText = "工作流";
            dataGridView.Columns.Add(columnWF);
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
        private void listColumn_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (e.CurrentValue == e.NewValue)
            {
                return;
            }
            ListViewItem item = listColumn.Items[e.Index];

            CWindowControl WindowControl = (CWindowControl)ControlEl.Tag;
            IDesignEl      designEl      = (IDesignEl)ControlEl;
            CColumn        col           = (CColumn)item.Tag;

            if (designEl.GetCtrlType() == ControlType.TableGrid)
            {
                TableGridEl           te      = (TableGridEl)ControlEl;
                CTableInWindowControl tiwc    = (CTableInWindowControl)WindowControl.TableInWindowControlMgr.GetFirstObj();
                List <CBaseObject>    lstCIWC = tiwc.ColumnInTableInWindowControlMgr.GetList();
                if (e.NewValue == CheckState.Checked)
                {
                    bool bHas = false;
                    foreach (CBaseObject obj in lstCIWC)
                    {
                        CColumnInTableInWindowControl ciwc = (CColumnInTableInWindowControl)obj;
                        if (ciwc.FW_Column_id == col.Id)
                        {
                            bHas = true;
                            break;
                        }
                    }
                    if (!bHas)
                    {
                        CColumnInTableInWindowControl ciwc = new CColumnInTableInWindowControl();
                        ciwc.FW_Column_id = col.Id;
                        ciwc.UI_TableInWindowControl_id = tiwc.Id;
                        ciwc.Ctx = Program.Ctx;
                        tiwc.ColumnInTableInWindowControlMgr.AddNew(ciwc);

                        if (te.dataGridView.Columns[col.Code] == null)
                        {
                            te.dataGridView.Columns.Add(col.Code, col.Name);
                        }
                    }
                }
                else
                {
                    foreach (CBaseObject obj in lstCIWC)
                    {
                        CColumnInTableInWindowControl ciwc = (CColumnInTableInWindowControl)obj;
                        if (ciwc.FW_Column_id == col.Id)
                        {
                            tiwc.ColumnInTableInWindowControlMgr.Delete(ciwc);
                            if (te.dataGridView.Columns[col.Code] != null)
                            {
                                te.dataGridView.Columns.Remove(col.Code);
                            }
                            break;
                        }
                    }
                }
            }
            else if (designEl.GetCtrlType() == ControlType.TableTab)
            {
                TableTabEl            tab     = (TableTabEl)ControlEl;
                TableGridEl           te      = tab.GetCurTableGridEl();
                CTableInWindowControl tiwc    = te.TableInWindowControl;
                List <CBaseObject>    lstCIWC = tiwc.ColumnInTableInWindowControlMgr.GetList();
                if (e.NewValue == CheckState.Checked)
                {
                    bool bHas = false;
                    foreach (CBaseObject obj in lstCIWC)
                    {
                        CColumnInTableInWindowControl ciwc = (CColumnInTableInWindowControl)obj;
                        if (ciwc.FW_Column_id == col.Id)
                        {
                            bHas = true;
                            break;
                        }
                    }
                    if (!bHas)
                    {
                        CColumnInTableInWindowControl ciwc = new CColumnInTableInWindowControl();
                        ciwc.FW_Column_id = col.Id;
                        ciwc.UI_TableInWindowControl_id = tiwc.Id;
                        ciwc.Ctx = Program.Ctx;
                        tiwc.ColumnInTableInWindowControlMgr.AddNew(ciwc);

                        if (te.dataGridView.Columns[col.Code] == null)
                        {
                            te.dataGridView.Columns.Add(col.Code, col.Name);
                        }
                    }
                }
                else
                {
                    foreach (CBaseObject obj in lstCIWC)
                    {
                        CColumnInTableInWindowControl ciwc = (CColumnInTableInWindowControl)obj;
                        if (ciwc.FW_Column_id == col.Id)
                        {
                            tiwc.ColumnInTableInWindowControlMgr.Delete(ciwc);
                            if (te.dataGridView.Columns[col.Code] != null)
                            {
                                te.dataGridView.Columns.Remove(col.Code);
                            }
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        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;
                }
            }
        }
Ejemplo n.º 5
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;
        }