private void autoLoadReport(DateTime from, DateTime To, Boolean pro)
        {
            List <filmReport> totalTickets             = new List <filmReport>();
            cinemaTicketManagerDataContext dataContext = new cinemaTicketManagerDataContext();
            List <filmReport> reports = new List <filmReport>();
            var listFilms             = dataContext.calendershows.Where(x => x.showDate >= from && x.showDate <= To).GroupBy(x => x.film, x => x.id, (key, g) => new { film = key, calendar = g.ToList() });

            foreach (var item in listFilms)
            {
                var tickets = dataContext.tickets.Where(x => item.calendar.Contains(x.calenderShow) && x.createdDate >= from && x.createdDate <= To).GroupBy(x => x.calendershow1.film, x => x.totalPrice, (key, g) => new { film = key, total = g.ToList() });
                foreach (var item1 in tickets)
                {
                    filmReport film = new filmReport()
                    {
                        filmName     = dataContext.films.FirstOrDefault(x => x.id == item.film).filmName,
                        totalView    = item1.total.Count,
                        totalRevenue = item1.total.Sum()
                    };
                    totalTickets.Add(film);
                }
            }
            rptTotalFilmReport report = new rptTotalFilmReport();

            report.SetDataSource(totalTickets);
            crystalReport.ReportSource = report;
            crystalReport.Show();
        }
예제 #2
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rptTotalFilmReport rpt = new rptTotalFilmReport();

            rpt.Site = this.Site;
            return(rpt);
        }