Exemplo n.º 1
0
        private string BindFilterControl(ReportEntity re)
        {
            string retVal = String.Empty;
            if (String.IsNullOrEmpty(re.FilterControl))
                return retVal;
            string sPath = String.Format("{1}/{0}.ascx", re.FilterControl, _filterDirPath);
            Control c = null;
            try
            {
                c = Page.LoadControl(sPath);
            }
            catch{}
            if (c == null)
                return retVal;

            c.ID = "filterCtrl";
            phFilter.Controls.Add(c);
            if (c is IReportFilter)
            {
                ((IReportFilter)c).FilterChanged += new EventHandler<FilterEventArgs>(ReportView_FilterChanged);
            }
            if (!Page.IsPostBack && !String.IsNullOrEmpty(re.DefaultFilterXml))
                ((IReportFilter)c).FilterXml = re.DefaultFilterXml;
            if (!Page.IsPostBack)
                retVal = ((IReportFilter)c).FilterSql;

            return retVal;
        }
Exemplo n.º 2
0
        /// <summary>
        /// PreCreate
        /// </summary>
        /// <param name="context">The context.</param>
        protected override void PreCreate(BusinessContext context)
        {
            ReportEntity report = context.Request.Target as ReportEntity;

            if (report != null && !string.IsNullOrEmpty(report.RdlText))
            {
                SqlReport.DemandCustomSqlReportAccess();
            }

            base.PreCreate(context);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates the entity object.
        /// </summary>
        /// <param name="metaClassName">Name of the meta class.</param>
        /// <param name="primaryKeyId">The primary key id.</param>
        /// <returns></returns>
        protected override EntityObject CreateEntityObject(string metaClassName, PrimaryKeyId?primaryKeyId)
        {
            if (metaClassName == ReportEntity.GetAssignedMetaClassName())
            {
                ReportEntity retVal = new ReportEntity();
                retVal.PrimaryKeyId = primaryKeyId;
                return(retVal);
            }

            return(base.CreateEntityObject(metaClassName, primaryKeyId));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates the entity object.
        /// </summary>
        /// <param name="metaClassName">Name of the meta class.</param>
        /// <param name="primaryKeyId">The primary key id.</param>
        /// <returns></returns>
        protected override EntityObject CreateEntityObject(string metaClassName, PrimaryKeyId? primaryKeyId)
        {
            if (metaClassName == ReportEntity.GetAssignedMetaClassName())
            {
                ReportEntity retVal = new ReportEntity();
                retVal.PrimaryKeyId = primaryKeyId;
                return retVal;
            }

            return base.CreateEntityObject(metaClassName, primaryKeyId);
        }
Exemplo n.º 5
0
        private static ReportDataResponse GetReportData(Request request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            // OZ: 2008-11-26 Check Security
            if (!Security.IsUserInGroup(Security.CurrentUser.UserID, InternalSecureGroups.Administrator) &&
                !ReportManager.CanRead(request.Target.PrimaryKeyId.Value, Security.CurrentUser.UserID))
            {
                throw new AccessDeniedException();
            }

            ReportDataResponse response = null;

            string           filter    = null;
            RequestParameter parameter = request.Parameters[ReportDataRequest.FilterParameterName];

            if (parameter != null)
            {
                filter = parameter.Value as string;
            }

            ReportEntity report = request.Target as ReportEntity;

            if (report != null)
            {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(report.RdlText);

                XmlNamespaceManager namespaceManager = new XmlNamespaceManager(doc.NameTable);
                namespaceManager.AddNamespace("ns", "http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition");

                List <DataTable> data = new List <DataTable>();

                foreach (XmlNode dataSetNode in doc.SelectNodes("/ns:Report/ns:DataSets/ns:DataSet", namespaceManager))
                {
                    DataTable table = LoadDataSet(namespaceManager, dataSetNode, filter);
                    data.Add(table);
                }

                response = new ReportDataResponse(data);
            }

            return(response);
        }
Exemplo n.º 6
0
        private void BindReport(ReportEntity reportEntity, string filter)
        {
            MemoryStream memStream = new MemoryStream();
            StreamWriter writer = new StreamWriter(memStream);
            writer.Write(reportEntity.RdlText);
            writer.Flush();
            memStream.Seek(0, SeekOrigin.Begin);

            rvMain.LocalReport.LoadReportDefinition(memStream);
            rvMain.LocalReport.DisplayName = "Report";

            ReportDataResponse rdr = BusinessManager.Execute<ReportDataRequest, ReportDataResponse>(new ReportDataRequest(reportEntity, filter));
            foreach (DataTable dt in rdr.Data)
            {
                rvMain.LocalReport.DataSources.Add(new ReportDataSource(dt.TableName, dt));
            }
        }
Exemplo n.º 7
0
 public ReportDataRequest(ReportEntity report, string filter)
     : base(ReportRequestMethod.GetReportData, report)
 {
     this.Parameters.Add(new RequestParameter(FilterParameterName, filter));
 }
Exemplo n.º 8
0
 public ReportDataRequest(ReportEntity report, string filter)
     : base(ReportRequestMethod.GetReportData, report)
 {
     this.Parameters.Add(new RequestParameter(FilterParameterName, filter));
 }