public static string ForDisplay(Shelf shelf, FormatAssociationsEnum includeAssociations) { StringBuilder bldr = new StringBuilder("Shelf:\r\n"); bldr.AppendFormat("Code:\t\t{0}\r\n", shelf.ShelfCode); bldr.AppendFormat("Name:\t\t{0}\r\n", shelf.SiteName); bldr.AppendFormat("Address:\t\t{0}\r\n", shelf.Address ); bldr.AppendFormat("PostCode:\t\t{0}\r\n", shelf.PostCode ); return bldr.ToString(); }
public static string ForDisplay(Title title, FormatAssociationsEnum includeAssociations) { StringBuilder bldr = new StringBuilder("Title:\r\n"); bldr.AppendFormat("Id:\t\t{0}\r\n", title.TitleId.ToString()); bldr.AppendFormat("Name:\t\t{0}\r\n", title.TitleName); bldr.AppendFormat("Author:\t\t{0}\r\n", title.Author); bldr.AppendFormat("ISBN:\t\t{0}\r\n", title.ISBN); if (title.Shelf == null) bldr.AppendLine("Shelf:\t\tNot Materialised"); else { if (includeAssociations != FormatAssociationsEnum.Children) { // Format Shelf bldr.AppendLine(FormatShelf.ForDisplay(title.Shelf, includeAssociations)); } else { bldr.AppendLine("Shelf:\t\tMaterialised but not displayed"); } } if (title.Copies == null) { bldr.AppendLine("Copies:\t\tNot Materialised"); } else { if (includeAssociations != FormatAssociationsEnum.Parents) { foreach (Copy c in title.Copies) { // Format Copy bldr.AppendLine(FormatCopy.ForDisplay(c, includeAssociations)); } } else { bldr.AppendLine("Copes:\t\tMaterialised but not displayed"); } } return bldr.ToString(); }
public static string ForDisplay(Loan loan, FormatAssociationsEnum includeAssociations) { StringBuilder bldr = new StringBuilder("Loan:\r\n"); bldr.AppendFormat("Id:\t\t{0}\r\n", loan.LoanId.ToString()); bldr.AppendFormat("Date: \t\t{0}\r\n", loan.LoanDate.ToShortDateString()); // Associations: Member is Parent if (loan.Member == null) { bldr.AppendLine("Member:\t\tNot Materialised"); } else { if (includeAssociations != FormatAssociationsEnum.Children) { bldr.AppendLine(FormatMember.ForDisplay(loan.Member, includeAssociations)); } else { bldr.AppendLine("Member:\t\tMaterialised but not displayed"); } } // Copy is Parent if (loan.Copy == null) { bldr.AppendLine("Copy:\t\tNot Materialised"); } else { if (includeAssociations != FormatAssociationsEnum.Children) { // Format Copy bldr.AppendLine("Copy not formatted yet!"); //bldr.AppendLine(FormatMember.ForDisplay(loan.Member, includeAssociations); } else { bldr.AppendLine("Copy:\t\tMaterialised but not displayed"); } } return bldr.ToString(); }
public static string ForDisplay(Copy copy, FormatAssociationsEnum includeAssociations) { StringBuilder bldr = new StringBuilder("Copy:\r\n"); bldr.AppendFormat("Id:\t\t{0}\r\n", copy.CopyId.ToString()); bldr.AppendFormat("IsAvailable:\t{0}\r\n", copy.IsAvailable.ToString()); if (copy.Title == null) bldr.AppendLine("Title:\t\tNot Materialised"); else { if (includeAssociations != FormatAssociationsEnum.Children) { // Format Title bldr.AppendLine(FormatTitle.ForDisplay(copy.Title, includeAssociations)); } else { bldr.AppendLine("Title:\t\tMaterialised but not displayed"); } } return bldr.ToString(); }
public static string ForDisplay(Member member, FormatAssociationsEnum includeAssociations) { StringBuilder bldr = new StringBuilder("Maember:\r\n"); bldr.AppendFormat("Id:\t\t{0}\r\n", member.MemberId.ToString()); bldr.AppendFormat("Name:\t\t{0}\r\n", member.Name); if (member.Loans == null) bldr.AppendLine("Loans:\t\tNot Materialised"); else { if (includeAssociations != FormatAssociationsEnum.Parents) { foreach (Loan l in member.Loans) { bldr.AppendLine(FormatLoan.ForDisplay(l, includeAssociations)); } } else { bldr.AppendLine("Loans:\t\tMaterialised but not displayed"); } } return bldr.ToString(); }