public ReportSource GetReportSource(DR_Requester requester, RR_ReportSourceRequest request)
        {
            var report = bizEntityReport.GetEntityReport(request.Requester, request.ReportID, false);

            if (report == null)
            {
                throw new Exception("دسترسی به گزارش به شناسه" + " " + request.ReportID + " " + "امکانپذیر نمی باشد");
            }
            if (report.SearchableReportType == ModelEntites.SearchableReportType.ListReport)
            {
                ListReportResolver listReportResolver = new ListReportResolver(requester, report.ID, request, Unit.Empty);
                return(listReportResolver.GetListReport(requester));
            }
            else if (report.SearchableReportType == ModelEntites.SearchableReportType.CrosstabReport)
            {
                CrosstabReportResolver listReportResolver = new CrosstabReportResolver(requester, report.ID, request, Unit.Empty);
                return(listReportResolver.GetCrosstabReport());
            }
            else if (report.SearchableReportType == ModelEntites.SearchableReportType.ChartReport)
            {
                var chartReport = new BizEntityChartReport().GetEntityChartReport(requester, report.ID, false);
                if (chartReport.ChartType == ModelEntites.ChartType.Column)
                {
                    ChartReportResolver chartReportResolver = new ChartReportResolver(requester, report.ID, request, Unit.Empty);
                    return(chartReportResolver.GetChartReport());
                }
                else if (chartReport.ChartType == ModelEntites.ChartType.Pie)
                {
                    PieChartReportResolver chartReportResolver = new PieChartReportResolver(requester, report.ID, request, Unit.Empty);
                    return(chartReportResolver.GetChartReport());
                }
                else if (chartReport.ChartType == ModelEntites.ChartType.Line)
                {
                    LineChartReportResolver chartReportResolver = new LineChartReportResolver(requester, report.ID, request, Unit.Empty);
                    return(chartReportResolver.GetChartReport());
                }
                else if (chartReport.ChartType == ModelEntites.ChartType.Radar)
                {
                    RadarChartReportResolver chartReportResolver = new RadarChartReportResolver(requester, report.ID, request, Unit.Empty);
                    return(chartReportResolver.GetChartReport());
                }
            }

            throw new Exception("Report type not found!");
        }
        private void SetReportDetails(DR_Requester requester, Report report, List <ColumnSizeLocation> columnsSizeLocation)
        {
            bool hasSub = ListReportReportDTO.EntityListReportSubs.Any();

            var detail = new Telerik.Reporting.DetailSection();

            detail.Height = Telerik.Reporting.Drawing.Unit.Cm(0.5);
            detail.Name   = "detail";

            ReportStyles.SetReportDetailStyle(detail.Style);
            report.Items.Add(detail);


            Panel panel = new Panel();

            panel.Width = reportWidth;
            ReportStyles.SetDetailPanelStyle(panel.Style, hasSub);
            detail.Items.Add(panel);
            //سکوریتی بروی ستوها اعمال شود
            var columns = ListReportReportDTO.EntityListView.EntityListViewAllColumns;

            int index = 0;

            foreach (var column in columns)
            {
                if (ListReportReportDTO.ReportGroups != null)
                {
                    if (ListReportReportDTO.ReportGroups.Any(x => x.ListViewColumnID == column.ID))
                    {
                        continue;
                    }
                }
                var columnTextbox = new TextBox();
                columnTextbox.CanGrow = false;

                columnTextbox.Name = column.Column.Name;
                ReportStyles.SetDetailTextboxStyle(columnTextbox.Style);
                var columnSizeLocation = columnsSizeLocation.First(x => x.LictViewColumnID == column.ID);
                columnTextbox.Width    = columnSizeLocation.Width;
                columnTextbox.Location = new PointU(columnSizeLocation.XLocation - Unit.Cm(0.0), Unit.Cm(0));
                columnTextbox.Height   = detail.Height;
                //var columnName = "";
                //if (column.RelationshipTailID == 0)
                //{
                //    columnName = column.Column.Name + "0";// + "'";

                //}
                //else
                //{

                //}
                columnTextbox.Value = string.Format("= Fields.{0}", column.RelativeColumnName);
                panel.Items.Add(columnTextbox);
                index++;
            }
            int subIndex = 0;

            foreach (var subDTO in ListReportReportDTO.EntityListReportSubs)
            {
                if (CheckSubReportIsRepeated(subDTO))
                {
                    continue;
                }
                SubReport subReport = new SubReport();
                subReport.Width = reportWidth;
                subReport.Top   = detail.Height + Unit.Cm(subIndex * 0.5);
                subIndex++;


                RR_ReportSourceRequest newrequest = new RR_ReportSourceRequest(Request.Requester);
                newrequest.Identity = Request.Identity;
                newrequest.Name     = Request.Name;
                var tail = bizEntityRelationshipTail.GetEntityRelationshipTail(requester, subDTO.EntityRelationshipTailID);
                newrequest.SearchDataItems = new DP_SearchRepository(tail.TargetEntityID);

                var entityListReport = bizEntityListReport.GetEntityListReport(requester, subDTO.EntityListReportID, true);
                newrequest.ReportID = entityListReport.ID;
                Unit SubReportWidth = reportWidth - Unit.Cm(1);
                //    var relationshipTail = bizEntityRelationshipTail.GetEntityRelationshipTail(subDTO.EntityRelationshipTailID);

                ListReportResolver listReportResolver = new ListReportResolver(entityListReport, newrequest, SubReportWidth, this, subDTO, ReportLevel + 1);
                var subListReportSource = listReportResolver.GetListReport(requester);
                subReport.ReportSource = subListReportSource;
                subReport.Left         = Unit.Cm(0.5);

                ReportStyles.SetSubreportStyle(subReport.Style);


                foreach (var relColumn in subDTO.SubsColumnsDTO)
                {
                    var parameter = new Parameter();
                    parameter.Name  = relColumn.ParentEntityListViewColumnRelativeName;
                    parameter.Value = string.Format("= Fields.{0}", relColumn.ParentEntityListViewColumnRelativeName);
                    subReport.Parameters.Add(parameter);
                }


                detail.Items.Add(subReport);
            }
        }