示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        public void RefreshBind()
        {
            DataColumn curBindColumn = BindColumn;

            BindColumn = null;
            BindColumn = curBindColumn;

            if (curBindColumn != null)
            {
                BindingSource bs = DataUIUtil.GetBindingSource(curBindColumn.Table);
                if (bs != null)
                {
                    bs.ResetCurrentItem();
                }
            }
        }
示例#5
0
 public virtual void MoveLast(DataTable table)
 {
     DataUIUtil.MoveLast(table);
 }
示例#6
0
 public virtual void MovePrevious(DataTable table)
 {
     DataUIUtil.MovePrevious(table);
 }
示例#7
0
 public virtual void InitDataGridViewColumns(DataGridView grid, DataTable table)
 {
     DataUIUtil.InitDataGridViewColumns(grid, table);
 }
示例#8
0
 public virtual void RefreshAutoBindControls(Control container)
 {
     DataUIUtil.RefreshAutoBindControls(container);
 }
示例#9
0
 public virtual void BindUI(Control control, DataColumn column)
 {
     DataUIUtil.BindControl(control, column);
 }
示例#10
0
 public virtual void BindUI(Control control, DataTable table, string alias)
 {
     DataUIUtil.BindControls(this, table, true, alias);
 }
示例#11
0
        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);
                }
            }
        }
示例#12
0
 protected virtual void MoveLast(DataTable table)
 {
     DataUIUtil.MoveLast(table);
 }
示例#13
0
 protected virtual void MovePrevious(DataTable table)
 {
     DataUIUtil.MovePrevious(table);
 }