Exemplo n.º 1
0
        private void FillPageHeaderUI()
        {
            this.FillddlQueryNames();

            DataTable mydtCategory = WebHelper.bllcategory.GetList(me.ID, 100000, "DATABASEID='" + me.DatabaseID + "'", "NAME").Tables[0];

            this.ddlCategory.DataSource     = mydtCategory;
            this.ddlCategory.DataTextField  = "NAME";
            this.ddlCategory.DataValueField = "ID";
            this.ddlCategory.DataBind();

            //v1.2.0 - Cheong - 2016/06/23 - Do not allow people to select report groups that they can't see
            //DataTable mydtRPGROUP = WebHelper.bllrpGroup.GetList(100000, "DATABASEID='" + me.DatabaseID + "'", "NAME").Tables[0];
            DataTable mydtRPGROUP = WebHelper.bllrpGroup.GetList(me.ID, 100000, "DATABASEID='" + me.DatabaseID + "' AND ID IN (" + me.ReportGroup + ")", "NAME").Tables[0];

            this.ddlReportGroup.DataSource     = mydtRPGROUP;
            this.ddlReportGroup.DataTextField  = "NAME";
            this.ddlReportGroup.DataValueField = "ID";
            this.ddlReportGroup.DataBind();

            CUSTOMRP.BLL.SOURCEVIEW   bllsv = new CUSTOMRP.BLL.SOURCEVIEW();
            CUSTOMRP.Model.SOURCEVIEW sv    = null;
            if (myReport != null)
            {
                sv = bllsv.GetModel(me.ID, myReport.SVID);
                this.txtReportName.Text         = myReport.REPORTNAME;
                this.txtReportTitle.Text        = myReport.RPTITLE;
                this.ddlFormat.SelectedValue    = myReport.DEFAULTFORMAT.ToString();
                this.ddlQueryName.SelectedValue = myReport.SVID.ToString();
                //v1.2.0 - Cheong - 2016/07/04 - Add option to hide duplicate items
                this.chkHideDuplicate.Checked     = myReport.fHideDuplicate;
                this.ddlCategory.SelectedValue    = myReport.CATEGORY.ToString();
                this.ddlReportGroup.SelectedValue = myReport.REPORTGROUPLIST.ToString();
                //this.ddlPrintType.SelectedValue = myReport.EXTENDFIELD.ToString().Split(',')[0].ToString();
            }

            if (this.ddlQueryName.SelectedItem != null)
            {
                int svid = this.ddlQueryNameChange();
                sv = WebHelper.bllSOURCEVIEW.GetModel(me.ID, svid);
            }
            else
            {
                this.ddlQueryName.Items.Add(new ListItem("N/A", ""));
            }
        }
Exemplo n.º 2
0
        private bool p_fSuppressRender = false;     // Whether to render page contents

        #region Event Handlers

        protected void Page_Init(object sender, EventArgs e)
        {
            if (Session[rpexcel.strSessionKeyColumnInfo] != null)
            {
                columninfos = (List <CUSTOMRP.Model.ColumnInfo>)Session[rpexcel.strSessionKeyColumnInfo];
            }

            if (Session[rpexcel.strSessionKeyFormulaFields] != null)
            {
                formulaFields = (List <CUSTOMRP.Model.REPORTCOLUMN>)Session[rpexcel.strSessionKeyFormulaFields];
            }
            else
            {
                formulaFields = new List <CUSTOMRP.Model.REPORTCOLUMN>();
                Session[rpexcel.strSessionKeyFormulaFields] = formulaFields;
            }

            if ((myReport == null) && (Session[rpexcel.strSessionKeyMyReport] != null))
            {
                myReport = (CUSTOMRP.Model.REPORT)Session[rpexcel.strSessionKeyMyReport];
            }

            if (!this.IsPostBack)
            {
                if (!String.IsNullOrEmpty(Request.QueryString["id"]))
                {
                    int id = Int32.Parse(Request.QueryString["id"]);
                    myReport = WebHelper.bllReport.GetModel(me.ID, id);

                    this.btnDelete.Visible = true;
                    if (myReport == null)
                    {
                        Common.JScript.AlertAndRedirect(AppNum.ErrorMsg.parameter_error, "rplist.aspx");
                        Response.End();
                    }
                    else
                    {
                        Session[rpexcel.strSessionKeyMyReport] = myReport;
                        CUSTOMRP.BLL.SOURCEVIEW svBLL = new CUSTOMRP.BLL.SOURCEVIEW();
                        mySV = svBLL.GetModel(me.ID, myReport.SVID);
                    }
                }
                else
                {
                    // creating new report
                    myReport    = (CUSTOMRP.Model.REPORT)Session[rpexcel.strSessionKeyMyReport];
                    columninfos = (List <CUSTOMRP.Model.ColumnInfo>)Session[rpexcel.strSessionKeyColumnInfo];
                }
            }
            else
            {
                // v1.2.0 Kim 2016.11.22 do this both IsPostBack or not
                //if ((myReport == null) && (Session[rpexcel.strSessionKeyMyReport] != null))
                //{
                //    myReport = (CUSTOMRP.Model.REPORT)Session[rpexcel.strSessionKeyMyReport];
                //}

                if (!String.IsNullOrEmpty(Request.QueryString["id"]))
                {
                    int id = Int32.Parse(Request.QueryString["id"]);

                    if (Session[rpexcel.strSessionKeyReportParameterContainer] != null)
                    {
                        ReportParameterContainer container        = (ReportParameterContainer)Session[rpexcel.strSessionKeyReportParameterContainer];
                        CUSTOMRP.Model.REPORT    rptFromContainer = container.GetReportModel(me, columninfos, id);

                        //v1.7.0 - Cheong - 2016/07/04 - Since we also need to receive setting data from rpword.aspx, instead of directly assigning
                        // report object decoded, we try to merge settings here instead.
                        #region Merge myReport data

                        if (myReport == null)
                        {
                            myReport = rptFromContainer;
                        }
                        else
                        {
                            myReport.REPORTNAME      = rptFromContainer.REPORTNAME;
                            myReport.CATEGORY        = rptFromContainer.CATEGORY;
                            myReport.REPORTGROUPLIST = rptFromContainer.REPORTGROUPLIST;
                            myReport.RPTITLE         = rptFromContainer.RPTITLE;
                            myReport.EXTENDFIELD     = rptFromContainer.EXTENDFIELD;
                        }

                        #endregion Merge myReport data
                    }
                }
            }

            if (!IsPostBack)
            {
                if (myReport != null)
                {
                    selectedColumns = myReport.ReportColumns;
                }
                else
                {
                    selectedColumns = new List <CUSTOMRP.Model.REPORTCOLUMN>();
                }
            }
        }