public static FlowDocument Print(PrintSessionRequest printSessionRequest) { var flowDocument = new FlowDocument(); var blocks = BuildBlocks(printSessionRequest); flowDocument.Blocks.AddRange(blocks); return(flowDocument); }
private static IEnumerable <Block> BuildBlocks(PrintSessionRequest printSessionRequest) { yield return(BuildSessionBlock(printSessionRequest.Session)); foreach (var encounter in printSessionRequest.Encounters) { yield return(BuildEncounterBlock(encounter)); } foreach (var contentItems in printSessionRequest.ContentItems.ToBatches(4)) { yield return(BuildContentItemsBlock(contentItems)); } }
public static Result <PrintSessionRequest> Build(Session session, IEnumerable <ContentItem> contentItems) { if (session == null) { return(Fail(SessionIsNull)); } if (!session.Encounters.Any()) { return(Fail(SessionHasNoEncounters)); } if (contentItems == null) { return(Fail(ContentItemsIsNull)); } PrintSessionRequest printSessionRequest = new PrintSessionRequest(session, contentItems); return(Result.Ok(printSessionRequest)); }