示例#1
0
        public void ddlPKChangeAction(int lastIndex, List <DropDownList> ddPKList, List <DropDownList> ddFKList,
                                      List <Label> lblPKList, List <Label> lblFKList)
        {
            for (int i = 10; i > lastIndex; i--)
            {
                ddPKList[i].Items.Clear();
                ddFKList[i].Items.Clear();
                lblPKList[i].Text = String.Empty;
                lblFKList[i].Text = String.Empty;
            }

            DBQueUtils dbQueUtilsObj = new DBQueUtils();
            DBQueDao   daoObj        = new DBQueDao();

            dbQueUtilsObj.fillFKTableListForPKTable(ddPKList[lastIndex].SelectedItem.Text, ddFKList[lastIndex], ("A" + (lastIndex - 1).ToString()));
            if (ddFKList[lastIndex].Items.Count == 0)
            {
                ddPKList[lastIndex].Items.RemoveAt(ddPKList[lastIndex].SelectedIndex);
            }
            lblFKList[lastIndex].Text = ddFKList[lastIndex].SelectedValue;
            String fkColumnValue = "";

            if (ddFKList[lastIndex].SelectedItem != null && ddFKList[lastIndex].SelectedItem.Text != "" &&
                ddPKList[lastIndex].SelectedItem != null && ddPKList[lastIndex].SelectedItem.Text != "")
            {
                fkColumnValue = daoObj.getPKFKColumnValue(ddFKList[lastIndex].SelectedItem.Text,
                                                          ddPKList[lastIndex].SelectedItem.Text);
            }
            lblPKList[lastIndex].Text = ddPKList[lastIndex].SelectedItem.Value.Split(' ')[1] + "."
                                        + fkColumnValue;
        }
示例#2
0
        public void changeInitOfSelectTableList(DropDownList selectTableFKTableName2, Label selectTableFkColumnName2,
                                                DropDownList DropDownSelectTable1, Label selectTablePKName2, Label selectTablePkColumnName2,
                                                DropDownList DropDownFKTb2, DropDownList DropDownPKTb2, DropDownList DropDownSelectCol1, String aliasFK, String aliasPK)

        {
            fillFKTableListForPKTable(DropDownPKTb2.SelectedItem.Text, DropDownFKTb2, aliasFK);
            if (DropDownFKTb2.Items.Count == 0)
            {
                DropDownPKTb2.Items.RemoveAt(DropDownPKTb2.SelectedIndex);
            }
            fillSelectTableColumList(DropDownSelectCol1, DropDownPKTb2, aliasPK);
            if (selectTableFKTableName2.SelectedItem != null)
            {
                selectTableFkColumnName2.Text = selectTableFKTableName2.SelectedItem.Value;
            }
            else
            {
                selectTableFkColumnName2.Text = "";
            }
            selectTablePKName2.Text = DropDownSelectTable1.SelectedItem.Text;
            DBQueDao daoObj = new DBQueDao();

            if (selectTableFKTableName2.SelectedItem != null)
            {
                selectTablePkColumnName2.Text = aliasPK + "." + daoObj.getPKFKColumnValue(selectTableFKTableName2.SelectedItem.Text, DropDownPKTb2.SelectedItem.Text);//DropDownSelectTable1.SelectedValue;
            }
        }
        protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            int cloID = Request.QueryString["cloID"] == null ? 0 : Int32.Parse(Request.QueryString["cloID"]);

            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                //Get questionID here
                String tableName         = DataBinder.Eval(e.Item.DataItem, "tableName").ToString();
                String pkColumnName      = DataBinder.Eval(e.Item.DataItem, "pkColumnName").ToString();
                String displayColumn     = DataBinder.Eval(e.Item.DataItem, "displayColumn").ToString();
                String headingLabel      = DataBinder.Eval(e.Item.DataItem, "headingLabel").ToString();
                String questionStatement = DataBinder.Eval(e.Item.DataItem, "questionStatement").ToString();
                int    questionID        = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "questionID"));

                DropDownList DropDownList1 = (DropDownList)e.Item.FindControl("ddlItemTemp");

                DBQueDao        dbQueDaoObj = new DBQueDao();
                List <ListItem> ddValueList = dbQueDaoObj.getColumnValues(tableName, displayColumn);

                DropDownList1.DataSource     = ddValueList;
                DropDownList1.DataTextField  = "Text";
                DropDownList1.DataValueField = "Value";
                DropDownList1.DataBind();
            }
        }
示例#4
0
        public void fillSelectedColumnValues(DropDownList ddWhereTable, DropDownList ddWhereColumn, DropDownList ddColumnValue)
        {
            String          tableName      = ddWhereTable.SelectedItem.Text;
            String          pkColumnName   = ddWhereTable.SelectedItem.Value;
            String          columnSelected = ddWhereColumn.SelectedItem.Text;
            DBQueDao        dbQueDaoObj    = new DBQueDao();
            List <ListItem> listItems      = dbQueDaoObj.getColumnValues(tableName, columnSelected);

            fillColumnValueList(ddColumnValue, listItems);
        }
