Пример #1
0
        private void RepairSurveyResults()
        {
            ReportConfigurations rc = new ReportConfigurations();

            rc.LoadReportsFromXml(ReportConfigurationType.User);
            if (rc.ContainsKey("SexualMedicineAssessmentSurveyResults"))
            {
                var    report     = rc.GetReportById("SexualMedicineAssessmentSurveyResults");
                string sql        = report.StoredProcedure;
                string datasetSQL = CacheManager.GetDatasetSQL(Session[SessionKey.DatasetId]);
                var    sqlParams  = new Dictionary <string, string>
                {
                    { "FromDate", FromDate.Value },
                    // System.Data.SqlTypes.SqlDateTime.MinValue.Value.ToShortDateString()
                    { "ToDate", ToDate.Value }
                    // System.Data.SqlTypes.SqlDateTime.MaxValue.Value.ToShortDateString()
                };
                AdminReportsDa da      = new AdminReportsDa();
                DataView       results = da.GetAdminReport(datasetSQL, sql, sqlParams, false).Tables[0].DefaultView;
                results.Sort = "[SurveyDate] ASC, [MRN] ASC";

                // reset counts
                totalCount     = results.Count;
                differentCount = 0;

                SurveyGrid.DataSource = results;
                SurveyGrid.DataBind();

                // set counts: should be updated on data bound
                TotalCount.Text     = totalCount.ToString();
                DifferentCount.Text = differentCount.ToString();
            }
        }
Пример #2
0
        /// <summary>
        /// Builds a list of User's recent reports.
        /// </summary>
        private void BuildUserRecentReports()
        {
            // get a list of valid reports
            var reportNames = ReportConfigurations.LoadFromXml(ReportConfigurationType.User).Keys;

            DataTable recentReports = ReportController.GetUserRecentReportViews();
            // filter list to distinct report names, with most recent entry
            var distinctReports = from report in recentReports.AsEnumerable()
                                  let reportName = report["ReportName"].ToString()
                                                   let reportDate = (DateTime)report["ExportDate"]
                                                                    orderby reportDate descending
                                                                    group report by reportName into g
                                                                    let report = g.First()
                                                                                 select new
            {
                ReportName = report["ReportName"].ToString(),
                ExportDate = (DateTime)report["ExportDate"],
                IsReport   = reportNames.Contains(report["ReportName"].ToString(), StringComparer.OrdinalIgnoreCase)
            };

            if (distinctReports.Count() > 0)
            {
                UserRecentReports.DataSource = distinctReports;
                UserRecentReports.DataBind();

                NoReportsMessage.Visible = false;
            }
        }
Пример #3
0
        /// <summary>
        /// Returns the Report Configuration associated with this Report
        /// </summary>
        /// <returns></returns>
        protected virtual ReportConfiguration GetReportConfiguration()
        {
            // load user report
            var reports = ReportConfigurations.LoadFromXml(ReportConfigurationType.User);

            return(reports.GetReportById(ReportTitle));
        }
Пример #4
0
        override protected void Page_Load(object sender, System.EventArgs e)
        {
            //Fix for problem with events disappearing in editor
            AttachEvents();
            // Put user code to initialize the page here
            base.Page_Load(sender, e);

            if (Page.IsPostBack)
            {
                createCustomPagerControls();
                ignoreDdlReportSelectedIndexChanged = false;
            }

            dgAdminReport.Visible      = false;
            lblAdminReportInfo.Visible = false;

            //ReportConfigurations must be made serializable to be put in ViewState
            //
            //            if (ViewState["reportConfigurations"]  == null)
            //            {
            //                reportConfigurations = new ReportConfigurations();
            //                reportConfigurations.LoadReportsFromXml();
            //                ViewState.Add("reportConfigurations",reportConfigurations);
            //            }
            //            else
            //            {
            //                reportConfigurations = (ReportConfigurations)ViewState["reportConfigurations"];
            //            }
            //
            //For now, load xml on every page load
            //The admin reports will probably not be oftens enough for this to be
            //a performace issue
            reportConfigurations = ReportConfigurations.LoadFromXml(ReportConfigurationType.Admin);

            SetDefaultLayout();
            BuildReportMenu();

            SetUpPaging();
            SetUpTimePeriod();

            SetReportInUse();

            //TODO BUG if a grid is loaded and combobox index changes the previous dataset i reloaded from database also when report summary is shown
            //causes a performance hit because of extra database query, but only noticable if a really large dataset has been loaded
            ShowReport(report);

            ShowReportOverview();

            ConfigureMenu();
        }
