public static MergeRowTree CreateEmptyPseudoTableRowTree() { return(MergeDataTreeOps.CreateRowTree( tableFields.AsReadOnly(), new PseudoTableRow[] { null }, children: new List <MergeDataTreeChild <PseudoTableRow> > { new MergeDataTreeChild <PseudoTableRow, PseudoChildRow>( "Things", childFields.AsReadOnly(), pseudoTableRow => ((PseudoChildRow)null).ToCollection()) }.AsReadOnly())); }
public static MergeRowTree CreatePseudoTableRowTree(IEnumerable <PseudoTableRow> rows) { var rand = new Random(); return(MergeDataTreeOps.CreateRowTree( tableFields.AsReadOnly(), rows, new List <MergeDataTreeChild <PseudoTableRow> > { new MergeDataTreeChild <PseudoTableRow, PseudoChildRow>( "Things", childFields.AsReadOnly(), pseudoTableRow => new[] { new PseudoChildRow(rand.Next(20)), new PseudoChildRow(rand.Next(20)) }) }.AsReadOnly())); }
public static MergeRowTree CreatePseudoTableRowTree(IEnumerable <PseudoTableRow> rows) { var rand = new Random(); var children = new MergeDataTreeChild <PseudoTableRow, PseudoChildRow>("Things", childFields.AsReadOnly(), data => /*Randomness.FlipCoin()*/ false ? new[] { new PseudoChildRow(rand.Next(20)), new PseudoChildRow(rand.Next(20)) } : new PseudoChildRow[0], null); return(MergeDataTreeOps.CreateRowTree(tableFields.AsReadOnly(), rows, new List <MergeDataTreeChild <PseudoTableRow> > { children }.AsReadOnly())); }
public void PracticesMerge() { var practiceData = new PracticeMockData( "Entymology Associates of Rock Chester", new[] { "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**" }.Select(s => new PracticeManagerMockData(s)), new[] { new PhysicianMockData("*****@*****.**", "Joan", "Ann"), new PhysicianMockData("*****@*****.**", "Johnny", "Ann"), new PhysicianMockData("*****@*****.**", "Billy", "Pullman"), new PhysicianMockData("*****@*****.**", "William", "Smithers") }); var practiceFields = new List <MergeField <PracticeMockData> >(MergeFieldOps.CreateBasicField(new PracticeName()).ToCollection()); var managerFields = new List <MergeField <PracticeManagerMockData> >(MergeFieldOps.CreateBasicField(new MergeFields.PracticeManagerMergeFields.Email()).ToCollection()); var physicianFields = new List <MergeField <PhysicianMockData> >( new[] { MergeFieldOps.CreateBasicField(new MergeFields.PhysicianMergeFields.Email()), MergeFieldOps.CreateBasicField(new FirstName()), MergeFieldOps.CreateBasicField(new LastName()) }); var managersChild = new MergeDataTreeChild <PracticeMockData, PracticeManagerMockData>( "PracticeManagers", managerFields.AsReadOnly(), data => data.Managers); var physiciansChild = new MergeDataTreeChild <PracticeMockData, PhysicianMockData>("Physicians", physicianFields.AsReadOnly(), data => data.Physicians); var mergeTree = MergeDataTreeOps.CreateRowTree( practiceFields.AsReadOnly(), practiceData.ToCollection(), new List <MergeDataTreeChild <PracticeMockData> > { managersChild, physiciansChild }.AsReadOnly()); using (var templateStream = File.OpenRead(testingPracticesWordTemplatePath)) { using (var destinationStream = File.Create(getFilePath("practices_merge_test"))) { MergeOps.CreateMsWordDoc(mergeTree, true, templateStream, destinationStream); doneCreating = DateTime.Now; } } }
public void PersonMerge() { var singlePersonMergeData = new MergeTestData { FullName = "Johnny Rockets, King of the Dinosaurs", Things = new List <MergeTestData.Thing>( new[] { new MergeTestData.Thing { TheValue = "Something" }, new MergeTestData.Thing { TheValue = "Another thing" }, new MergeTestData.Thing { TheValue = "One more thing" }, new MergeTestData.Thing { TheValue = "Last thing" }, new MergeTestData.Thing { TheValue = "Okay THIS is the last thing" }, new MergeTestData.Thing { TheValue = "Something again" }, new MergeTestData.Thing { TheValue = "Another thing again" }, new MergeTestData.Thing { TheValue = "One more thing again" }, new MergeTestData.Thing { TheValue = "Last thing again" }, new MergeTestData.Thing { TheValue = "Okay THIS is the last thing again" }, new MergeTestData.Thing { TheValue = "Something one more time" }, new MergeTestData.Thing { TheValue = "Another thing one more time" }, new MergeTestData.Thing { TheValue = "One more thing one more time" }, new MergeTestData.Thing { TheValue = "Last thing one more time" }, new MergeTestData.Thing { TheValue = "Okay THIS is the last thing one more time" }, new MergeTestData.Thing { TheValue = "Something that is getting old" }, new MergeTestData.Thing { TheValue = "Another thing that is getting old" }, new MergeTestData.Thing { TheValue = "One more thing that is getting old" }, new MergeTestData.Thing { TheValue = "Last thing that is getting old" }, new MergeTestData.Thing { TheValue = "Okay THIS is the last thing that is getting old" }, new MergeTestData.Thing { TheValue = "Something about the end of all things" }, new MergeTestData.Thing { TheValue = "Another thing about the end of all things" }, new MergeTestData.Thing { TheValue = "One more thing about the end of all things" }, new MergeTestData.Thing { TheValue = "Last thing about the end of all things" }, new MergeTestData.Thing { TheValue = "Okay THIS is the last thing about the end of all things" }, }) }; var mergingInfoFields = new List <MergeField <MergeTestData> >(new[] { MergeFieldOps.CreateBasicField(new FullName()) }); var internalTableDataFields = new List <MergeField <MergeTestData.Thing> >(new[] { MergeFieldOps.CreateBasicField(new TheValue()) }); var mergeTree = MergeDataTreeOps.CreateRowTree( mergingInfoFields.AsReadOnly(), singlePersonMergeData.ToSingleElementArray(), new List <MergeDataTreeChild <MergeTestData> > { new MergeDataTreeChild <MergeTestData, MergeTestData.Thing>("Things", internalTableDataFields.AsReadOnly(), info => info.Things) }.AsReadOnly()); using (var templateStream = File.OpenRead(testingWordTemplatePath)) { using (var destinationStream = File.Create(getFilePath("basic_merge_test"))) { MergeOps.CreateMsWordDoc(mergeTree, true, templateStream, destinationStream); doneCreating = DateTime.Now; } } }