private void GenerateData(Document document, MoviesDatabaseOfTeamSingaporeSlingEntities dbContext) { var movies = dbContext.Movies .OrderBy(m => m.Name) .Select(m => new ReportMovie() { MovieName = m.Name, Description = m.Description, Duration = m.Duration, Year = m.Year, Genres = m.Genres.OrderBy(g => g.Name).ToList(), Directors = m.Employees.Where(d => d.IsDirector == true).ToList(), Actors = m.Employees.Where(a => a.IsDirector == false).ToList() }) .ToList(); PdfPTable table = new PdfPTable(7); int[] widths = new int[] { 20, 40, 20, 15, 20, 20, 25 }; table.SetWidths(widths); table.AddCell(this.CreateCell(new Phrase("Movie name"), true)); table.AddCell(this.CreateCell(new Phrase("Description"), true)); table.AddCell(this.CreateCell(new Phrase("Duration"), true)); table.AddCell(this.CreateCell(new Phrase("Year"), true)); table.AddCell(this.CreateCell(new Phrase("Genre"), true)); table.AddCell(this.CreateCell(new Phrase("Director"), true)); table.AddCell(this.CreateCell(new Phrase("Actors"), true)); this.InputData(movies, table); document.Add(table); }
private void FillDocument(Document document, MoviesDatabaseOfTeamSingaporeSlingEntities dbContext) { document.Open(); this.GenerateData(document, dbContext); document.Close(); }
public MoviesDatabaseOfTeamSingaporeSlingEntities GetInstance() { if (database == null) { database = new MoviesDatabaseOfTeamSingaporeSlingEntities(); } return(database); }
public MoviesDatabaseOfTeamSingaporeSlingEntities GetInstance() { var database = new MoviesDatabaseOfTeamSingaporeSlingEntities(); return(database); }