Пример #5
0
        public ReportConfiguration FindReport(string reportName)
        {
            // todo exception localizations
            if (string.IsNullOrWhiteSpace(reportName))
            {
                throw new ArgumentException("Argument is null or whitespace", nameof(reportName));
            }

            ReportConfiguration.ValidateReportName(reportName);

            // todo inner db procedure
            return
                (ReportConfigurations.FirstOrDefault(
                     configuration => configuration.ReportName.Equals(reportName)));
        }
Пример #6
0
        private void BuildReportsDropDown()
        {
            // build dorp down
            ReportConfigurations reportConfigurations = new ReportConfigurations();

            reportConfigurations.LoadReportsFromXml(ReportConfigurationType.User);

            var dropDownItems = from report in reportConfigurations.Reports
                                where report.Module.Replace(" ", "") == QueryModule
                                select report;

            ReportsRptr.DataSource = dropDownItems;
            ReportsRptr.DataBind();

            // only show drop down items if they exist
            ModuleListHolder.Visible = ShowReportDropDown;
        }
Пример #7
0
        private void BuildReports()
        {
            var reportConfig        = ReportConfigurations.LoadFromXml(ReportConfigurationType.User);
            var reports             = reportConfig.Reports;
            var categories          = reportConfig.Reports.SelectMany(r => r.Categories.Keys).Distinct();
            var categoriesToReports = from category in categories
                                      orderby category ascending
                                      select from report in reportConfig.GetReportsByCategory(category)
                                      orderby report.Title ascending
                                      select new
            {
                Category    = category,
                Title       = report.Title,
                Description = report.Description,
                IsStatic    = report.IsStatic
            };

            CategoriesRptr.DataSource = categoriesToReports.SelectMany(a => a);
            CategoriesRptr.DataBind();
        }
Пример #8
0
        /// <summary>
        /// Sets Category and binds the list of reports for current category
        /// </summary>
        /// <param name="category"></param>
        private void BuildReportsList(string category)
        {
            // load list of user reports
            ReportConfigurations config = ReportConfigurations.LoadFromXml(ReportConfigurationType.User);
            // filter list by category (deafault: all)
            IEnumerable <ReportConfiguration> filteredReports = config.Reports;

            bool hasSubCategories = false;

            // set report title and filter reports by category
            if (!string.IsNullOrEmpty(category))
            {
                // set title
                CategoryTitle.Text = category;
                // filter list by category
                filteredReports = config.GetReportsByCategory(category);

                // get a list of sub categories by current reports
                var sub_categories = ReportConfigurations.GetReportSubCategories(filteredReports);
                if (sub_categories.Count() > 0)
                {
                    hasSubCategories = true;

                    var reports_by_sub_cat = from sub_category in sub_categories
                                             let sub_cat_reports = GetFilteredReportDataSource(ReportConfigurations.GetReportsByCategoryAndSubCategory(filteredReports, category, sub_category))
                                                                   where sub_cat_reports.Count() > 0
                                                                   select new
                    {
                        SubCategory = sub_category,
                        Description = config.GetSubCategoryDescription(category, sub_category),
                        Icon        = config.GetSubCategoryIcon(category, sub_category),
                        Reports     = sub_cat_reports
                    };


                    ReportsInCategoryRptr.Visible    = true;
                    ReportsInCategoryRptr.DataSource = reports_by_sub_cat;
                    ReportsInCategoryRptr.DataBind();

                    // adjust main filtered list to those without sub categories
                    filteredReports = from report in filteredReports
                                      where report.Categories.Values.Count() == 0
                                      select report;
                }
                else
                {
                    ReportsInCategoryRptr.Visible = false;
                }
            }

            // show items with valid list
            if (filteredReports.Count() > 0)
            {
                NoReports.Visible          = false;
                ReportSelectorRptr.Visible = true;

                // bind list of reports to rptr
                ReportSelectorRptr.DataSource = GetFilteredReportDataSource(filteredReports);
                ReportSelectorRptr.DataBind();
            }
            // otherwise display no records
            else
            {
                if (!hasSubCategories)
                {
                    NoReports.Visible             = true;
                    ReportSelectorRptr.Visible    = false;
                    ReportsInCategoryRptr.Visible = false;
                }
                else
                {
                    NoReports.Visible             = false;
                    ReportSelectorRptr.Visible    = false;
                    ReportsInCategoryRptr.Visible = true;
                }
            }
        }