public virtual bool OpenTableFromSql(DataTable table, string sql, string paramvalue, string pageinfo, string dsname, string alias, bool autotran) { if (QueryUtil.OpenTableFromSql(table, sql, paramvalue, pageinfo, dsname, alias)) { //table.TableNewRow -= new DataTableNewRowEventHandler(DoTableNewRow); //table.TableNewRow += new DataTableNewRowEventHandler(DoTableNewRow); //table.ColumnChanged -= new DataColumnChangeEventHandler(DoColumnChanged); //table.ColumnChanged += new DataColumnChangeEventHandler(DoColumnChanged); PageManager pm = TableUtil.GetPageManager(table); if (pm != null) { pm.OnPageChangedEvent -= new PageChangedEventHandle(OnPageChanged); pm.OnPageChangedEvent += new PageChangedEventHandle(OnPageChanged); } BindingSource bs = DataUIUtil.GetBindingSource(table); if (bs != null) { bs.ListChanged -= new ListChangedEventHandler(TableListChanged); bs.ListChanged += new ListChangedEventHandler(TableListChanged); } if (autotran) { AddTable(table); } return(true); } return(false); }
public FormDemo() { CLocalSystem.LocalSystemContext.IsVerify = false; CLocalSystem.MainForm = this; CLocalSystem.SystemInit(); SystemContext.Init(); InitializeComponent(); //只需在主窗体调用一次 //SystemContext.Init(); this.OpenTableFromSql(mLoginTable, "select * from t_login_log", "", "1,10", ""); TableUtil.SetMapInfo(mLoginTable.Columns["f_state"], "1=登录;0=注销"); DataUIUtil.InitDataGridViewColumns(dataGridView1, mLoginTable); dataTreeView1.OnInitTreeNode += new MonitorLib.Ctrls.Extend.TreeNodeEventHandle(DoInitTreeNode); videoPlayerManageCtrl1.Init(16, 1, 2); videoPlayerManageCtrl1.OnActiveBoxChanging += new BoxEventHandle <VideoPlayer>(DoActiveBoxChanging); videoPlayerManageCtrl1.OnActiveBoxChanged += new BoxEventHandle <VideoPlayer>(DoActiveBoxChanged); label_info.Text = ""; dateTimePicker_end.Value = DateTime.Now; dateTimePicker_begin.Value = dateTimePicker_end.Value.AddDays(-1); }
protected override void OnAfterSelect(TreeViewEventArgs e) { DataRow row = e.Node.Tag as DataRow; if (row != null) { BindingSource bs = DataUIUtil.GetBindingSource(row.Table); if (bs != null) { bs.Position = row.Table.Rows.IndexOf(row); } } base.OnAfterSelect(e); }
public void RefreshBind() { DataColumn curBindColumn = BindColumn; BindColumn = null; BindColumn = curBindColumn; if (curBindColumn != null) { BindingSource bs = DataUIUtil.GetBindingSource(curBindColumn.Table); if (bs != null) { bs.ResetCurrentItem(); } } }
public virtual void MoveLast(DataTable table) { DataUIUtil.MoveLast(table); }
public virtual void MovePrevious(DataTable table) { DataUIUtil.MovePrevious(table); }
public virtual void InitDataGridViewColumns(DataGridView grid, DataTable table) { DataUIUtil.InitDataGridViewColumns(grid, table); }
public virtual void RefreshAutoBindControls(Control container) { DataUIUtil.RefreshAutoBindControls(container); }
public virtual void BindUI(Control control, DataColumn column) { DataUIUtil.BindControl(control, column); }
public virtual void BindUI(Control control, DataTable table, string alias) { DataUIUtil.BindControls(this, table, true, alias); }
private void ShowServiceResult(OutParams outparams) { richTextBox_result.Text = outparams.GetParams(); ArrayList list = new ArrayList(); list.Add(tabPage_result.Name); string tabname = ""; int count = outparams.GetStrParamsCount(); if (count > 0) { tabname = "__ResultParamList"; if (!tabControl_result.TabPages.ContainsKey(tabname)) { TabPage page = new TabPage(); page.Name = tabname; page.Text = "变量列表"; DataTable table = new DataTable(); DataColumn column = table.Columns.Add(); column.Caption = "变量名称"; column.ColumnName = "变量名称"; column.DataType = System.Type.GetType("System.String"); column = table.Columns.Add(); column.Caption = "变量值"; column.ColumnName = "变量值"; column.DataType = System.Type.GetType("System.String"); DataGridView grid = new DataGridView(); grid.Parent = page; grid.Dock = DockStyle.Fill; grid.DataSource = table.DefaultView; page.Tag = table; for (int i = 0; i < count; i++) { IParam param = outparams.GetStrParam(i); DataRow row = table.NewRow(); row["变量名称"] = param.GetName(); row["变量值"] = param.GetValue(); table.Rows.Add(row); } table.AcceptChanges(); page.Parent = tabControl_result; } else { DataTable table = tabControl_result.TabPages[tabname].Tag as DataTable; if (table != null) { table.Clear(); for (int i = 0; i < count; i++) { IParam param = outparams.GetStrParam(i); DataRow row = table.NewRow(); row["变量名称"] = param.GetName(); row["变量值"] = param.GetValue(); table.Rows.Add(row); } table.AcceptChanges(); } } list.Add(tabname); } count = outparams.GetTableParamsCount(); if (count > 0) { for (int i = 0; i < count; i++) { DataTable table = outparams.GetTableParamValue(i); TableUtil.SetProperty(table, "DataSource", outparams.GetStrParamValue("DataSource")); TableUtil.SetProperty(table, "Command", outparams.GetStrParamValue("Command")); tabname = table.TableName.ToUpper(); list.Add(tabname); if (!tabControl_result.TabPages.ContainsKey(tabname)) { TabPage page = new TabPage(); page.Name = tabname; page.Text = tabname; DataGridView grid = new DataGridView(); grid.Parent = page; grid.Dock = DockStyle.Fill; grid.Tag = table; //grid.DataSource = table.DefaultView; DataUIUtil.InitDataGridViewColumns(grid, table); page.Tag = grid; page.Parent = tabControl_result; } else { DataGridView grid = tabControl_result.TabPages[tabname].Tag as DataGridView; if (grid != null) { grid.Tag = table; //grid.DataSource = table.DefaultView; DataUIUtil.InitDataGridViewColumns(grid, table); } } } } IEnumerator it = tabControl_result.TabPages.GetEnumerator(); while (it.MoveNext()) { TabPage page = it.Current as TabPage; if (page != null && !list.Contains(page.Name)) { tabControl_result.TabPages.Remove(page); } } }
protected virtual void MoveLast(DataTable table) { DataUIUtil.MoveLast(table); }
protected virtual void MovePrevious(DataTable table) { DataUIUtil.MovePrevious(table); }