コード例 #1
0
ファイル: AlertUtils.cs プロジェクト: windygu/.net-wms
        public static void SetItemValue(BenQGuru.eMES.Web.SelectQuery.SelectableTextBox stbitem, string alerttype, string alertitem)
        {
            if (alertitem == "*")
            {
                if (alerttype == AlertType_Old.First)
                {
                    stbitem.Target = "stepsequence";
                }
                else
                {
                    stbitem.Target = AlertItem_Old.Item.ToLower();
                }
            }
            else if (alertitem == AlertItem_Old.SS)
            {
                stbitem.Target = "stepsequence";
            }
            else
            {
                stbitem.Target = alertitem.ToLower();
            }

            stbitem.Type = stbitem.Target;

            stbitem.Text = string.Empty;
        }
コード例 #2
0
ファイル: FRptViewMP.aspx.cs プロジェクト: windygu/.net-wms
        private HtmlTableCell[] GenerateCell(RptViewUserSubscription userSubs, RptViewFilterUI[] filterUIList)
        {
            HtmlGenericControl title = new HtmlGenericControl();

            title.InnerText = userSubs.EAttribute1;
            HtmlTableCell cellTitle = new HtmlTableCell();

            cellTitle.NoWrap = true;
            cellTitle.Attributes.Add("class", "fieldNameLeft");
            cellTitle.Controls.Add(title);
            RptViewFilterUI filterUI = null;

            if (filterUIList != null)
            {
                for (int i = 0; i < filterUIList.Length; i++)
                {
                    if (filterUIList[i].InputType == userSubs.InputType &&
                        filterUIList[i].InputName == userSubs.InputName &&
                        filterUIList[i].SqlFilterSequence == userSubs.SqlFilterSequence)
                    {
                        filterUI = filterUIList[i];
                        break;
                    }
                }
            }

            if (rptFacade == null)
            {
                rptFacade = new ReportViewFacade(this.DataProvider);
            }
            RptViewFilterUI[] objUIs = rptFacade.GetRptViewFilterUIByReportIdAndSeq(this.ReportID, userSubs.InputName, userSubs.SqlFilterSequence);
            bool checkExist          = false;

            if (objUIs != null && objUIs.Length > 0)
            {
                foreach (RptViewFilterUI objUI in objUIs)
                {
                    if (objUI.CheckExist == "Y")
                    {
                        checkExist = true;
                        break;
                    }
                }
            }

            Control controlInput = null;

            if (filterUI == null || filterUI.UIType == ReportFilterUIType.InputText)
            {
                TextBox txt = new TextBox();
                txt.ID = "txtViewerInput_" + userSubs.InputType + "_" + userSubs.InputName + "_" + userSubs.SqlFilterSequence.ToString();
                txt.Attributes.Add("IsReportViewerInput", "1");
                txt.Attributes.Add("InputName", userSubs.InputName);
                txt.Attributes.Add("InputType", userSubs.InputType);
                txt.Attributes.Add("InputDesc", userSubs.EAttribute1);
                txt.Attributes.Add("SqlFilterSequence", userSubs.SqlFilterSequence.ToString());
                txt.Text = userSubs.InputValue;
                //Modified 2008/11/07
                if (checkExist)
                {
                    txt.CssClass = "require";
                }
                else
                {
                    txt.CssClass = "textbox";
                }

                controlInput = txt;
            }
            else if (filterUI.UIType == ReportFilterUIType.CheckBox)
            {
                CheckBox chk = new CheckBox();
                chk.ID = "txtViewerInput_" + userSubs.InputType + "_" + userSubs.InputName + "_" + userSubs.SqlFilterSequence.ToString();
                chk.Attributes.Add("IsReportViewerInput", "1");
                chk.Attributes.Add("InputName", userSubs.InputName);
                chk.Attributes.Add("InputType", userSubs.InputType);
                chk.Attributes.Add("InputDesc", userSubs.EAttribute1);
                chk.Attributes.Add("SqlFilterSequence", userSubs.SqlFilterSequence.ToString());
                chk.Checked = FormatHelper.StringToBoolean(userSubs.InputValue);
                if (checkExist)
                {
                    chk.CssClass = "require";
                }
                else
                {
                    chk.CssClass = "textbox";
                }
                controlInput = chk;
            }
            else if (filterUI.UIType == ReportFilterUIType.Date)
            {
                TextBox dateCtl = new TextBox();
                //BenQGuru.eMES.Web.UserControl.eMESDate dateCtl = (BenQGuru.eMES.Web.UserControl.eMESDate)Page.LoadControl("../UserControl/DateTime/DateTime/eMESDate.ascx");
                dateCtl.ID = "txtViewerInput_" + userSubs.InputType + "_" + userSubs.InputName + "_" + userSubs.SqlFilterSequence.ToString();
                dateCtl.Attributes.Add("IsReportViewerInput", "1");
                dateCtl.Attributes.Add("InputName", userSubs.InputName);
                dateCtl.Attributes.Add("InputType", userSubs.InputType);
                dateCtl.Attributes.Add("InputDesc", userSubs.EAttribute1);
                dateCtl.Attributes.Add("SqlFilterSequence", userSubs.SqlFilterSequence.ToString());
                dateCtl.Text = userSubs.InputValue;
                if (checkExist)
                {
                    dateCtl.CssClass = "require datepicker";
                }
                else
                {
                    dateCtl.CssClass = "textbox datepicker";
                }
                controlInput = dateCtl;
            }
            else if (filterUI.UIType == ReportFilterUIType.SelectQuery)
            {
                BenQGuru.eMES.Web.SelectQuery.SelectableTextBox txt = new BenQGuru.eMES.Web.SelectQuery.SelectableTextBox();
                txt.Type = filterUI.SelectQueryType;
                txt.ID   = "txtViewerInput_" + userSubs.InputType + "_" + userSubs.InputName + "_" + userSubs.SqlFilterSequence.ToString();
                txt.Attributes.Add("IsReportViewerInput", "1");
                txt.Attributes.Add("InputName", userSubs.InputName);
                txt.Attributes.Add("InputType", userSubs.InputType);
                txt.Attributes.Add("InputDesc", userSubs.EAttribute1);
                txt.Attributes.Add("SqlFilterSequence", userSubs.SqlFilterSequence.ToString());
                txt.Text     = userSubs.InputValue;
                txt.CanKeyIn = true;
                if (checkExist)
                {
                    txt.CssClass = "require";
                }
                else
                {
                    txt.CssClass = "textbox";
                }
                controlInput = txt;
            }
            else if (filterUI.UIType == ReportFilterUIType.DropDownList)
            {
                DropDownList drp = new DropDownList();
                drp.ID = "txtViewerInput_" + userSubs.InputType + "_" + userSubs.InputName + "_" + userSubs.SqlFilterSequence.ToString();
                drp.Attributes.Add("IsReportViewerInput", "1");
                drp.Attributes.Add("InputName", userSubs.InputName);
                drp.Attributes.Add("InputType", userSubs.InputType);
                drp.Attributes.Add("InputDesc", userSubs.EAttribute1);
                drp.Attributes.Add("SqlFilterSequence", userSubs.SqlFilterSequence.ToString());
                if (checkExist)
                {
                    drp.CssClass = "require";
                }
                else
                {
                    drp.CssClass = "textbox";
                }
                if (filterUI.ListDataSourceType == "static")
                {
                    string[] strTmpList = filterUI.ListStaticValue.Split(';');
                    for (int i = 0; i < strTmpList.Length; i++)
                    {
                        if (strTmpList[i] != "" && strTmpList[i].IndexOf(",") >= 0)
                        {
                            string[] strTmpVal = strTmpList[i].Split(',');
                            drp.Items.Add(new ListItem(strTmpVal[0], strTmpVal[1]));
                        }
                    }
                    //Add 2008/11/05 如果是必选则不需要加空格选项,否则加空格选项代表是全选
                    //if (rptFacade == null) { rptFacade = new ReportViewFacade(this.DataProvider); }
                    //RptViewFilterUI[] objUIs = rptFacade.GetRptViewFilterUIByReportIdAndSeq(this.ReportID, userSubs.InputName);
                    //if (objUIs != null && objUIs.Length > 0)
                    //{
                    //    foreach (RptViewFilterUI objUI in objUIs)
                    //    {
                    //        if (objUI.CheckExist == "N")
                    //        {
                    //            drp.Items.Insert(0,new ListItem("",""));
                    //        }
                    //    }
                    //}
                    if (!checkExist)
                    {
                        drp.Items.Insert(0, new ListItem("", ""));
                    }
                }
                else
                {
                    RptViewDataSource dataSource = (RptViewDataSource)rptFacade.GetRptViewDataSource(filterUI.ListDynamicDataSource);
                    if (dataSource != null)
                    {
                        if (filterUI.ListDynamicTextColumn == "" && filterUI.ListDynamicValueColumn != "")
                        {
                            filterUI.ListDynamicTextColumn = filterUI.ListDynamicValueColumn;
                        }
                        if (filterUI.ListDynamicValueColumn == "" && filterUI.ListDynamicTextColumn != "")
                        {
                            filterUI.ListDynamicValueColumn = filterUI.ListDynamicTextColumn;
                        }
                        DataSet ds          = rptFacade.ExecuteDataSetFromSource(dataSource, Server.MapPath("").ToString().Substring(0, Server.MapPath("").ToString().LastIndexOf("\\")));
                        string  columnName  = filterUI.ListDynamicTextColumn;
                        string  columnValue = filterUI.ListDynamicValueColumn;
                        ds.Tables[0].DefaultView.Sort = columnName;
                        for (int i = 0; i < ds.Tables[0].DefaultView.Count; i++)
                        {
                            string strOptItemText = "";
                            bool   checkRe        = false;

                            if (ds.Tables[0].DefaultView[i][columnName] != System.DBNull.Value)
                            {
                                strOptItemText = ds.Tables[0].DefaultView[i][columnName].ToString();
                            }
                            string strOptItemValue = "";
                            if (ds.Tables[0].DefaultView[i][columnValue] != System.DBNull.Value)
                            {
                                strOptItemValue = ds.Tables[0].DefaultView[i][columnValue].ToString();
                            }
                            if (drp.Items.Count > 0)
                            {
                                for (int k = 0; k < drp.Items.Count; k++)
                                {
                                    if (strOptItemValue == drp.Items[k].Value && strOptItemText == drp.Items[k].Text)
                                    {
                                        checkRe = true;
                                        break;
                                    }
                                }
                            }
                            if (!checkRe)
                            {
                                drp.Items.Add(new ListItem(strOptItemText, strOptItemValue));
                            }
                        }
                        //Add 2008/11/05 如果是必选则不需要加空格选项,否则加空格选项代表是全选
                        if (!checkExist)
                        {
                            drp.Items.Insert(0, new ListItem("", ""));
                        }
                    }
                }


                if (drp.Items.FindByValue(userSubs.InputValue) != null)
                {
                    drp.SelectedValue = userSubs.InputValue;
                }

                controlInput = drp;
            }
            //Add 2008/11/04 增加了复选框的查询
            else if (filterUI.UIType == ReportFilterUIType.SelectComplex)
            {
                BenQGuru.eMES.Web.SelectQuery.SelectableTextBox txt = new BenQGuru.eMES.Web.SelectQuery.SelectableTextBox();
                string[] strQueryType = filterUI.SelectQueryType.ToString().Split('#');
                txt.Type = strQueryType[0];

                HtmlTableRow  row      = new HtmlTableRow();
                HtmlTableCell cell     = new HtmlTableCell();
                TextBox       textBox1 = new TextBox();
                TextBox       textBox2 = new TextBox();
                TextBox       textBox3 = new TextBox();
                TextBox       textBox4 = new TextBox();

                textBox1.ID = "txtDataSource" + userSubs.SqlFilterSequence.ToString("0000");
                textBox2.ID = "txtDataType" + userSubs.SqlFilterSequence.ToString("0000");
                textBox3.ID = "txtDataCode" + userSubs.SqlFilterSequence.ToString("0000");
                textBox4.ID = "txtDataDesc" + userSubs.SqlFilterSequence.ToString("0000");


                textBox2.Text = filterUI.ListDataSourceType;
                if (filterUI.ListDataSourceType.ToString().ToUpper() != "STATIC")
                {
                    textBox3.Text = strQueryType[1];
                    textBox4.Text = strQueryType[2];
                    textBox1.Text = filterUI.ListDynamicDataSource.ToString();
                }
                else
                {
                    textBox1.Text = filterUI.ListStaticValue;
                }

                cell.Controls.Add(textBox1);
                cell.Controls.Add(textBox2);
                cell.Controls.Add(textBox3);
                cell.Controls.Add(textBox4);

                row.Cells.Add(cell);
                row.Attributes.Add("style", "display:none;");
                this.tableTextBox.Rows.Add(row);

                txt.ID = "txtViewerInput_" + userSubs.InputType + "_" + userSubs.InputName + "_" + userSubs.SqlFilterSequence.ToString("0000");
                txt.Attributes.Add("IsReportViewerInput", "1");
                txt.Attributes.Add("InputName", userSubs.InputName);
                txt.Attributes.Add("InputType", userSubs.InputType);
                txt.Attributes.Add("InputDesc", userSubs.EAttribute1);
                txt.Attributes.Add("SqlFilterSequence", userSubs.SqlFilterSequence.ToString());
                txt.Text     = userSubs.InputValue;
                txt.CanKeyIn = true;
                if (checkExist)
                {
                    txt.CssClass = "require";
                }
                else
                {
                    txt.CssClass = "textbox";
                }
                controlInput = txt;
            }

            HtmlTableCell cellValue = new HtmlTableCell();

            cellValue.NoWrap = true;
            cellValue.Attributes.Add("class", "fieldValue");
            cellValue.Style.Add("padding-right", "10px");
            cellValue.Controls.Add(controlInput);

            return(new HtmlTableCell[] { cellTitle, cellValue });
        }