Ejemplo n.º 1
0
        private void GenRefValTemplate(String ExtraName)
        {
            //WebRefVal
            WebRefVal aWebRefVal = new WebRefVal();
            aWebRefVal.ID = "wrv" + FTableName + FFieldItem.DataField + ExtraName + "GridView";
            aWebRefVal.DataSourceID = FDataSourceID;
            //if (ExtraName != "F")
            aWebRefVal.DataBindingField = FFieldItem.DataField;
            if (ExtraName == "")
            {
                aWebRefVal.ReadOnly = true;
                aWebRefVal.BackColor = Color.Transparent;
                aWebRefVal.BorderStyle = System.Web.UI.WebControls.BorderStyle.None;
            }
            aWebRefVal.Width = 130;

            if (FFieldItem.RefField != null)
            {
                aWebRefVal.DataValueField = FFieldItem.RefField.ValueMember;
                aWebRefVal.DataTextField = FFieldItem.RefField.DisplayMember;
                foreach (RefColumns aColumn in FFieldItem.RefField.LookupColumns)
                {
                    WebRefColumn RC = new WebRefColumn();
                    RC.ColumnName = aColumn.Column;
                    RC.HeadText = aColumn.HeaderText;
                    aWebRefVal.Columns.Add(RC);
                }
            }
            else
            {
                InfoCommand aInfoCommand = new InfoCommand(DatabaseType);
                //aInfoCommand.Connection = WzdUtils.AllocateConnection(DatabaseName, DatabaseType, true);
                aInfoCommand.Connection = FConnection;
                IDbDataAdapter DA = DBUtils.CreateDbDataAdapter(aInfoCommand);
                DataSet aDataSet = new DataSet();
                //SYS_REFVAL
                aDataSet.Clear();
                aInfoCommand.CommandText = String.Format("Select * from SYS_REFVAL where REFVAL_NO = '{0}'", FFieldItem.RefValNo);
                WzdUtils.FillDataAdapter(FDatabaseType, DA, aDataSet, FFieldItem.RefValNo);
                aWebRefVal.DataValueField = aDataSet.Tables[0].Rows[0]["VALUE_MEMBER"].ToString();
                aWebRefVal.DataTextField = aDataSet.Tables[0].Rows[0]["DISPLAY_MEMBER"].ToString();
                //aWebRefVal.BindingValue = "'<%# + Bind(\"" + FFieldItem.DataField + "\") %>'";
                //SYS_REFVSL_D1 --> Columns
                aDataSet.Clear();
                aInfoCommand.CommandText = String.Format("Select * from SYS_REFVAL_D1 where REFVAL_NO = '{0}'", FFieldItem.RefValNo);
                WzdUtils.FillDataAdapter(FDatabaseType, DA, aDataSet, FFieldItem.RefValNo);
                foreach (DataRow DR in aDataSet.Tables[0].Rows)
                {
                    WebRefColumn RC = new WebRefColumn();
                    RC.ColumnName = DR["FIELD_NAME"].ToString();
                    RC.HeadText = DR["HEADER_TEXT"].ToString();
                    aWebRefVal.Columns.Add(RC);
                }
            }

            FContainer.Controls.Add(aWebRefVal);
            Boolean Found = false;
            foreach (WebRefVal bWebRefVal in aWebRefValList)
            {
                if (String.Compare(bWebRefVal.ID, aWebRefVal.ID) == 0)
                {
                    Found = true;
                    break;
                }
            }
            if (!Found)
                aWebRefValList.Add(aWebRefVal);

            //Add AddNewRowControlItem to WebGridView
            if (ExtraName == "F")
            {
                if (FWebGridView != null)
                {
                    Found = false;
                    foreach (AddNewRowControlItem aControlItem in FWebGridView.AddNewRowControls)
                    {
                        if (aControlItem.FieldName.CompareTo(FFieldItem.DataField) == 0)
                        {
                            Found = true;
                            break;
                        }
                    }
                    if (!Found)
                    {
                        AddNewRowControlItem aItem = new AddNewRowControlItem();
                        aItem.ControlID = "wrv" + FTableName + FFieldItem.DataField + ExtraName;
                        aItem.ControlType = WebGridView.AddNewRowControlType.RefVal;
                        aItem.FieldName = FFieldItem.DataField;
                        FWebGridView.AddNewRowControls.Add(aItem);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 取得Control对应的xml
        /// </summary>
        /// <param name="item">blockfielditem</param>
        /// <param name="tableName">tablename</param>
        /// <param name="id">控件的id</param>
        /// <returns>xml</returns>
        private string GetControlXml(TBlockFieldItem item, string tableName, ref string id)
        {
            WebControl control = null;
            PropertyInfo info = null;

            #region DropDownList
            if (string.Compare(item.ControlType, "combobox", true) == 0)
            {
                control = new WebDropDownList();
                control.ID = string.Format("{0}DropDownList", item.DataField);
                control.Width = new Unit(130, UnitType.Pixel);
                (control as WebDropDownList).DataSourceID = GenWebDataSource(item, tableName, "ComboBox", string.Empty);
                (control as WebDropDownList).DataMember = item.ComboEntityName;
                (control as WebDropDownList).DataTextField = item.ComboTextField;
                (control as WebDropDownList).DataValueField = item.ComboValueField;
                info = control.GetType().GetProperty("SelectedValue");
            }
            #endregion

            #region RefVal
            else if (string.Compare(item.ControlType, "refvalbox", true) == 0)
            {
            #warning GenWebDataSource未完成FSYS_REFVAL部分
                control = new WebRefVal();
                control.ID = string.Format("{0}RefVal", item.DataField);
                if (!string.IsNullOrEmpty(item.RefValNo) || (item.RefField != null))
                {
                    (control as WebRefVal).DataSourceID = GenWebDataSource(item, tableName, "RefVal", string.Empty);
                    (control as WebRefVal).DataBindingField = item.DataField;
                    (control as WebRefVal).DataTextField = FSYS_REFVAL.Tables[0].Rows[0]["DISPLAY_MEMBER"].ToString();
                    (control as WebRefVal).DataValueField = FSYS_REFVAL.Tables[0].Rows[0]["VALUE_MEMBER"].ToString();
                    if (!string.IsNullOrEmpty(item.RefValNo))
                    {
                        IDbConnection conn = WzdUtils.AllocateConnection(FClientData.DatabaseName, FClientData.DatabaseType, false);
                        InfoCommand command = new InfoCommand(FClientData.DatabaseType);
                        command.Connection = WzdUtils.AllocateConnection(FClientData.DatabaseName, FClientData.DatabaseType, true);
                        //command.Connection = conn;
                        command.CommandText = String.Format("Select * from SYS_REFVAL_D1 where REFVAL_NO = '{0}'", item.RefValNo);
                        IDbDataAdapter adapter = WzdUtils.AllocateDataAdapter(FClientData.DatabaseType);
                        adapter.SelectCommand = command.GetInternalCommand();
                        DataSet dataset = new DataSet();
                        WzdUtils.FillDataAdapter(FClientData.DatabaseType, adapter, dataset, item.RefValNo);
                        if (dataset != null && dataset.Tables.Count > 0 && dataset.Tables[0].Rows.Count > 0)
                        {
                            foreach (DataRow DR in dataset.Tables[0].Rows)
                            {
                                WebRefColumn refcolumn = new WebRefColumn();
                                refcolumn.ColumnName = DR["FIELD_NAME"].ToString();
                                refcolumn.HeadText = DR["HEADER_TEXT"].ToString();
                                refcolumn.Width = 100;
                                (control as WebRefVal).Columns.Add(refcolumn);
                            }
                        }
                    }
                    info = control.GetType().GetProperty("BindingValue");
                }
                else
                {
                    control = new TextBox();
                    control.ID = string.Format("{0}TextBox", item.DataField);
                    (control as TextBox).MaxLength = item.Length;
                    info = control.GetType().GetProperty("Text");
                }

            }
            #endregion

            #region DateTimePicker
            else if (string.Compare(item.ControlType, "datetimebox", true) == 0)
            {
                control = new WebDateTimePicker();
                control.ID = string.Format("{0}DateTimePicker", item.DataField);
                (control as WebDateTimePicker).MaxLength = item.Length;
                if (string.IsNullOrEmpty(item.EditMask))
                {
                    (control as WebDateTimePicker).DateFormat = dateFormat.ShortDate;
                }
                if (item.DataType == typeof(DateTime))
                {
                    info = control.GetType().GetProperty("Text");
                }
                else if (item.DataType == typeof(string))
                {
                    (control as WebDateTimePicker).DateTimeType = dateTimeType.VarChar;
                    info = control.GetType().GetProperty("DataString");
                }
            }
            #endregion

            #region ValidateBox
            else if (string.Compare(item.ControlType, "validatebox", true) == 0)
            {
                control = new WebValidateBox();
                control.ID = string.Format("{0}ValidateBox", item.DataField);
                (control as WebValidateBox).WebValidateID = string.Format("wv{0}", tableName);
                (control as WebValidateBox).ValidateField = item.DataField;
                (control as WebValidateBox).MaxLength = item.Length;
                info = control.GetType().GetProperty("Text");
            }
            #endregion

            #region CheckBox
            else if (string.Compare(item.ControlType, "checkbox", true) == 0)
            {
                control = new CheckBox();
                control.ID = string.Format("{0}CheckBox", item.DataField);
                info = control.GetType().GetProperty("Checked");
            }
            #endregion

            #region TextBox
            else
            {
                control = new TextBox();
                control.ID = string.Format("{0}TextBox", item.DataField);
                (control as TextBox).MaxLength = item.Length;
                info = control.GetType().GetProperty("Text");
            }
            #endregion

            control.ID = string.Format("{0}{1}", control.ID, id);
            id = control.ID;
            item.EditMask = FormatEditMask(item.EditMask);
            return GetControlXml(control, info, item.DataField, item.EditMask);
        }
Ejemplo n.º 3
0
    private void InitializeQueryConditionItem()
    {
        labels = new Label[columnNum];
        dropDownlists = new WebDropDownList[columnNum];
        textBoxes = new TextBox[columnNum];
        checkBoxes = new CheckBox[columnNum];
        webRefVals = new WebRefVal[columnNum];
        webRefButtons = new WebRefButton[columnNum];
        webDateTimePickers = new WebDateTimePicker[columnNum];

        TableRow[] trQuery = new TableRow[columnNum];
        int intRowCount = 0;
        int cmdIndex = 0;
        trQuery[0] = new TableRow();

        table.HorizontalAlign = HorizontalAlign.Center;

        for (int i = 0; i < columnNum; i++)
        {
            TableCell tcLabel = new TableCell();
            TableCell tcQueryText = new TableCell();
            tcLabel.HorizontalAlign = HorizontalAlign.Right;
            tcLabel.VerticalAlign = VerticalAlign.Middle;
            tcQueryText.HorizontalAlign = HorizontalAlign.Left;
            tcQueryText.VerticalAlign = VerticalAlign.Middle;

            //create captionlabel
            labels[i] = new Label();
            labels[i].ID = "lbl" + i.ToString() + arrColumn[i];
            labels[i].Text = arrCaption[i];
            labels[i].ForeColor = forecolor;
            SetTextFont(labels[i].Font);
            tcLabel.Controls.Add(labels[i]);

            //create querytext
            switch (arrColumnType[i])
            {
                case "ClientQueryComboBoxColumn":
                    {
                        dropDownlists[i] = new WebDropDownList();

                        dropDownlists[i].ID = "ddl" + i.ToString();
                        dropDownlists[i].Width = Unit.Pixel(int.Parse(arrTextWidth[i]));
                        dropDownlists[i].ForeColor = textcolor;

                        int dsidnum = lstDataSetID.IndexOf(arrRefValDSID[i]);
                        if (dsidnum >= 0)
                        {
                            dropDownlists[i].DataSourceID = "refvalds" + dsidnum.ToString();
                            if (arrRefValWhereItem[i] != "")
                            {
                                string filter = WhereItemToFileter(arrRefValWhereItem[i], "refvalds" + dsidnum.ToString());
                                (this.FindControl("refvalds" + dsidnum.ToString()) as WebDataSource).SetWhere(filter);
                            }
                        }
                        else
                        {
                            refValDateSourcecmd[cmdIndex] = new WebDataSource();
                            refValDateSourcecmd[cmdIndex].SelectAlias = arrRefValAlias[i];
                            refValDateSourcecmd[cmdIndex].SelectCommand = arrRefValCMD[i];
                            refValDateSourcecmd[cmdIndex].ID = "refvalcmd" + cmdIndex.ToString();
                            this.Form.Controls.Add(refValDateSourcecmd[cmdIndex]);
                            dropDownlists[i].DataSourceID = "refvalcmd" + cmdIndex.ToString();
                            cmdIndex++;
                        }
                        dropDownlists[i].DataTextField = arrRefValTF[i];
                        dropDownlists[i].DataValueField = arrRefValVF[i];
                        dropDownlists[i].AppendDataBoundItems = true;
                        dropDownlists[i].AutoInsertEmptyData = true;
                        SetTextFont(dropDownlists[i].Font);

                        if (string.Compare(keepcondition, "true", true) == 0)//IgnoreCase
                        {
                            if (arrText[i] != "")
                            {
                                dropDownlists[i].SelectedValue = arrText[i];
                            }
                        }
                        else
                        {
                            try
                            {
                                if (arrDefaultValue[i] != "")
                                {
                                    dropDownlists[i].SelectedValue = arrDefaultValue[i];
                                }
                            }
                            catch
                            { }
                        }

                        tcQueryText.Controls.Add(dropDownlists[i]);
                        break;
                    }
                case "ClientQueryTextBoxColumn":
                    {
                        textBoxes[i] = new TextBox();
                        textBoxes[i].ID = "txt" + i.ToString();
                        textBoxes[i].Width = Unit.Pixel(int.Parse(arrTextWidth[i]));
                        textBoxes[i].ForeColor = textcolor;
                        SetTextFont(textBoxes[i].Font);

                        if (string.Compare(keepcondition, "true", true) == 0)//IgnoreCase
                        {
                            textBoxes[i].Text = arrText[i];
                        }
                        else
                        {
                            textBoxes[i].Text = arrDefaultValue[i];
                        }

                        tcQueryText.Controls.Add(textBoxes[i]);
                        break;
                    }
                case "ClientQueryCheckBoxColumn":
                    {
                        checkBoxes[i] = new CheckBox();
                        checkBoxes[i].ID = "txt" + i.ToString();
                        checkBoxes[i].Text = string.Empty;
                        checkBoxes[i].Width = Unit.Pixel(int.Parse(arrTextWidth[i]));
                        if (string.Compare(keepcondition, "true", true) == 0)//IgnoreCase
                        {
                            if (arrText[i] != "")
                            {
                                checkBoxes[i].Checked = Convert.ToBoolean(arrText[i]);
                            }
                        }
                        else
                        {
                            if (string.Compare(arrDefaultValue[i].Trim(), "true", true) == 0 || string.Compare(arrDefaultValue[i].Trim(), "1") == 0)
                            {
                                checkBoxes[i].Checked = true;
                            }
                            else
                            {
                                checkBoxes[i].Checked = false;
                            }
                        }
                        tcQueryText.Controls.Add(checkBoxes[i]);
                        break;
                    }
                case "ClientQueryRefValColumn":
                    {
                        webRefVals[i] = new WebRefVal();
                        webRefVals[i].ID = "wrf" + i.ToString();
                        webRefVals[i].Width = Unit.Pixel(int.Parse(arrTextWidth[i]));
                        webRefVals[i].ForeColor = textcolor;
                        SetTextFont(webRefVals[i].Font);

                        int dsidnum = lstDataSetID.IndexOf(arrRefValDSID[i]);
                        if (dsidnum >= 0)
                        {
                            webRefVals[i].DataSourceID = "refvalds" + dsidnum.ToString();

                            webRefVals[i].ResxDataSet = arrRefValDSID[i];
                            webRefVals[i].ResxFilePath = psyPagePath + ".vi-VN.resx";
                        }
                        else
                        {
                            refValDateSourcecmd[cmdIndex] = new WebDataSource();
                            refValDateSourcecmd[cmdIndex].SelectAlias = arrRefValAlias[i];
                            refValDateSourcecmd[cmdIndex].SelectCommand = arrRefValCMD[i];
                            refValDateSourcecmd[cmdIndex].ID = "refvalcmd" + cmdIndex.ToString();
                            this.Form.Controls.Add(refValDateSourcecmd[cmdIndex]);
                            webRefVals[i].DataSourceID = "refvalcmd" + cmdIndex.ToString();
                            cmdIndex++;
                        }
                        webRefVals[i].DataTextField = arrRefValTF[i];
                        webRefVals[i].DataValueField = arrRefValVF[i];
                        webRefVals[i].CheckData = Convert.ToBoolean(arrRefValCD[i]);

                        string[] arrsize = arrRefValSize[i].Split(',');
                        if (arrsize.Length == 4)
                        {
                            webRefVals[i].OpenRefHeight = int.Parse(arrsize[0]);
                            webRefVals[i].OpenRefLeft = int.Parse(arrsize[1]);
                            webRefVals[i].OpenRefTop = int.Parse(arrsize[2]);
                            webRefVals[i].OpenRefWidth = int.Parse(arrsize[3]);
                        }

                        #region Add WebRefval other properties
                        if (arrRefValColumnMatch[i] != string.Empty)
                        {
                            string[] columnmatch = arrRefValColumnMatch[i].Split(':');
                            WebColumnMatch[] wcm = new WebColumnMatch[columnmatch.Length];
                            for (int j = 0; j < columnmatch.Length; j++)
                            {
                                string[] columnmatchcontext = columnmatch[j].Split(',');
                                wcm[j] = new WebColumnMatch(columnmatchcontext[1], columnmatchcontext[2], columnmatchcontext[0]);
                                webRefVals[i].ColumnMatch.Add(wcm[j]);
                            }
                        }
                        if (arrRefValColumns[i] != string.Empty)
                        {
                            string[] columns = arrRefValColumns[i].Split(':');
                            WebRefColumn[] wrc = new WebRefColumn[columns.Length];
                            for (int j = 0; j < columns.Length; j++)
                            {
                                string[] columnscontext = columns[j].Split(',');
                                wrc[j] = new WebRefColumn(columnscontext[0], columnscontext[1], int.Parse(columnscontext[2]));
                                if (columnscontext.Length >= 4)
                                {
                                    wrc[j].IsNvarChar = bool.Parse(columnscontext[3]);
                                }
                                webRefVals[i].Columns.Add(wrc[j]);
                            }
                        }
                        if (arrRefValWhereItem[i] != string.Empty)
                        {
                            string[] whereitem = arrRefValWhereItem[i].Split(':');
                            WebWhereItem[] wwi = new WebWhereItem[whereitem.Length];
                            for (int j = 0; j < whereitem.Length; j++)
                            {
                                string[] whereitemcontext = whereitem[j].Split(',');
                                wwi[j] = new WebWhereItem(whereitemcontext[1], whereitemcontext[0], whereitemcontext[2]);
                                webRefVals[i].WhereItem.Add(wwi[j]);
                            }
                        }
                        #endregion

                        if (string.Compare(keepcondition, "true", true) == 0)//IgnoreCase
                        {
                            if (arrText[i] != "")
                            {
                                webRefVals[i].BindingValue = arrText[i];
                            }
                        }
                        else
                        {
                            try
                            {
                                webRefVals[i].BindingValue = arrDefaultValue[i];
                            }
                            catch
                            { }
                        }

                        tcQueryText.Controls.Add(webRefVals[i]);
                        break;
                    }
                case "ClientQueryRefButtonColumn":
                    {
                        textBoxes[i] = new TextBox();
                        textBoxes[i].ID = "txt" + i.ToString();
                        if (string.Compare(keepcondition, "true", true) == 0)//IgnoreCase
                        {
                            textBoxes[i].Text = arrText[i];
                        }
                        else
                        {
                            textBoxes[i].Text = arrDefaultValue[i];
                        }
                        textBoxes[i].Width = Unit.Pixel(int.Parse(arrTextWidth[i]));
                        textBoxes[i].ForeColor = textcolor;
                        SetTextFont(textBoxes[i].Font);
                        webRefButtons[i] = new WebRefButton();
                        webRefButtons[i].ID = "btn" + i.ToString();
                        webRefButtons[i].Caption = arrRefButtonCaption[i];
                        webRefButtons[i].RefURL = arrRefButtonURL[i];

                        string[] arrsize = arrRefButtonURLSize[i].Split(',');
                        if (arrsize.Length == 4)
                        {
                            webRefButtons[i].RefURLHeight = int.Parse(arrsize[0]);
                            webRefButtons[i].RefURLLeft = int.Parse(arrsize[1]);
                            webRefButtons[i].RefURLTop = int.Parse(arrsize[2]);
                            webRefButtons[i].RefURLWidth = int.Parse(arrsize[3]);
                        }

                        MatchControl mc = new MatchControl();
                        mc.ControlID = "txt" + i.ToString();
                        webRefButtons[i].MatchControls.Add(mc);
                        tcQueryText.Controls.Add(textBoxes[i]);
                        tcQueryText.Controls.Add(webRefButtons[i]);
                        break;
                    }

                case "ClientQueryCalendarColumn":
                    {
                        webDateTimePickers[i] = new WebDateTimePicker();
                        webDateTimePickers[i].ID = "wdt" + i.ToString();
                        webDateTimePickers[i].Width = Unit.Pixel(int.Parse(arrTextWidth[i]));
                        webDateTimePickers[i].ForeColor = textcolor;
                        webDateTimePickers[i].DateFormat = dateFormat.ShortDate;
                        webDateTimePickers[i].CheckDate = false;
                        SetTextFont(webDateTimePickers[i].Font);

                        if (string.Compare(keepcondition, "true", true) == 0)//IgnoreCase
                        {
                            webDateTimePickers[i].Text = arrText[i];
                        }
                        else
                        {
                            webDateTimePickers[i].Text = arrDefaultValue[i];
                        }

                        tcQueryText.Controls.Add(webDateTimePickers[i]);
                        break;
                    }
            }
            if (arrTextWidth[i] == "0")
            {
                foreach (Control ctrl in tcQueryText.Controls)
                {
                    ctrl.Visible = false;
                    Panel1.Controls.Add(ctrl);
                }
                continue;
            }

            //is newline
            if (string.Compare(arrNewLine[i], "true", true) == 0)//IgnoreCase
            {
                if (trQuery[intRowCount].Cells.Count > 0)
                {
                    table.Controls.Add(trQuery[intRowCount]);
                    TableRow trEmpty = new TableRow();
                    trEmpty.Height = Unit.Pixel(gapvertical);
                    table.Controls.Add(trEmpty);
                    intRowCount++;
                    trQuery[intRowCount] = new TableRow();
                }

                trQuery[intRowCount].Cells.Add(tcLabel);
                trQuery[intRowCount].Cells.Add(tcQueryText);
            }
            else
            {
                if (trQuery[intRowCount].Cells.Count > 0)
                {
                    TableCell tcEmpty = new TableCell();
                    tcEmpty.Width = Unit.Pixel(gaphorizontal);
                    trQuery[intRowCount].Cells.Add(tcEmpty);
                }
                trQuery[intRowCount].Cells.Add(tcLabel);
                trQuery[intRowCount].Cells.Add(tcQueryText);
            }
        }

        table.Controls.Add(trQuery[intRowCount]);
        TableRow trEmptylast = new TableRow();
        trEmptylast.Height = 15;
        table.Controls.Add(trEmptylast);

        this.Panel1.Controls.Add(table);

        Table tableBtn = new Table();
        TableRow trBtn = new TableRow();
        TableCell tcBtnOk = new TableCell();
        TableCell tcBtnCancel = new TableCell();

        tableBtn.CellSpacing = 15;
        tableBtn.HorizontalAlign = HorizontalAlign.Center;

        String message = SysMsg.GetSystemMessage(CliUtils.fClientLang,
                                  "Srvtools",
                                  "WebNavigator",
                                  "ButtonName", true);
        string[] strbuttons = message.Split(';');

        Button btnOK = new Button();
        btnOK.ID = "btnOK";
        //btnOK.Width = 65;
        btnOK.Text = strbuttons[0];
        btnOK.Click += new EventHandler(btnOK_Click);
        tcBtnOk.HorizontalAlign = HorizontalAlign.Right;
        tcBtnOk.Controls.Add(btnOK);

        Button btnCancel = new Button();
        btnCancel.ID = "btnCancel";
        //btnCancel.Width = 65;
        btnCancel.Text = strbuttons[1];
        btnCancel.Click += new EventHandler(btnCancel_Click);
        tcBtnCancel.HorizontalAlign = HorizontalAlign.Left;
        tcBtnCancel.Controls.Add(btnCancel);
        //2009/09/09 modify by eva 無論是否為VS2008還是VS2005都可以套用Css
        //if (ConfigurationManager.AppSettings["VS90"] != null && string.Compare(ConfigurationManager.AppSettings["VS90"], "true", true) == 0)//IgnoreCase
        //{
        btnOK.CssClass = "btn_mouseout";
        btnOK.Attributes.Add("onmouseout", "this.className='btn_mouseout';");
        btnOK.Attributes.Add("onmouseover", "this.className='btn_mouseover';");
        btnCancel.CssClass = "btn_mouseout";
        btnCancel.Attributes.Add("onmouseout", "this.className='btn_mouseout';");
        btnCancel.Attributes.Add("onmouseover", "this.className='btn_mouseover';");
        //}
        //End Modify
        tcBtnCancel.HorizontalAlign = HorizontalAlign.Left;
        tcBtnCancel.Controls.Add(btnCancel);

        trBtn.Cells.Add(tcBtnOk);
        trBtn.Cells.Add(tcBtnCancel);
        tableBtn.Controls.Add(trBtn);

        this.Panel1.Controls.Add(tableBtn);
    }
Ejemplo n.º 4
0
    private void IntialEditItem()
    {
        int columnNum = arrEditColumn.Length;
        labels = new Label[columnNum];
        dropDownlists = new DropDownList[columnNum];
        textBoxes = new TextBox[columnNum];
        webRefVals = new WebRefVal[columnNum];
        webDateTimePickers = new WebDateTimePicker[columnNum];
        TableRow[] trText= new TableRow[columnNum];
        int cmdIndex = 0;

        for (int i = 0; i < columnNum; i++)
        {
            TableCell tcLabel = new TableCell();
            TableCell tcText = new TableCell();
            tcLabel.HorizontalAlign = HorizontalAlign.Center;
            tcLabel.VerticalAlign = VerticalAlign.Top;
            tcText.HorizontalAlign = HorizontalAlign.Left;
            tcText.VerticalAlign = VerticalAlign.Top;

            //create captionlabel
            labels[i] = new Label();
            labels[i].ID = "lbl" + i.ToString();
            labels[i].Width = 48;
            labels[i].Text = arrEditCation[i];
            tcLabel.Controls.Add(labels[i]);
            switch (arrEditColumnType[i])
            {
                case "TextBoxColumn":
                    {
                        textBoxes[i] = new TextBox();
                        textBoxes[i].ID = "txt" + i.ToString();
                        textBoxes[i].Width = 112;
                        if (string.Compare(strMode, "update", true) == 0)//IgnoreCase
                        {
                            textBoxes[i].Text = GetText(arrEditColumn[i]);
                        }
                        else
                        {
                            textBoxes[i].Text = arrDefaultValue[i];
                        }
                        tcText.Controls.Add(textBoxes[i]);
                        break;

                    }

                case "ComboBoxColumn":
                    {
                        dropDownlists[i] = new DropDownList();
                        dropDownlists[i].ID = "txt" + i.ToString();
                        dropDownlists[i].Width = 112;
                        int dsidnum = lstDataSetID.IndexOf(arrRefValDSID[i]);
                        if (dsidnum >= 0)
                        {
                            dropDownlists[i].DataSourceID = "refvalds" + dsidnum.ToString();
                        }
                        else
                        {
                            refValDateSourcecmd[cmdIndex] = new WebDataSource();
                            refValDateSourcecmd[cmdIndex].SelectAlias = arrRefValAlias[i];
                            refValDateSourcecmd[cmdIndex].SelectCommand = arrRefValCMD[i];
                            refValDateSourcecmd[cmdIndex].ID = "refvalcmd" + cmdIndex.ToString();
                            this.Form.Controls.Add(refValDateSourcecmd[cmdIndex]);
                            dropDownlists[i].DataSourceID = "refvalcmd" + cmdIndex.ToString();
                            cmdIndex++;
                        }
                        dropDownlists[i].DataTextField = arrRefValTF[i];
                        dropDownlists[i].DataValueField = arrRefValVF[i];

                        if (string.Compare(strMode, "update", true) == 0)//IgnoreCase
                        {
                            if (GetText(arrEditColumn[i]) != "")
                            {
                                try
                                {
                                    dropDownlists[i].SelectedValue = GetText(arrEditColumn[i]);
                                }
                                catch
                                { }
                            }
                        }
                        else
                        {
                            try
                            {
                                if (arrDefaultValue[i] != "")
                                {
                                    dropDownlists[i].SelectedValue = arrDefaultValue[i];
                                }
                            }
                            catch
                            { }
                        }
                        tcText.Controls.Add(dropDownlists[i]);
                        break;
                    }
                case "RefValColumn":
                    {
                        webRefVals[i] = new WebRefVal();
                        webRefVals[i].ID = "txt" + i.ToString();
                        webRefVals[i].Width = 112;
                        int dsidnum = lstDataSetID.IndexOf(arrRefValDSID[i]);
                        if (dsidnum >= 0)
                        {
                            webRefVals[i].DataSourceID = "refvalds" + dsidnum.ToString();
                            webRefVals[i].ResxDataSet = arrRefValDSID[i];
                            webRefVals[i].ResxFilePath = psyPath + ".vi-VN.resx";
                        }
                        else
                        {
                            refValDateSourcecmd[cmdIndex] = new WebDataSource();
                            refValDateSourcecmd[cmdIndex].SelectAlias = arrRefValAlias[i];
                            refValDateSourcecmd[cmdIndex].SelectCommand = arrRefValCMD[i];
                            refValDateSourcecmd[cmdIndex].ID = "refvalcmd" + cmdIndex.ToString();
                            this.Form.Controls.Add(refValDateSourcecmd[cmdIndex]);
                            webRefVals[i].DataSourceID = "refvalcmd" + cmdIndex.ToString();
                            cmdIndex++;
                        }
                        webRefVals[i].DataTextField = arrRefValTF[i];
                        webRefVals[i].DataValueField = arrRefValVF[i];

                        #region Add WebRefval other properties
                        if (arrRefValColumnMatch[i] != string.Empty)
                        {
                            string[] columnmatch = arrRefValColumnMatch[i].Split(':');
                            WebColumnMatch[] wcm = new WebColumnMatch[columnmatch.Length];
                            for (int j = 0; j < columnmatch.Length; j++)
                            {
                                string[] columnmatchcontext = columnmatch[j].Split(',');
                                wcm[j] = new WebColumnMatch(columnmatchcontext[1], columnmatchcontext[2], columnmatchcontext[0]);
                                webRefVals[i].ColumnMatch.Add(wcm[j]);
                            }
                        }
                        if (arrRefValColumns[i] != string.Empty)
                        {
                            string[] columns = arrRefValColumns[i].Split(':');
                            WebRefColumn[] wrc = new WebRefColumn[columns.Length];
                            for (int j = 0; j < columns.Length; j++)
                            {
                                string[] columnscontext = columns[j].Split(',');
                                wrc[j] = new WebRefColumn(columnscontext[0], columnscontext[1], int.Parse(columnscontext[2]));
                                webRefVals[i].Columns.Add(wrc[j]);
                            }
                        }
                        if (arrRefValWhereItem[i] != string.Empty)
                        {
                            string[] whereitem = arrRefValWhereItem[i].Split(':');
                            WebWhereItem[] wwi = new WebWhereItem[whereitem.Length];
                            for (int j = 0; j < whereitem.Length; j++)
                            {
                                string[] whereitemcontext = whereitem[j].Split(',');
                                wwi[j] = new WebWhereItem(whereitemcontext[1], whereitemcontext[0], whereitemcontext[2]);
                                webRefVals[i].WhereItem.Add(wwi[j]);
                            }
                        }
                        #endregion

                        if (string.Compare(strMode, "update", true) == 0)//IgnoreCase
                        {
                            if (GetText(arrEditColumn[i]) != "")
                            {
                                try
                                {
                                    webRefVals[i].BindingValue = GetText(arrEditColumn[i]);
                                }
                                catch
                                { }
                            }
                        }
                        else
                        {
                            try
                            {
                                webRefVals[i].BindingValue = arrDefaultValue[i];
                            }
                            catch
                            { }

                        }

                        tcText.Controls.Add(webRefVals[i]);

                        break;
                    }
                case "CalendarColumn":
                    {
                        webDateTimePickers[i] = new WebDateTimePicker();
                        webDateTimePickers[i].ID = "txt" + i.ToString();
                        webDateTimePickers[i].DateFormat = dateFormat.ShortDate;
                        webDateTimePickers[i].Width = 112;

                        if (string.Compare(strMode, "update", true) == 0)//IgnoreCase
                        {
                            if (GetText(arrEditColumn[i]) != "")
                            {
                                try
                                {
                                    webDateTimePickers[i].Text = GetText(arrEditColumn[i]);
                                }
                                catch
                                { }
                            }
                        }
                        else
                        {
                            try
                            {
                                webDateTimePickers[i].Text = arrDefaultValue[i];
                            }
                            catch
                            { }
                        }

                        tcText.Controls.Add(webDateTimePickers[i]);

                        break;
                    }
                case "RadioButtonColumn":
                    {

                        break;
                    }
            }

            trText[i] = new TableRow();
            trText[i].Cells.Add(tcLabel);
            trText[i].Cells.Add(tcText);
            table.Controls.Add(trText[i]);

        }
        pnTreeView.Controls.Add(table);
    }
Ejemplo n.º 5
0
    private TableRow CreateColumn(int count, DataRow dr)
    {
        CheckBox cbActive = new CheckBox();
        DropDownList ddlCondition = new DropDownList();
        DropDownList ddlColumn = new DropDownList();
        DropDownList dllOperator = new DropDownList();
        TextBox tbValue1 = new TextBox();
        WebDateTimePicker wdtpValue1 = new WebDateTimePicker();
        CheckBox cbValue1 = new CheckBox();
        WebDropDownList wddlValue1 = new WebDropDownList();
        WebRefVal wrvValue1 = new WebRefVal();
        TextBox tbValue1RB = new TextBox();
        WebRefButton wrbValue1 = new WebRefButton();

        TextBox tbValue2 = new TextBox();
        WebDateTimePicker wdtpValue2 = new WebDateTimePicker();
        CheckBox cbValue2 = new CheckBox();
        WebDropDownList wddlValue2 = new WebDropDownList();
        WebRefVal wrvValue2 = new WebRefVal();
        TextBox tbValue2RB = new TextBox();
        WebRefButton wrbValue2 = new WebRefButton();

        TableRow tr = new TableRow();

        TableCell tcActive = new TableCell();
        tcActive.HorizontalAlign = HorizontalAlign.Right;
        tcActive.VerticalAlign = VerticalAlign.Middle;

        //create CheckBoxActive
        cbActive = new CheckBox();
        cbActive.ID = "Web" + count + "AnyQueryActiveCheckBox";
        if (autoDisableColumns == false && !(bool)dr["AutoSelect"])
            cbActive.Checked = false;
        else
            cbActive.Checked = (bool)dr["AutoSelect"];
        cbActive.AutoPostBack = true;
        cbActive.CheckedChanged += new EventHandler(InnerPages_frmAnyQuery_cbActive_CheckedChanged);
        tcActive.Controls.Add(cbActive);

        if (autoDisableColumns == false)
            dr["AutoSelect"] = "True";

        TableCell tcCondition = new TableCell();
        tcCondition.HorizontalAlign = HorizontalAlign.Right;
        tcCondition.VerticalAlign = VerticalAlign.Middle;

        //create ConditionDropDownList
        ddlCondition = new DropDownList();
        ddlCondition.ID = "Web" + count + "AnyQueryConditionDropDownList";
        ddlCondition.Width = 60;
        ddlCondition.Items.Add("AND");
        ddlCondition.Items.Add("OR");
        ddlCondition.Text = dr["Condition"].ToString().ToUpper();
        ddlCondition.Enabled = Convert.ToBoolean(dr["AutoSelect"]);
        tcCondition.Controls.Add(ddlCondition);

        TableCell tcColumn = new TableCell();
        tcColumn.HorizontalAlign = HorizontalAlign.Right;
        tcColumn.VerticalAlign = VerticalAlign.Middle;

        //create ColumnDropDownList
        ddlColumn = new DropDownList();
        ddlColumn.ID = "Web" + count + "AnyQuery" + dr["Column"].ToString();
        alColumn = CreateArrayListColumn();
        for (int j = 0; j < alColumn.Count; j++)
            ddlColumn.Items.Add(alColumn[j].ToString());
        if (ddlColumn.Items.Contains(new ListItem(dr["Caption"].ToString())))
            ddlColumn.Text = dr["Caption"].ToString();
        else
            ddlColumn.Text = dr["Column"].ToString();
        ddlColumn.AutoPostBack = true;
        ddlColumn.Enabled = Convert.ToBoolean(dr["AutoSelect"]);
        ddlColumn.Width = Unit.Pixel(int.Parse(dr["TextWidth"].ToString()));
        ddlColumn.SelectedIndexChanged += new EventHandler(InnerPages_frmAnyQuery_ddlColumn_SelectedIndexChanged);
        tcColumn.Controls.Add(ddlColumn);

        TableCell tcOperator = new TableCell();
        tcOperator.HorizontalAlign = HorizontalAlign.Left;
        tcOperator.VerticalAlign = VerticalAlign.Middle;

        //create OperatDropDownList
        dllOperator = new DropDownList();
        dllOperator.ID = "Web" + count + "AnyQueryOperatorDropDownList";
        ArrayList op = new ArrayList();
        op.AddRange(new String[] { "=", "!=", ">", "<", ">=", "<=", "%**", "**%", "%%", "!%%", "<->", "!<->", "IN", "NOT IN" });
        if (!this.displayAllOperator)
        {
            if (dr["DataType"].ToString() == typeof(Char).ToString() || dr["DataType"].ToString() == typeof(String).ToString())
            {
                op.Clear();
                op.AddRange(new String[] { "=", "!=", "%**", "**%", "%%", "!%%", "IN", "NOT IN" });
            }
            else if (dr["DataType"].ToString() == typeof(int).ToString() || dr["DataType"].ToString() == typeof(float).ToString()
                    || dr["DataType"].ToString() == typeof(double).ToString() || dr["DataType"].ToString() == typeof(DateTime).ToString())
            {
                op.Clear();
                op.AddRange(new String[] { "=", "!=", "<", ">", "<=", ">=", "<->", "!<->", "IN", "NOT IN" });
            }
        }
        for (int j = 0; j < op.Count; j++)
            dllOperator.Items.Add(op[j].ToString());
        if (dr["Operators"].ToString() == "%")
            dllOperator.Text = "**%";
        else
            dllOperator.Text = dr["Operators"].ToString();
        dllOperator.Width = 60;
        dllOperator.AutoPostBack = true;
        dllOperator.Enabled = Convert.ToBoolean(dr["AutoSelect"]);
        dllOperator.SelectedIndexChanged += new EventHandler(InnerPages_frmAnyQuery_dllOperator_SelectedIndexChanged);
        tcOperator.Controls.Add(dllOperator);

        TableCell tcValue1 = new TableCell();
        tcValue1.HorizontalAlign = HorizontalAlign.Left;
        tcValue1.VerticalAlign = VerticalAlign.Middle;

        //create Value
        int dsidnum;
        switch (dr["ColumnType"].ToString())
        {
            case "AnyQueryTextBoxColumn":
                tbValue1 = new TextBox();
                tbValue1.ID = "Web" + count + "AnyQueryValue1TextBox" + dr["Enabled"].ToString();
                tbValue1.Text = dr["DefaultValue"].ToString();
                tbValue1.Width = Unit.Pixel(int.Parse(dr["TextWidth"].ToString()));
                if (Convert.ToBoolean(dr["Enabled"].ToString()) == false)
                    tbValue1.Enabled = Convert.ToBoolean(dr["Enabled"].ToString());
                else
                    tbValue1.Enabled = Convert.ToBoolean(dr["AutoSelect"]);
                tcValue1.Controls.Add(tbValue1);
                break;
            case "AnyQueryComboBoxColumn":
                wddlValue1 = new WebDropDownList();
                wddlValue1.ID = "Web" + count + "AnyQueryValue1WebDropDownList" + dr["Enabled"].ToString();
                wddlValue1.Width = Unit.Pixel(int.Parse(dr["TextWidth"].ToString()));
                if (Convert.ToBoolean(dr["Enabled"].ToString()) == false)
                    wddlValue1.Enabled = Convert.ToBoolean(dr["Enabled"].ToString());
                else
                    wddlValue1.Enabled = Convert.ToBoolean(dr["AutoSelect"]);

                dsidnum = lstDataSetID.IndexOf(dr["RefValDSID"].ToString());
                if (dsidnum >= 0)
                {
                    wddlValue1.DataSourceID = "refvalds" + dsidnum.ToString();
                    if (dr["RefValWhereItem"].ToString() != "")
                    {
                        string filter = WhereItemToFileter(dr["RefValWhereItem"].ToString(), "refvalds" + dsidnum.ToString());
                        (this.FindControl("refvalds" + dsidnum.ToString()) as WebDataSource).SetWhere(filter);
                    }
                    wddlValue1.DataTextField = dr["RefValTF"].ToString();
                    wddlValue1.DataValueField = dr["RefValVF"].ToString();
                    wddlValue1.AppendDataBoundItems = true;
                    wddlValue1.AutoInsertEmptyData = true;
                }
                else if (dr["RefValAlias"].ToString() != String.Empty && dr["RefValCMD"].ToString() != String.Empty)
                {
                    refValDateSourcecmd[cmdIndex] = new WebDataSource();
                    refValDateSourcecmd[cmdIndex].SelectAlias = dr["RefValAlias"].ToString();
                    refValDateSourcecmd[cmdIndex].SelectCommand = dr["RefValCMD"].ToString();
                    refValDateSourcecmd[cmdIndex].ID = "refvalcmd" + cmdIndex.ToString();
                    this.Form.Controls.Add(refValDateSourcecmd[cmdIndex]);
                    wddlValue1.DataSourceID = "refvalcmd" + cmdIndex.ToString();
                    cmdIndex++;
                    wddlValue1.DataTextField = dr["RefValTF"].ToString();
                    wddlValue1.DataValueField = dr["RefValVF"].ToString();
                    wddlValue1.AppendDataBoundItems = true;
                    wddlValue1.AutoInsertEmptyData = true;
                }
                else
                {
                    //String[] item = arrItems.Split('!');
                    //foreach (String temp in item)
                    //    wddlValue1.Items.Add(temp);
                }

                if (string.Compare(keepcondition, "true", true) == 0)//IgnoreCase
                {
                    if (dr["Text"].ToString() != "")
                    {
                        wddlValue1.SelectedValue = dr["Text"].ToString();
                    }
                }
                else
                {
                    try
                    {
                        if (dr["DefaultValue"].ToString() != "")
                        {
                            wddlValue1.SelectedValue = dr["DefaultValue"].ToString();
                        }
                    }
                    catch
                    { }
                }
                tcValue1.Controls.Add(wddlValue1);
                break;
            case "AnyQueryCheckBoxColumn":
                cbValue1 = new CheckBox();
                cbValue1.ID = "Web" + count + "AnyQueryValue1CheckBox" + dr["Enabled"].ToString();
                if (dr["DefaultValue"].ToString() == "1")
                    cbValue1.Checked = true;
                cbValue1.Width = Unit.Pixel(int.Parse(dr["TextWidth"].ToString()));
                if (Convert.ToBoolean(dr["Enabled"].ToString()) == false)
                    cbValue1.Enabled = Convert.ToBoolean(dr["Enabled"].ToString());
                else
                    cbValue1.Enabled = Convert.ToBoolean(dr["AutoSelect"]);
                tcValue1.Controls.Add(cbValue1);
                break;
            case "AnyQueryRefValColumn":
                wrvValue1 = new WebRefVal();
                wrvValue1.ID = "Web" + count + "AnyQueryValue1RefVal" + dr["Enabled"].ToString();
                wrvValue1.Width = Unit.Pixel(int.Parse(dr["TextWidth"].ToString()));

                dsidnum = lstDataSetID.IndexOf(dr["RefValDSID"].ToString());
                if (dsidnum >= 0)
                {
                    wrvValue1.DataSourceID = "refvalds" + dsidnum.ToString();

                    wrvValue1.ResxDataSet = dr["RefValDSID"].ToString();
                    wrvValue1.ResxFilePath = psyPagePath + ".vi-VN.resx";
                }
                else
                {
                    int refCount = cmdIndex;
                    for (int i = 0; i < refValDateSourcecmd.Length; i++)
                    {
                        if (refValDateSourcecmd[i] != null)
                        {
                            if (refValDateSourcecmd[i].SelectAlias == dr["RefValAlias"].ToString()
                            && refValDateSourcecmd[i].SelectCommand == dr["RefValCMD"].ToString()
                            && refValDateSourcecmd[i].ID == "refvalcmd" + i.ToString())
                            {
                                refCount = i;
                                break;
                            }
                        }
                    }

                    refValDateSourcecmd[refCount] = new WebDataSource();
                    refValDateSourcecmd[refCount].SelectAlias = dr["RefValAlias"].ToString();
                    refValDateSourcecmd[refCount].SelectCommand = dr["RefValCMD"].ToString();
                    refValDateSourcecmd[refCount].ID = "refvalcmd" + refCount.ToString();
                    object obj = this.Form.FindControl(refValDateSourcecmd[refCount].ID);
                    if (obj == null)
                        this.Form.Controls.Add(refValDateSourcecmd[refCount]);
                    wrvValue1.DataSourceID = "refvalcmd" + refCount.ToString();
                    cmdIndex++;
                }
                wrvValue1.DataTextField = dr["RefValTF"].ToString();
                wrvValue1.DataValueField = dr["RefValVF"].ToString();
                wrvValue1.CheckData = Convert.ToBoolean(dr["RefValCD"].ToString());

                string[] aSize = dr["RefValSize"].ToString().Split(',');
                if (aSize.Length == 4)
                {
                    wrvValue1.OpenRefHeight = int.Parse(aSize[0]);
                    wrvValue1.OpenRefLeft = int.Parse(aSize[1]);
                    wrvValue1.OpenRefTop = int.Parse(aSize[2]);
                    wrvValue1.OpenRefWidth = int.Parse(aSize[3]);
                }

                #region Add WebRefval other properties
                if (dr["RefValColumnMatch"].ToString() != string.Empty)
                {
                    string[] columnmatch = dr["RefValColumnMatch"].ToString().Split(':');
                    WebColumnMatch[] wcm = new WebColumnMatch[columnmatch.Length];
                    for (int j = 0; j < columnmatch.Length; j++)
                    {
                        string[] columnmatchcontext = columnmatch[j].Split(',');
                        wcm[j] = new WebColumnMatch(columnmatchcontext[1], columnmatchcontext[2], columnmatchcontext[0]);
                        wrvValue1.ColumnMatch.Add(wcm[j]);
                    }
                }
                if (dr["RefValColumns"].ToString() != string.Empty)
                {
                    string[] columns = dr["RefValColumns"].ToString().Split(':');
                    WebRefColumn[] wrc = new WebRefColumn[columns.Length];
                    for (int j = 0; j < columns.Length; j++)
                    {
                        string[] columnscontext = columns[j].Split(',');
                        wrc[j] = new WebRefColumn(columnscontext[0], columnscontext[1], int.Parse(columnscontext[2]));
                        wrvValue1.Columns.Add(wrc[j]);
                    }
                }
                if (dr["RefValWhereItem"].ToString() != string.Empty)
                {
                    string[] whereitem = dr["RefValWhereItem"].ToString().Split(':');
                    WebWhereItem[] wwi = new WebWhereItem[whereitem.Length];
                    for (int j = 0; j < whereitem.Length; j++)
                    {
                        string[] whereitemcontext = whereitem[j].Split(',');
                        wwi[j] = new WebWhereItem(whereitemcontext[1], whereitemcontext[0], whereitemcontext[2]);
                        wrvValue1.WhereItem.Add(wwi[j]);
                    }
                }
                #endregion

                if (string.Compare(keepcondition, "true", true) == 0)//IgnoreCase
                {
                    if (dr["Text"].ToString() != "")
                    {
                        wrvValue1.BindingValue = dr["Text"].ToString();
                    }
                }
                else
                {
                    try
                    {
                        wrvValue1.BindingValue = dr["DefaultValue"].ToString();
                    }
                    catch
                    { }
                }
                if (Convert.ToBoolean(dr["Enabled"].ToString()) == false)
                    wrvValue1.ReadOnly = !Convert.ToBoolean(dr["Enabled"].ToString());
                else
                    wrvValue1.ReadOnly = !Convert.ToBoolean(dr["AutoSelect"]);
                tcValue1.Controls.Add(wrvValue1);
                break;
            case "AnyQueryCalendarColumn":
                wdtpValue1 = new WebDateTimePicker();
                wdtpValue1.ID = "Web" + count + "AnyQueryValue1WebDateTimePicker" + dr["Enabled"].ToString();
                wdtpValue1.Text = dr["DefaultValue"].ToString();
                wdtpValue1.Width = Unit.Pixel(int.Parse(dr["TextWidth"].ToString()));
                wdtpValue1.CheckDate = false;
                wdtpValue1.DateFormat = dateFormat.ShortDate;
                if (Convert.ToBoolean(dr["Enabled"].ToString()) == false)
                    wdtpValue1.Enabled = Convert.ToBoolean(dr["Enabled"].ToString());
                else
                    wdtpValue1.Enabled = Convert.ToBoolean(dr["AutoSelect"]);

                tcValue1.Controls.Add(wdtpValue1);
                break;
            case "AnyQueryRefButtonColumn":
                tbValue1RB.ID = "Web" + count + "AnyQueryValue1WebRefButtonTextBox" + dr["Enabled"].ToString();
                tbValue1RB.Text = dr["DefaultValue"].ToString();
                tbValue1RB.Width = Unit.Pixel(int.Parse(dr["TextWidth"].ToString()));
                if (Convert.ToBoolean(dr["Enabled"].ToString()) == false)
                    tbValue1RB.Enabled = Convert.ToBoolean(dr["Enabled"].ToString());
                else
                    tbValue1RB.Enabled = Convert.ToBoolean(dr["AutoSelect"]);

                wrbValue1.ID = "Web" + count + "AnyQueryValue1WebRefButton" + dr["Enabled"].ToString();
                wrbValue1.Caption = dr["RefButtonCaption"].ToString();
                wrbValue1.RefURL = dr["RefButtonURL"].ToString();
                if (Convert.ToBoolean(dr["Enabled"].ToString()) == false)
                    wrbValue1.Visible = Convert.ToBoolean(dr["Enabled"].ToString());
                else
                    wrbValue1.Visible = Convert.ToBoolean(dr["AutoSelect"]);

                string[] arrsize = dr["RefButtonURLSize"].ToString().Split(',');
                if (arrsize.Length == 4)
                {
                    wrbValue1.RefURLHeight = int.Parse(arrsize[0]);
                    wrbValue1.RefURLLeft = int.Parse(arrsize[1]);
                    wrbValue1.RefURLTop = int.Parse(arrsize[2]);
                    wrbValue1.RefURLWidth = int.Parse(arrsize[3]);
                }

                MatchControl mc = new MatchControl();
                mc.ControlID = "Web" + count + "AnyQueryValue1WebRefButtonTextBox" + dr["Enabled"].ToString();
                wrbValue1.MatchControls.Add(mc);
                tcValue1.Controls.Add(tbValue1RB);
                tcValue1.Controls.Add(wrbValue1);
                break;
        }

        TableCell tcValue2 = new TableCell();
        tcValue2.HorizontalAlign = HorizontalAlign.Left;
        tcValue2.VerticalAlign = VerticalAlign.Middle;
        if (dllOperator.Text == "<->" || dllOperator.Text == "!<->")
        {
            switch (dr["ColumnType"].ToString())
            {
                case "AnyQueryTextBoxColumn":
                    tbValue2 = new TextBox();
                    tbValue2.ID = "Web" + count + "AnyQueryValue2TextBox" + dr["Enabled"].ToString();
                    tbValue2.Text = dr["DefaultValue"].ToString();
                    tbValue2.Width = Unit.Pixel(int.Parse(dr["TextWidth"].ToString()));
                    if (Convert.ToBoolean(dr["Enabled"].ToString()) == false)
                        tbValue2.Enabled = Convert.ToBoolean(dr["Enabled"].ToString());
                    else
                        tbValue2.Enabled = Convert.ToBoolean(dr["AutoSelect"]);

                    tcValue2.Controls.Add(tbValue2);
                    break;
                case "AnyQueryComboBoxColumn":
                    wddlValue2 = new WebDropDownList();
                    wddlValue2.ID = "Web" + count + "AnyQueryValue2WebDropDownList" + dr["Enabled"].ToString();
                    wddlValue2.Width = Unit.Pixel(int.Parse(dr["TextWidth"].ToString()));
                    if (Convert.ToBoolean(dr["Enabled"].ToString()) == false)
                        wddlValue2.Enabled = Convert.ToBoolean(dr["Enabled"].ToString());
                    else
                        wddlValue2.Enabled = Convert.ToBoolean(dr["AutoSelect"]);

                    dsidnum = lstDataSetID.IndexOf(dr["RefValDSID"].ToString());
                    if (dsidnum >= 0)
                    {
                        wddlValue2.DataSourceID = "refvalds" + dsidnum.ToString();
                        if (dr["RefValWhereItem"].ToString() != "")
                        {
                            string filter = WhereItemToFileter(dr["RefValWhereItem"].ToString(), "refvalds" + dsidnum.ToString());
                            (this.FindControl("refvalds" + dsidnum.ToString()) as WebDataSource).SetWhere(filter);
                        }
                        wddlValue2.DataTextField = dr["RefValTF"].ToString();
                        wddlValue2.DataValueField = dr["RefValVF"].ToString();
                        wddlValue2.AppendDataBoundItems = true;
                        wddlValue2.AutoInsertEmptyData = true;
                    }
                    else if (dr["RefValAlias"].ToString() != String.Empty && dr["RefValCMD"].ToString() != String.Empty)
                    {
                        refValDateSourcecmd[cmdIndex] = new WebDataSource();
                        refValDateSourcecmd[cmdIndex].SelectAlias = dr["RefValAlias"].ToString();
                        refValDateSourcecmd[cmdIndex].SelectCommand = dr["RefValCMD"].ToString();
                        refValDateSourcecmd[cmdIndex].ID = "refvalcmd" + cmdIndex.ToString();
                        this.Form.Controls.Add(refValDateSourcecmd[cmdIndex]);
                        wddlValue2.DataSourceID = "refvalcmd" + cmdIndex.ToString();
                        cmdIndex++;
                        wddlValue2.DataTextField = dr["RefValTF"].ToString();
                        wddlValue2.DataValueField = dr["RefValVF"].ToString();
                        wddlValue2.AppendDataBoundItems = true;
                        wddlValue2.AutoInsertEmptyData = true;
                    }
                    else
                    {
                        //String[] item = arrItems.Split('!');
                        //foreach (String temp in item)
                        //    wddlValue2.Items.Add(temp);
                    }

                    if (string.Compare(keepcondition, "true", true) == 0)//IgnoreCase
                    {
                        if (dr["Text"].ToString() != "")
                        {
                            wddlValue2.SelectedValue = dr["Text"].ToString();
                        }
                    }
                    else
                    {
                        try
                        {
                            if (dr["DefaultValue"].ToString() != "")
                            {
                                wddlValue2.SelectedValue = dr["DefaultValue"].ToString();
                            }
                        }
                        catch
                        { }
                    }
                    tcValue2.Controls.Add(wddlValue2);
                    break;
                case "AnyQueryCheckBoxColumn":
                    cbValue2 = new CheckBox();
                    cbValue2.ID = "Web" + count + "AnyQueryValue2CheckBox" + dr["Enabled"].ToString();
                    if (dr["DefaultValue"].ToString() == "1")
                        cbValue2.Checked = true;
                    cbValue2.Width = Unit.Pixel(int.Parse(dr["TextWidth"].ToString()));
                    if (Convert.ToBoolean(dr["Enabled"].ToString()) == false)
                        cbValue2.Enabled = Convert.ToBoolean(dr["Enabled"].ToString());
                    else
                        cbValue2.Enabled = Convert.ToBoolean(dr["AutoSelect"]);
                    tcValue2.Controls.Add(cbValue2);
                    break;
                case "AnyQueryRefValColumn":
                    wrvValue2 = new WebRefVal();
                    wrvValue2.ID = "Web" + count + "AnyQueryValue2RefVal" + dr["Enabled"].ToString();
                    wrvValue2.Width = Unit.Pixel(int.Parse(dr["TextWidth"].ToString()));

                    dsidnum = lstDataSetID.IndexOf(dr["RefValDSID"].ToString());
                    if (dsidnum >= 0)
                    {
                        wrvValue2.DataSourceID = "refvalds" + dsidnum.ToString();

                        wrvValue2.ResxDataSet = dr["RefValDSID"].ToString();
                        wrvValue2.ResxFilePath = psyPagePath + ".vi-VN.resx";
                    }
                    else
                    {
                        refValDateSourcecmd[cmdIndex] = new WebDataSource();
                        refValDateSourcecmd[cmdIndex].SelectAlias = dr["RefValAlias"].ToString();
                        refValDateSourcecmd[cmdIndex].SelectCommand = dr["RefValCMD"].ToString();
                        refValDateSourcecmd[cmdIndex].ID = "refvalcmd" + cmdIndex.ToString();
                        this.Form.Controls.Add(refValDateSourcecmd[cmdIndex]);
                        wrvValue2.DataSourceID = "refvalcmd" + cmdIndex.ToString();
                        cmdIndex++;
                    }
                    wrvValue2.DataTextField = dr["RefValTF"].ToString();
                    wrvValue2.DataValueField = dr["RefValVF"].ToString();
                    wrvValue2.CheckData = Convert.ToBoolean(dr["RefValCD"].ToString());

                    string[] aSize = dr["RefValSize"].ToString().Split(',');
                    if (aSize.Length == 4)
                    {
                        wrvValue2.OpenRefHeight = int.Parse(aSize[0]);
                        wrvValue2.OpenRefLeft = int.Parse(aSize[1]);
                        wrvValue2.OpenRefTop = int.Parse(aSize[2]);
                        wrvValue2.OpenRefWidth = int.Parse(aSize[3]);
                    }

                    #region Add WebRefval other properties
                    if (dr["RefValColumnMatch"].ToString() != string.Empty)
                    {
                        string[] columnmatch = dr["RefValColumnMatch"].ToString().Split(':');
                        WebColumnMatch[] wcm = new WebColumnMatch[columnmatch.Length];
                        for (int j = 0; j < columnmatch.Length; j++)
                        {
                            string[] columnmatchcontext = columnmatch[j].Split(',');
                            wcm[j] = new WebColumnMatch(columnmatchcontext[1], columnmatchcontext[2], columnmatchcontext[0]);
                            wrvValue2.ColumnMatch.Add(wcm[j]);
                        }
                    }
                    if (dr["RefValColumns"].ToString() != string.Empty)
                    {
                        string[] columns = dr["RefValColumns"].ToString().Split(':');
                        WebRefColumn[] wrc = new WebRefColumn[columns.Length];
                        for (int j = 0; j < columns.Length; j++)
                        {
                            string[] columnscontext = columns[j].Split(',');
                            wrc[j] = new WebRefColumn(columnscontext[0], columnscontext[1], int.Parse(columnscontext[2]));
                            wrvValue2.Columns.Add(wrc[j]);
                        }
                    }
                    if (dr["RefValWhereItem"].ToString() != string.Empty)
                    {
                        string[] whereitem = dr["RefValWhereItem"].ToString().Split(':');
                        WebWhereItem[] wwi = new WebWhereItem[whereitem.Length];
                        for (int j = 0; j < whereitem.Length; j++)
                        {
                            string[] whereitemcontext = whereitem[j].Split(',');
                            wwi[j] = new WebWhereItem(whereitemcontext[1], whereitemcontext[0], whereitemcontext[2]);
                            wrvValue2.WhereItem.Add(wwi[j]);
                        }
                    }
                    #endregion

                    if (string.Compare(keepcondition, "true", true) == 0)//IgnoreCase
                    {
                        if (dr["Text"].ToString() != "")
                        {
                            wrvValue2.BindingValue = dr["Text"].ToString();
                        }
                    }
                    else
                    {
                        try
                        {
                            wrvValue2.BindingValue = dr["DefaultValue"].ToString();
                        }
                        catch
                        { }
                    }
                    if (Convert.ToBoolean(dr["Enabled"].ToString()) == false)
                        wrvValue2.ReadOnly = !Convert.ToBoolean(dr["Enabled"].ToString());
                    else
                        wrvValue2.ReadOnly = !Convert.ToBoolean(dr["AutoSelect"]);
                    tcValue2.Controls.Add(wrvValue2);
                    break;
                case "AnyQueryCalendarColumn":
                    wdtpValue2 = new WebDateTimePicker();
                    wdtpValue2.ID = "Web" + count + "AnyQueryValue2WebDateTimePicker" + dr["Enabled"].ToString();
                    wdtpValue2.Text = dr["DefaultValue"].ToString();
                    wdtpValue2.Width = Unit.Pixel(int.Parse(dr["TextWidth"].ToString()));
                    wdtpValue2.DateFormat = dateFormat.ShortDate;
                    if (Convert.ToBoolean(dr["Enabled"].ToString()) == false)
                        wdtpValue2.Enabled = Convert.ToBoolean(dr["Enabled"].ToString());
                    else
                        wdtpValue2.Enabled = Convert.ToBoolean(dr["AutoSelect"]);
                    tcValue2.Controls.Add(wdtpValue2);
                    break;
                case "AnyQueryRefButtonColumn":
                    tbValue2RB.ID = "Web" + count + "AnyQueryValue2WebRefButtonTextBox" + dr["Enabled"].ToString();
                    tbValue2RB.Text = dr["DefaultValue"].ToString();
                    tbValue2RB.Width = Unit.Pixel(int.Parse(dr["TextWidth"].ToString()));
                    if (Convert.ToBoolean(dr["Enabled"].ToString()) == false)
                        tbValue2RB.Enabled = Convert.ToBoolean(dr["Enabled"].ToString());
                    else
                        tbValue2RB.Enabled = Convert.ToBoolean(dr["AutoSelect"]);

                    wrbValue2.ID = "Web" + count + "AnyQueryValue2WebRefButton" + dr["Enabled"].ToString();
                    wrbValue2.Caption = dr["RefButtonCaption"].ToString();
                    wrbValue2.RefURL = dr["RefButtonURL"].ToString();
                    if (Convert.ToBoolean(dr["Enabled"].ToString()) == false)
                        wrbValue2.Visible = Convert.ToBoolean(dr["Enabled"].ToString());
                    else
                        wrbValue2.Visible = Convert.ToBoolean(dr["AutoSelect"]);

                    string[] arrsize = dr["RefButtonURLSize"].ToString().Split(',');
                    if (arrsize.Length == 4)
                    {
                        wrbValue2.RefURLHeight = int.Parse(arrsize[0]);
                        wrbValue2.RefURLLeft = int.Parse(arrsize[1]);
                        wrbValue2.RefURLTop = int.Parse(arrsize[2]);
                        wrbValue2.RefURLWidth = int.Parse(arrsize[3]);
                    }

                    MatchControl mc = new MatchControl();
                    mc.ControlID = "Web" + count + "AnyQueryValue2WebRefButtonTextBox" + dr["Enabled"].ToString();
                    wrbValue2.MatchControls.Add(mc);
                    tcValue2.Controls.Add(tbValue2RB);
                    tcValue2.Controls.Add(wrbValue2);
                    break;
            }
        }

        tr.Cells.Add(tcActive);
        tr.Cells.Add(tcCondition);
        tr.Cells.Add(tcColumn);
        tr.Cells.Add(tcOperator);
        tr.Cells.Add(tcValue1);
        tr.Cells.Add(tcValue2);

        //if (autoDisableColumns)
        //{
        //    InnerPages_frmAnyQuery_cbActive_CheckedChanged(cbActive, new EventArgs());
        //}

        return tr;
    }