示例#5
0
        public void fillColumnValueList(DropDownList ddPK, List <ListItem> listOfTables)
        {
            ddPK.Items.Clear();
            DBQueDao dbQueDaoObj = new DBQueDao();

            foreach (ListItem item in listOfTables)
            {
                ddPK.Items.Add(new ListItem(item.Text, item.Value));
            }
        }
示例#6
0
        public void fillSelectTableList(DropDownList DropDownPKTb2, String alias)
        {
            DBQueDao          daoObj    = new DBQueDao();
            List <DBQueTable> tableList = daoObj.getTableList();

            foreach (DBQueTable dbTable in tableList)
            {
                ListItem att2 = new ListItem();
                att2.Text  = dbTable.tableName;
                att2.Value = dbTable.tableName + " " + alias;
                DropDownPKTb2.Items.Add(att2);
            }
        }
示例#7
0
        public void fillPKTableList(DropDownList ddPK, List <ListItem> listOfTables)
        {
            ddPK.Items.Clear();
            DBQueDao dbQueDaoObj = new DBQueDao();

            foreach (ListItem item in listOfTables)
            {
                if (item.Text != "" && dbQueDaoObj.getPKFKColumnList(item.Text, "BBB").Count > 0)
                {
                    ddPK.Items.Add(new ListItem(item.Text, item.Value));
                }
            }
        }
示例#8
0
        protected void fillSelectTableList()
        {
            DBQueDao          daoObj    = new DBQueDao();
            List <DBQueTable> tableList = daoObj.getTableList();

            foreach (DBQueTable dbTable in tableList)
            {
                ListItem att2 = new ListItem();
                att2.Text  = dbTable.tableName;
                att2.Value = dbTable.pkColumnName;
                DropDownList1.Items.Add(att2);
            }
        }
示例#9
0
        protected void getPKFKColumnListItemsByTableName(String tableName)
        {
            DBQueDao daoObj = new DBQueDao();
            List <DBQuePKFKColumn> colList = daoObj.getPKFKColumnList(tableName, "A1");

            foreach (DBQuePKFKColumn col in colList)
            {
                ListItem columnObj = new ListItem();
                columnObj.Text  = col.fkTableName;
                columnObj.Value = col.fkColumnName;

                DropDownList2.Items.Add(columnObj);
            }
        }
示例#10
0
        public void fillFKTableListForPKTable(String tableName, DropDownList ddListName, String alias)
        {
            DBQueDao daoObj = new DBQueDao();
            List <DBQuePKFKColumn> colList = daoObj.getPKFKColumnList(tableName, alias);

            ddListName.Items.Clear();

            foreach (DBQuePKFKColumn col in colList)
            {
                ListItem columnObj = new ListItem();
                columnObj.Text  = col.fkTableName;
                columnObj.Value = col.fkColumnName;

                ddListName.Items.Add(columnObj);
            }
        }
示例#11
0
        protected void ddlWhere_SelectedIndexChanged(object sender, EventArgs e)
        {
            DBQueUtils          dbQueUtilsObj              = new DBQueUtils();
            int                 lastIndex                  = dbQueUtilsObj.getIndexOfDDList(sender) - 1;
            List <DropDownList> ddWhereTableList           = getListOfWhereTables();
            List <DropDownList> ddWhereColumnsList         = getListOfWhereColumns();
            List <DropDownList> ddWhereColumnValueList     = getListOfWhereColumnValues();
            List <Label>        lblSelectedColumnIdList    = getListOfWhereSelectedIdList();
            List <Label>        lblPKColumnList            = getListOfPkColumnList();
            List <CheckBox>     cbAskUserList              = getListOfAskUsers();
            List <TextBox>      txbBxHeadingWhereTableList = getListOfHeadingWhereTable();

            if (ddWhereTableList[lastIndex].SelectedValue != "")
            {
                dbQueUtilsObj.fillSelectTableColumList(ddWhereColumnsList[lastIndex], ddWhereTableList[lastIndex], ddWhereTableList[lastIndex].SelectedValue);
                dbQueUtilsObj.fillSelectedColumnValues(ddWhereTableList[lastIndex], ddWhereColumnsList[lastIndex], ddWhereColumnValueList[lastIndex]);
                if (ddWhereColumnValueList[lastIndex] != null && ddWhereColumnValueList[lastIndex].SelectedItem != null)
                {
                    lblSelectedColumnIdList[lastIndex].Text = ddWhereColumnValueList[lastIndex].SelectedItem.Value;
                }
                else
                {
                    lblSelectedColumnIdList[lastIndex].Text = "";
                }
                DBQueDao dbQueDaoObj = new DBQueDao();
                String   pkColName   = dbQueDaoObj.getPKColumnByTableName(ddWhereTableList[lastIndex].SelectedItem.Text);
                lblPKColumnList[lastIndex].Text = ddWhereTableList[lastIndex].SelectedValue + "." + pkColName;
            }
            else
            {
                //do empty other dropdowns and fields
                ddWhereColumnsList[lastIndex].Items.Clear();
                cbAskUserList[lastIndex].Checked = false;
                ddWhereColumnValueList[lastIndex].Items.Clear();
                lblSelectedColumnIdList[lastIndex].Text    = "";
                lblPKColumnList[lastIndex].Text            = "";
                txbBxHeadingWhereTableList[lastIndex].Text = "";
            }
        }
