Example #1
0
        private void BindDataList(string type)
        {
            DataSet ds;

            getSconn();
            _bll = new ToolBll(Session["sConn"].ToString());
            ds   = _bll.getDataTableList();
            if (ds == null)
            {
                panToolBar.Visible        =
                    panTabControl.Visible = false;
                return;
            }
            lsbDataTable.Items.Clear();
            lsbDataView.Items.Clear();
            lsbProcedures.Items.Clear();
            btnSelectTable.CssClass = "btn_tab";
            foreach (DataRow row in ds.Tables["datatable"].Rows)
            {
                lsbDataTable.Items.Add(new ListItem(row["name"].ToString(), row["schemas"].ToString() + "." + row["name"].ToString()));
            }
            ds = _bll.getDataViewList();
            if (ds.Tables["datatable"].Rows.Count > 0)
            {
                btnSelectView.Visible  = true;
                btnSelectView.CssClass = "btn_tab";
                foreach (DataRow row in ds.Tables["datatable"].Rows)
                {
                    lsbDataView.Items.Add(new ListItem(row["name"].ToString(), row["schemas"].ToString() + "." + row["name"].ToString()));
                }
            }
            else
            {
                btnSelectView.Visible = false;
                if (type == TYPE_VIEW)
                {
                    type = TYPE_TABLE;
                }
            }
            ds = _bll.getDataProcedureList();
            if (ds.Tables["datatable"].Rows.Count > 0)
            {
                btnSelectProcedures.Visible  = true;
                btnSelectProcedures.CssClass = "btn_tab";
                foreach (DataRow row in ds.Tables["datatable"].Rows)
                {
                    lsbProcedures.Items.Add(new ListItem(row["name"].ToString(), row["schemas"].ToString() + "." + row["name"].ToString()));
                }
            }
            else
            {
                btnSelectProcedures.Visible = false;
                if (type == TYPE_PROC)
                {
                    type = TYPE_TABLE;
                }
            }
            switch (type)
            {
            case TYPE_TABLE:
            {
                mlvList.SetActiveView(viewTable);
                hidTabType.Value        = TYPE_TABLE;
                btnSelectTable.CssClass = "btn_tab_pause";
                break;
            }

            case TYPE_VIEW:
            {
                mlvList.SetActiveView(viewView);
                hidTabType.Value       = TYPE_VIEW;
                btnSelectView.CssClass = "btn_tab_pause";
                break;
            }

            case TYPE_PROC:
            {
                mlvList.SetActiveView(viewProcedure);
                hidTabType.Value             = TYPE_PROC;
                btnSelectProcedures.CssClass = "btn_tab_pause";
                break;
            }

            default:
            {
                mlvList.SetActiveView(viewTable);
                hidTabType.Value        = TYPE_TABLE;
                btnSelectTable.CssClass = "btn_tab_pause";
                break;
            }
            }
            panToolBar.Visible        =
                panTabControl.Visible = true;
        }