Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (CurrentFactoryID <= 0 || CurrentFunctionID <= 0)
            {
                FounderTecInfoSys.Common.PageGeneralAction.GoBackShowWarmingWindow("报表未找到或已经被删除");
                Response.End();
            }

            HasRight(1);

            string strURL = "about:blank";
            SQLReportTableAdapter sqlAdapter = new SQLReportTableAdapter();

            InfoSysEntity.SQLReportDataTable curTable = sqlAdapter.GetDataByID(CurrentUser.UserADAcount, Request.UserHostAddress, CurrentFunctionID);
            foreach (InfoSysEntity.SQLReportRow curRow in curTable.Rows)
            {
                strURL = curRow.SQLReportShowURL;
                if (strURL.Contains("?"))
                {
                    strURL += "&FID=" + curRow.SQLReportFactory.ToString() + "&ID=" + curRow.SQLReportID.ToString();
                }
                else
                {
                    strURL += "?FID=" + curRow.SQLReportFactory.ToString() + "&ID=" + curRow.SQLReportID.ToString();
                }
                break;
            }
            //Response.Redirect("http://pcbit-live01/ReportServer", false);
            Response.Redirect(strURL, true);
        }
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //listFootSum.Add("合计:");
            if (null == Request.UrlReferrer || (!Request.UrlReferrer.ToString().ToLower().Contains("left.aspx") && !Request.UrlReferrer.ToString().ToLower().Contains("searchcondition.aspx")))
            {
                FounderTecInfoSys.Common.PageGeneralAction.GoBackShowWarmingWindow("警告,你的操作属于非法操作!");
                Response.End();
            }
            labelField.Attributes.Add("onclick", "if(tableOfField.style.display=='none') {tableOfField.style.display='block';} else {tableOfField.style.display='none';} ");


            if (CurrentFactoryID <= 0 || CurrentFunctionID <= 0)
            {
                FounderTecInfoSys.Common.PageGeneralAction.GoBackShowWarmingWindow("报表未找到或已经被删除");
                Response.End();
            }


            #region 调试辅助系统
            if (CurrentUser.RightIsAdmin)
            {
                tableForDebugInfo.Visible = true;
            }
            else
            {
                tableForDebugInfo.Visible = false;
            }
            #endregion


            SQLReportTableAdapter sqlAdapter = new SQLReportTableAdapter();

            InfoSysEntity.SQLReportDataTable curTable = sqlAdapter.GetDataByID(CurrentUser.UserADAcount, Request.UserHostAddress, CurrentFunctionID);
            foreach (InfoSysEntity.SQLReportRow curRow in curTable.Rows)
            {
                // 权限

                if (HasRight(1))  // 特殊字段
                {
                    isShowSpecialField = true;
                }
                else
                {
                    isShowSpecialField = false;
                }

                if (HasRight(2) || HasRight(3) || curRow.SQLReportType == 2) // 导出功能
                {
                    isShowOutputButton = true;
                }
                else
                {
                    isShowOutputButton = false;
                }



                strReportName   = curRow.SQLReportName;
                labelTitle.Text = strReportName;

                if (curRow.SQLReportIsLimited == 1)
                {
                    strCommand = "select top 3000 * from ( " + curRow.SQLReportSqlCommand + " ) as tmp where 1=1 ";
                }
                else
                {
                    isLimited  = false;
                    strCommand = "select * from ( " + curRow.SQLReportSqlCommand + " ) as tmp where 1=1 ";
                }
                strWhere          = Convert.IsDBNull(curRow.SQLReportSqlWhere) ? "" : curRow.SQLReportSqlWhere;
                strOrder          = Convert.IsDBNull(curRow.SQLReportSqlOrder) ? "" : curRow.SQLReportSqlOrder;
                strSpecialField   = Convert.IsDBNull(curRow.SQLReportSpecialField) ? "" : curRow.SQLReportSpecialField;
                reportStatus      = curRow.SQLReportStatus;
                labelComment.Text = curRow.SQLReportComment;


                string strCalField = curRow.SQLReportCalculateField;

                string[] str = strCalField.Split(',');
                for (int i = 0; i < str.Length; i++)
                {
                    str[i] = str[i].Trim();
                    if (!str[i].Equals(string.Empty) && !listCalculateField.Contains(str[i]))
                    {
                        if (
                            isShowSpecialField
                            ||
                            string.IsNullOrEmpty(strSpecialField) || (!FounderTecInfoSys.Common.CommonFunction.FuncForString.isContain(strSpecialField, str[i], ','))
                            )
                        {
                            listCalculateField.Add(str[i]);
                        }
                    }
                }


                reportFuncCode = curRow.SQLReportFuncCode;

                break;
            }

            btnSaveToExcel.Visible = isShowOutputButton;


            if (listCalculateField.Count > 0)
            {
                GridView1.ShowFooter = true;
            }
            else
            {
                GridView1.ShowFooter = false;
            }

            showSearchData();
        }
    }