public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rptTicketAllFilmReport rpt = new rptTicketAllFilmReport(); rpt.Site = this.Site; return(rpt); }
private void autoLoadReport(DateTime from, DateTime To) { List <totalTicketReport> totalTickets = new List <totalTicketReport>(); cinemaTicketManagerDataContext dataContext = new cinemaTicketManagerDataContext(); 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.createdDate, x => x.totalPrice, (key, g) => new { createdDate = key, total = g.ToList() }); foreach (var item1 in tickets) { totalTicketReport totalTicket = new totalTicketReport() { dateFrom = from, date = item1.createdDate, filmName = dataContext.films.FirstOrDefault(x => x.id == item.film).filmName, totalTicket = item1.total.Count, totalRevenue = item1.total.Sum(), }; totalTickets.Add(totalTicket); } } if (DateTime.Compare(from, To) == 0) { rptTicketAllFilmReport report = new rptTicketAllFilmReport(); report.SetDataSource(totalTickets); crystalReport.ReportSource = report; crystalReport.Show(); } else { rptTicketAllFilmReport_SingleDay report = new rptTicketAllFilmReport_SingleDay(); report.SetDataSource(totalTickets); crystalReport.ReportSource = report; crystalReport.Show(); } }