private Row RowParserer(PrintEdition item, int index) { Row row = new Row() { RowIndex = (UInt32Value)(uint)index + 1 }; if (item is Book) { Book bookItem = (Book)item; System.Text.StringBuilder sb = new System.Text.StringBuilder(); foreach (var author in _authorDao.GetAuthorByBookId(item.Id)) { string authorName = author.FirstName[0] + ". "; sb.Append(authorName); sb.Append(" "); sb.Append(@author.LastName); sb.Append(" "); } sb.Append(item.Title); sb.Append(" "); sb.Append(item.PublicationYear); sb.Append(" "); CellInclude(row, sb.ToString()); CellInclude(row, bookItem.ISBN); CellInclude(row, bookItem.NumberOfPages.ToString()); } if (item is Newspaper) { Newspaper newspaperItem = (Newspaper)item; CellInclude(row, newspaperItem.Title + " " + newspaperItem.currentNewspaperIssue.ToString()); CellInclude(row, newspaperItem.ISSN); CellInclude(row, newspaperItem.currentNewspaperIssue.NumberOfPages.ToString()); } if (item is Patent) { Patent patentItem = (Patent)item; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(patentItem.Title); sb.Append(" "); sb.Append("from ("); sb.Append(patentItem.PublicationYear); sb.Append(") "); CellInclude(row, sb.ToString()); CellInclude(row, patentItem.RegistrationNumber.ToString()); CellInclude(row, patentItem.NumberOfPages.ToString()); } return(row); }
public IEnumerable <Author> GetAuthorByBookId(int bookId) { return(_authorDao.GetAuthorByBookId(bookId)); }