private void AjaxPushSelectionToSession() { string strpayload = Request.Params["payload"]; ReportParameterContainer payload = null; DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(ReportParameterContainer)); try { payload = (ReportParameterContainer)serializer.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes(strpayload))); //v1.0.0 - Cheong - 2015/05/29 - Add code to place formula in selected fields here. //foreach (Fields f in payload.contentColumn) //{ // CUSTOMRP.Model.REPORTCOLUMN formula = this.formulaFields.Where(x => x.DISPLAYNAME == f.DisplayName).FirstOrDefault(); // if (formula != null) // { // f.Formula = formula.COLUMNCOMMENT; // } //} Session[rpexcel.strSessionKeyReportParameterContainer] = payload; AjaxShowError("OK"); } catch (Exception ex) { AjaxShowError(ex.Message); } }
protected void Page_Init(object sender, EventArgs e) { if (Session[rpexcel.strSessionKeyMyReport] != null) { myReport = (CUSTOMRP.Model.REPORT)Session[rpexcel.strSessionKeyMyReport]; } if (myReport == null) { if (!String.IsNullOrEmpty(Request.QueryString["id"])) { int id = Int32.Parse(Request.QueryString["id"]); myReport = WebHelper.bllReport.GetModel(me.ID, id); if (myReport == null) { Common.JScript.AlertAndRedirect(Code.AppNum.ErrorMsg.parameter_error, "rplist.aspx"); Response.End(); } } } if (Session[rpexcel.strSessionKeyColumnInfo] != null) { columninfos = (List <CUSTOMRP.Model.ColumnInfo>)Session[rpexcel.strSessionKeyColumnInfo]; } if (Session[rpexcel.strSessionKeyReportParameterContainer] != null) { container = (ReportParameterContainer)Session[rpexcel.strSessionKeyReportParameterContainer]; //v1.0.0 - Cheong - 2015/07/13 - Patch SEQ if (myReport != null) { foreach (CUSTOMRP.Model.REPORTCOLUMN rc in myReport.ReportColumns) { rc.SEQ = -1; } CUSTOMRP.Model.REPORTCOLUMN l_ReportColumn = null; int contentSEQ = 1; foreach (Fields f in container.contentColumn) { l_ReportColumn = myReport.ReportColumns.Where(x => x.COLUMNFUNC == 1 && x.DisplayName == f.DisplayName).FirstOrDefault(); if (l_ReportColumn != null) { l_ReportColumn.SEQ = contentSEQ; contentSEQ++; } } //v1.0.0 - Cheong - 2016/03/23 - Preserve order on criteria and group columns int criteriaSEQ = 1; foreach (Fields f in container.criteriaColumn) { l_ReportColumn = myReport.ReportColumns.Where(x => x.COLUMNFUNC == 2 && x.DisplayName == f.DisplayName).FirstOrDefault(); if (l_ReportColumn != null) { l_ReportColumn.SEQ = criteriaSEQ; criteriaSEQ++; } } int sortonSEQ = 1; foreach (Fields f in container.sortonColumn) { l_ReportColumn = myReport.ReportColumns.Where(x => x.COLUMNFUNC == 3 && x.DisplayName == f.DisplayName).FirstOrDefault(); if (l_ReportColumn != null) { l_ReportColumn.SEQ = sortonSEQ; sortonSEQ++; } } //v1.0.0 - Cheong - 2016/03/23 - Preserve order on criteria and group columns int groupSEQ = 1; foreach (Fields f in container.groupColumn) { l_ReportColumn = myReport.ReportColumns.Where(x => x.COLUMNFUNC == 6 && x.DisplayName == f.DisplayName).FirstOrDefault(); if (l_ReportColumn != null) { l_ReportColumn.SEQ = groupSEQ; groupSEQ++; } } myReport.ReportColumns.OrderBy(x => x.COLUMNFUNC).ThenBy(x => x.SEQ); } } else if (!ReportParameterContainer.LoadReport(myReport.ID, me, out container, out columninfos)) // try load default from table { Response.Redirect("rplist.aspx"); } }
protected void Page_Init(object sender, EventArgs e) { this.lblJavascript.Text = String.Empty; if (Session[rpexcel.strSessionKeyMyReport] != null) { myReport = (CUSTOMRP.Model.REPORT)Session[rpexcel.strSessionKeyMyReport]; } if (myReport == null) { string querystring = Request.UrlReferrer.Query; if (!String.IsNullOrEmpty(querystring)) { string[] queries = querystring.Substring(1).Split('&'); foreach (string query in queries) { if (query.StartsWith("id")) { int id = Int32.Parse(query.Split('=')[1]); myReport = WebHelper.bllReport.GetModel(me.ID, id); if (myReport == null) { this.lblJavascript.Text = String.Format("<script type=\"text/javascript\">alert{\"{0}\"};window.close();</script>", AppNum.ErrorMsg.parameter_error); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } Session[rpexcel.strSessionKeyMyReport] = myReport; } } } } if (Session[rpexcel.strSessionKeyColumnInfo] != null) { columninfos = (List <CUSTOMRP.Model.ColumnInfo>)Session[rpexcel.strSessionKeyColumnInfo]; } if (Session[rpexcel.strSessionKeyReportParameterContainer] != null) { container = (ReportParameterContainer)Session[rpexcel.strSessionKeyReportParameterContainer]; //v1.0.0 - Cheong - 2015/07/13 - Patch SEQ if (myReport != null) { foreach (CUSTOMRP.Model.REPORTCOLUMN rc in myReport.ReportColumns) { rc.SEQ = -1; } CUSTOMRP.Model.REPORTCOLUMN l_ReportColumn = null; int contentSEQ = 1; foreach (Fields f in container.contentColumn) { l_ReportColumn = myReport.ReportColumns.Where(x => x.COLUMNFUNC == 1 && x.DisplayName == f.DisplayName).FirstOrDefault(); if (l_ReportColumn != null) { l_ReportColumn.SEQ = contentSEQ; contentSEQ++; } } //v1.0.0 - Cheong - 2016/03/23 - Preserve order on criteria and group columns int criteriaSEQ = 1; foreach (Fields f in container.criteriaColumn) { l_ReportColumn = myReport.ReportColumns.Where(x => x.COLUMNFUNC == 2 && x.DisplayName == f.DisplayName).FirstOrDefault(); if (l_ReportColumn != null) { l_ReportColumn.SEQ = criteriaSEQ; criteriaSEQ++; } } int sortonSEQ = 1; foreach (Fields f in container.sortonColumn) { l_ReportColumn = myReport.ReportColumns.Where(x => x.COLUMNFUNC == 3 && x.DisplayName == f.DisplayName).FirstOrDefault(); if (l_ReportColumn != null) { l_ReportColumn.SEQ = sortonSEQ; sortonSEQ++; } } //v1.0.0 - Cheong - 2016/03/23 - Preserve order on criteria and group columns int groupSEQ = 1; foreach (Fields f in container.groupColumn) { l_ReportColumn = myReport.ReportColumns.Where(x => x.COLUMNFUNC == 6 && x.DisplayName == f.DisplayName).FirstOrDefault(); if (l_ReportColumn != null) { l_ReportColumn.SEQ = groupSEQ; groupSEQ++; } } myReport.ReportColumns.OrderBy(x => x.COLUMNFUNC).ThenBy(x => x.SEQ); } } else if (!ReportParameterContainer.LoadReport(myReport.ID, me, out container, out columninfos)) // try load default from table { this.lblJavascript.Text = String.Format("<script type=\"text/javascript\">alert{\"{0}\"};window.close();</script>", AppNum.ErrorMsg.parameter_error); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } }
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>(); } } }