示例#12
0
        protected void ddlProgram_SelectedIndexChangedFKTable(object sender, EventArgs e)
        {
            FKCol2.Text = DropDownFKTb2.SelectedItem.Value;
            DBQueDao   daoObj        = new DBQueDao();
            DBQueUtils dbQueUtilsObj = new DBQueUtils();

            PKCol2.Text = DropDownPKTb2.SelectedItem.Value.Split(' ')[1] + "." + daoObj.getPKFKColumnValue(DropDownFKTb2.SelectedItem.Text, DropDownPKTb2.SelectedItem.Text);
            int lastIndex = dbQueUtilsObj.getIndexOfDDList(sender);

            changeOfPKFKTable(lastIndex);
            if (lastIndex == 2)
            {
                PKCol3.Text = String.Empty;
                DropDownFKTb3.Items.Clear();
                FKCol3.Text = String.Empty;
            }

            if (lastIndex == 3)
            {
                FKCol3.Text = DropDownFKTb3.SelectedValue;
                PKCol3.Text = DropDownPKTb3.SelectedItem.Value.Split(' ')[1] + "." + daoObj.getPKFKColumnValue(DropDownFKTb3.SelectedItem.Text, DropDownPKTb3.SelectedItem.Text);
            }
            if (lastIndex == 4)
            {
                FKCol4.Text = DropDownFKTb4.SelectedValue;
                PKCol4.Text = DropDownPKTb4.SelectedItem.Value.Split(' ')[1] + "." + daoObj.getPKFKColumnValue(DropDownFKTb4.SelectedItem.Text, DropDownPKTb4.SelectedItem.Text);
            }
            if (lastIndex == 5)
            {
                FKCol5.Text = DropDownFKTb5.SelectedValue;
                PKCol5.Text = DropDownPKTb5.SelectedItem.Value.Split(' ')[1] + "." + daoObj.getPKFKColumnValue(DropDownFKTb5.SelectedItem.Text, DropDownPKTb5.SelectedItem.Text);
            }
            if (lastIndex == 6)
            {
                FKCol6.Text = DropDownFKTb6.SelectedValue;
                PKCol6.Text = DropDownPKTb6.SelectedItem.Value.Split(' ')[1] + "." + daoObj.getPKFKColumnValue(DropDownFKTb6.SelectedItem.Text, DropDownPKTb6.SelectedItem.Text);
            }
            if (lastIndex == 7)
            {
                FKCol7.Text = DropDownFKTb7.SelectedValue;
                PKCol7.Text = DropDownPKTb7.SelectedItem.Value.Split(' ')[1] + "." + daoObj.getPKFKColumnValue(DropDownFKTb7.SelectedItem.Text, DropDownPKTb7.SelectedItem.Text);
            }
            if (lastIndex == 8)
            {
                FKCol8.Text = DropDownFKTb8.SelectedValue;
                PKCol8.Text = DropDownPKTb8.SelectedItem.Value.Split(' ')[1] + "." + daoObj.getPKFKColumnValue(DropDownFKTb8.SelectedItem.Text, DropDownPKTb8.SelectedItem.Text);
            }
            if (lastIndex == 9)
            {
                FKCol9.Text = DropDownFKTb9.SelectedValue;
                PKCol9.Text = DropDownPKTb9.SelectedItem.Value.Split(' ')[1] + "." + daoObj.getPKFKColumnValue(DropDownFKTb9.SelectedItem.Text, DropDownPKTb9.SelectedItem.Text);
            }
            if (lastIndex == 10)
            {
                FKCol10.Text = DropDownFKTb10.SelectedValue;
                PKCol10.Text = DropDownPKTb10.SelectedItem.Value.Split(' ')[1] + "." + daoObj.getPKFKColumnValue(DropDownFKTb10.SelectedItem.Text, DropDownPKTb10.SelectedItem.Text);
            }
            if (lastIndex == 11)
            {
                FKCol11.Text = DropDownFKTb11.SelectedValue;
                PKCol11.Text = DropDownPKTb11.SelectedItem.Value.Split(' ')[1] + "." + daoObj.getPKFKColumnValue(DropDownFKTb11.SelectedItem.Text, DropDownPKTb11.SelectedItem.Text);
            }
        }