コード例 #1
0
        public object GetParamValue(string name)
        {
            IParam param = GetParam(name);

            return(param != null?param.GetValue() : null);
        }
コード例 #2
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);
                }
            }
        }
コード例 #3
0
        public DataTable GetTableParamValue(string name)
        {
            IParam param = GetTableParam(name);

            return(param != null? (DataTable)param.GetValue():null);
        }