public void GenerateContract([FromBody] int studentId) { var student = Repository.Find <Student>(studentId); var docGenerator = new DocumentGenerator(); docGenerator.GenerateDocument(student); }
public void GetDocument_GeneratesDocumentWithMultipleMessagesPerChannel() { // Arrange var options = new AsyncApiOptions(); var schemaGenerator = new SchemaGenerator(Options.Create(options)); var documentGenerator = new DocumentGenerator(Options.Create(options), schemaGenerator); // Act var document = documentGenerator.GenerateDocument(new [] { typeof(TenantMessageConsumer).GetTypeInfo() }); // Assert document.ShouldNotBeNull(); document.Channels.Count.ShouldBe(1); var channel = document.Channels.First(); channel.Key.ShouldBe("asw.tenant_service.tenants_history"); channel.Value.Description.ShouldBe("Tenant events."); var subscribe = channel.Value.Subscribe; subscribe.ShouldNotBeNull(); subscribe.OperationId.ShouldBe("TenantMessageConsumer"); subscribe.Summary.ShouldBe("Subscribe to domains events about tenants."); var messages = subscribe.Message.ShouldBeOfType <Messages>(); messages.OneOf.Count.ShouldBe(3); messages.OneOf.ShouldContain(m => m.Name == "tenantCreated"); messages.OneOf.ShouldContain(m => m.Name == "tenantUpdated"); messages.OneOf.ShouldContain(m => m.Name == "tenantRemoved"); }
public void Handle(SiteProvisioned message) { try { var entity = ProjectRepository.Get(message.ProjectId); if (entity == null) { throw new ApplicationException(string.Format("[URMDS] Project {0} Not Found In The Database", message.ProjectId)); } if (entity.SourceProjectType != SourceProjectType.DEPOSIT) { Log.InfoFormat("[URMDS] Generating DMP PDF for reserach project \"{0}\".", message.ProjectId); DocumentGenerator.GeneratePdf(message.ProjectId, message.SiteUri); Log.Info("[URMDS] Completed DMP PDF generation."); Log.InfoFormat("[URMDS] Generating DMP XML for research project \"{0}\".", message.ProjectId); DocumentGenerator.GenerateXml(message.ProjectId, message.SiteUri); Log.Info("[URMDS] Completed DMP XML generation."); } } catch (Exception ex) { Log.Error(string.Format("Message:\n{0}\nStackTrace:\n{1}", ex.Message, ex.StackTrace)); throw; } }
public void Create_Document_From_Scratch() { // Create agent with Vendor, UserProfile, and Agent var agent = CreateAgent(); // Create Patient with Address, Medicare, and Private Insurance var patient = CreateAndPersistPatient(agent); IntakeForm intakeForm = CreateIntakeFormLocal(patient.PatientId); IntakeForm intakeForm2 = CreateIntakeFormLocal(patient.PatientId); // Create Document Byte Array var intakeModel = intakeForm.ToModel(); var intakeModel2 = intakeForm2.ToModel(); var exporter = new DocumentGenerator(); //todo if we are going to populate the questionare we need all intake forms to be passed to the DocumentGenerator //var intakeForms = new List<IntakeFormModel> { intakeModel, intakeModel2 }; var signatures = new List <SignatureModel> { CreateSignature().ToModel(), CreateSignature(false).ToModel() }; var documentContent = exporter.GenerateIntakeDocuments(intakeModel, patient.ToModel(), intakeForm.Physician.ToModel(), signatures); // Create Document var document = new Document { IntakeFormId = intakeForm.IntakeFormId, Content = documentContent }; var doc = dbContext.Document.Add(document); var id = dbContext.SaveChanges(); Console.WriteLine($"Run project and open your browser to https://localhost:44327/document/{doc.Entity.DocumentId}/download to see the word doc generated from this test"); }
public void GenerateDocument_GeneratesDocumentWithChannelParameters() { // Arrange var options = new AsyncApiOptions(); var documentGenerator = new DocumentGenerator(); // Act var document = documentGenerator.GenerateDocument(new [] { typeof(OneTenantMessageConsumer).GetTypeInfo() }, options, options.AsyncApi, ActivatorServiceProvider.Instance); // Assert document.ShouldNotBeNull(); document.Channels.Count.ShouldBe(1); var channel = document.Channels.First(); channel.Key.ShouldBe("asw.tenant_service.{tenant_id}.{tenant_status}"); channel.Value.Description.ShouldBe("A tenant events."); channel.Value.Parameters.Count.ShouldBe(2); channel.Value.Parameters.Values.OfType <ParameterReference>().ShouldContain(p => p.Id == "tenant_id" && p.Value.Schema != null && p.Value.Description == "The tenant identifier."); channel.Value.Parameters.Values.OfType <ParameterReference>().ShouldContain(p => p.Id == "tenant_status" && p.Value.Schema != null && p.Value.Description == "The tenant status."); var subscribe = channel.Value.Subscribe; subscribe.ShouldNotBeNull(); subscribe.OperationId.ShouldBe("OneTenantMessageConsumer"); subscribe.Summary.ShouldBe("Subscribe to domains events about a tenant."); var messages = subscribe.Message.ShouldBeOfType <Messages>(); messages.OneOf.Count.ShouldBe(3); messages.OneOf.OfType <MessageReference>().ShouldContain(m => m.Id == "tenantCreated"); messages.OneOf.OfType <MessageReference>().ShouldContain(m => m.Id == "tenantUpdated"); messages.OneOf.OfType <MessageReference>().ShouldContain(m => m.Id == "tenantRemoved"); }
public void GenerateReportData() { ImagePlaceholder.Solid = true; var model = DataSource.GetReport(); var report = new StandardReport(model); Metadata = report.GetMetadata(); var documentContainer = new DocumentContainer(); report.Compose(documentContainer); Content = documentContainer.Compose(); PageContext = new PageContext(); DocumentGenerator.RenderPass(PageContext, new FreeCanvas(), Content, Metadata, null); var sw = new Stopwatch(); sw.Start(); Content.VisitChildren(x => { if (x is ICacheable) { x.CreateProxy(y => new CacheProxy(y)); } }); sw.Stop(); Console.WriteLine($"Creating cache took: {sw.ElapsedMilliseconds}"); }
public ActionResult AddMediaFile(FormCollection collection, HttpPostedFileBase local_file) { MediaFile file = new MediaFile(); file.ServiceId = Convert.ToInt32(collection["service_id"]); if (local_file != null) { DocumentGenerator.GenerateLocalDocument(local_file, collection["service_name"]); file.Path = "~/Common/MediaFiles/" + collection["service_name"] + "/" + local_file.FileName; } else { if (!String.IsNullOrEmpty(collection["url_file"])) { file.Path = collection["url_file"]; } } file.Description = collection["media_description"]; using (HttpClient client = WebApiClient.InitializeAuthorizedClient(Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/", "Bearer", Request.Cookies["access_token"].Value)) { HttpResponseMessage response = client.PostAsJsonAsync("/api/ServiceApi/AddMediaFile", file).Result; } return(RedirectToAction("ServiceDetails", new { id = Convert.ToInt32(collection["service_id"]) })); }
public void GenerateDocument_GeneratesDocumentWithSingleMessage() { // Arrange var options = new AsyncApiOptions(); var schemaGenerator = new SchemaGenerator(Options.Create(options)); var documentGenerator = new DocumentGenerator(Options.Create(options), schemaGenerator); // Act var document = documentGenerator.GenerateDocument(new [] { typeof(TenantSingleMessagePublisher).GetTypeInfo() }); // Assert document.ShouldNotBeNull(); document.Channels.Count.ShouldBe(1); var channel = document.Channels.First(); channel.Key.ShouldBe("asw.tenant_service.tenants_history"); channel.Value.Description.ShouldBe("Tenant events."); var publish = channel.Value.Publish; publish.ShouldNotBeNull(); publish.OperationId.ShouldBe("TenantSingleMessagePublisher"); publish.Summary.ShouldBe("Publish single domain event about tenants."); var message = publish.Message.ShouldBeOfType <Message>(); message.Name.ShouldBe("anyTenantCreated"); }
private void patientListButton_Click(object sender, EventArgs e) { List <Patient> pList = PatientController.getAll(); DocumentGenerator.generatePatientList(this.currentUser, pList); MessageBox.Show("Document generated."); }
public void GenerateDocument_GeneratesDocumentWithMultipleMessagesPerChannel() { // Arrange var options = new AsyncApiOptions(); var documentGenerator = new DocumentGenerator(); // Act var document = documentGenerator.GenerateDocument(new [] { typeof(TenantMessagePublisher).GetTypeInfo() }, options, options.AsyncApi, ActivatorServiceProvider.Instance); // Assert document.ShouldNotBeNull(); document.Channels.Count.ShouldBe(1); var channel = document.Channels.First(); channel.Key.ShouldBe("asw.tenant_service.tenants_history"); channel.Value.Description.ShouldBe("Tenant events."); var publish = channel.Value.Publish; publish.ShouldNotBeNull(); publish.OperationId.ShouldBe("TenantMessagePublisher"); publish.Summary.ShouldBe("Publish domains events about tenants."); var messages = publish.Message.ShouldBeOfType <Messages>(); messages.OneOf.Count.ShouldBe(3); messages.OneOf.OfType <MessageReference>().ShouldContain(m => m.Id == "anyTenantCreated"); messages.OneOf.OfType <MessageReference>().ShouldContain(m => m.Id == "anyTenantUpdated"); messages.OneOf.OfType <MessageReference>().ShouldContain(m => m.Id == "anyTenantRemoved"); }
public void TestRazor() { var generator = new DocumentGenerator(NotesServiceMoq.Object); const string resFilePath = "c:\\temp\\TestRazor.pdf"; generator.SaveAsPdf(_xmlText, Assembly.GetExecutingAssembly().GetManifestResourceStream("QA.Core.DocumentGenerator.Tests.TestDocs.TestRazor.docx"), new FileStream(resFilePath, FileMode.Create)); }
public DocumentGenerator Prepare(ExecutionContext executionContext) { DocumentGenerator document = Parent.GetDocument(executionContext.GetOutput(this)); document.Formatter.Assemblies.AddRange(Parent.AssemblyCache.Loader); DoPrepare(document, CoerceContractDefinition(executionContext.Definition)); return(document); }
public string GenerateTemplatePreview(int id, int templateType, string templateName, string templatePath, string documentPath) { //string templateName = string.Empty; var generator = new DocumentGenerator(templatePath, documentPath, GetTemplateData(templateType, id), GetTransactionDetails(id), _log); var result = generator.GenerateDocument(); return(result.Value ? result.ResultPath : string.Empty); }
public string GenerateWordDocument(string wordTemplate, string BaselineID, string ProjectName, string projectLocation, int type) { //Get all Requirements for the project string projectID = GetProjectID(ProjectName); List <Requirement> requirements = OrderedRequirementsByProject(projectID); DocumentGenerator gen = new DocumentGenerator(wordTemplate, projectLocation, requirements); return(gen.GenerateDocument()); }
static void Main(string[] args) { DocumentGenerator documentGenerator = new DocumentGenerator(); using (var memoryString = documentGenerator.GenerateImage(@"https://docs.aspose.com/display/htmlnet/Load+HTML+Document+Asynchronously")) { using (FileStream file = new FileStream("page.jpg", FileMode.Create, System.IO.FileAccess.Write)) { memoryString.WriteTo(file); } } }
public When_calling_Documents_create_service() { var stubResponse = new HttpResponseMessage(); stubResponse.Content = new StringContent(DocumentGenerator.Json()); HttpClient.Setup(client => client.Post(It.IsAny <Uri>(), It.IsAny <HttpContent>())) .Returns(stubResponse) .Callback <Uri, object>((u, h) => { UriUsed = u; }); HttpClient.Setup(client => client.Get(It.IsAny <Uri>())) .Throws(new Exception("Document create should use POST")); }
public static IAsyncApiDocumentProvider Provider(Action <AsyncApiOptions>?setupAction = null) { var options = new AsyncApiOptions(); setupAction?.Invoke(options); var wrappedOptions = Options.Create(options); var schemaGenerator = new SchemaGenerator(wrappedOptions); var documentGenerator = new DocumentGenerator(Options.Create(options), schemaGenerator); return(new AsyncApiDocumentProvider(Options.Create(options), documentGenerator)); }
private void generatePrescriptionDocButton_Click(object sender, EventArgs e) { if (PrescriptionController.savePrescription(prescriptionTextBox.Text, this.medicId, this.patientId)) { DocumentGenerator.generatePrescription(this.currentUser, this.selectedPatient, prescriptionTextBox.Text); MessageBox.Show("Document generated."); this.Hide(); new PatientForm(this.username).Show(); } else { MessageBox.Show("Error"); } }
public void RegisterPageTypes() { DocumentGenerator.RegisterDocumentType <PageMetadata>(PageMetadata.CLASS_NAME); Fake().DocumentType <PageMetadata>(PageMetadata.CLASS_NAME); DocumentGenerator.RegisterDocumentType <OpenGraphMetadata>(OpenGraphMetadata.CLASS_NAME); Fake().DocumentType <OpenGraphMetadata>(OpenGraphMetadata.CLASS_NAME); DocumentGenerator.RegisterDocumentType <Page>(Page.CLASS_NAME); Fake().DocumentType <Page>(Page.CLASS_NAME); DocumentGenerator.RegisterDocumentType <ContentComponentTest>(ContentComponentTest.CLASS_NAME); Fake().DocumentType <ContentComponentTest>(ContentComponentTest.CLASS_NAME); }
public void Generate(string templatePath, string saveFilePath, Student student, University university, Employee employee) { Dictionary <string, string> d = FillDictionary(student, university, employee); FileStream template = new FileStream(templatePath, FileMode.Open, FileAccess.Read); FileStream document = new FileStream(saveFilePath, FileMode.OpenOrCreate); IDocumentGenerator doc = new DocumentGenerator(); doc.Generate(template, document, d); template.Close(); document.Close(); }
public static async Task ShowInPreviewerAsync(this IDocument document, int port = 12500) { var previewerService = new PreviewerService(port); var cancellationTokenSource = new CancellationTokenSource(); previewerService.OnPreviewerStopped += () => cancellationTokenSource.Cancel(); await previewerService.Connect(); await RefreshPreview(); HotReloadManager.UpdateApplicationRequested += (_, _) => RefreshPreview(); await WaitForPreviewerExit(cancellationTokenSource.Token); Task RefreshPreview() { var pictures = GetPictures(); return(previewerService.RefreshPreview(pictures)); ICollection <PreviewerPicture> GetPictures() { try { return(DocumentGenerator.GeneratePreviewerPictures(document)); } catch (Exception exception) { var exceptionDocument = new ExceptionDocument(exception); return(DocumentGenerator.GeneratePreviewerPictures(exceptionDocument)); } } } async Task WaitForPreviewerExit(CancellationToken cancellationToken) { while (true) { if (cancellationToken.IsCancellationRequested) { return; } await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken); } } }
/// <summary> /// Generates a document from a template /// </summary> /// <param name="executionContext">The execution context.</param> protected override void Execute(CodeActivityContext executionContext) { // Create the tracing service ITracingService tracingService = executionContext.GetExtension <ITracingService>(); if (tracingService == null) { throw new InvalidPluginExecutionException("Failed to retrieve tracing service."); } tracingService.Trace("Entered GenerateDocument.Execute(), Activity Instance Id: {0}, Workflow Instance Id: {1}", executionContext.ActivityInstanceId, executionContext.WorkflowInstanceId); // Create the context IWorkflowContext context = executionContext.GetExtension <IWorkflowContext>(); if (context == null) { throw new InvalidPluginExecutionException("Failed to retrieve workflow context."); } tracingService.Trace("GenerateDocument.Execute(), Correlation Id: {0}, Initiating User: {1}", context.CorrelationId, context.InitiatingUserId); if (_service == null) { IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>(); _service = serviceFactory.CreateOrganizationService(context.UserId); _privService = serviceFactory.CreateOrganizationService(null); _parentQueryName = ParentQueryName.Get <string>(executionContext); } try { DocumentGenerator generator = new DocumentGenerator(_service, _privService, tracingService); generator.Generate(context.PrimaryEntityId, _parentQueryName); } catch (FaultException <OrganizationServiceFault> e) { tracingService.Trace("Exception: {0}", e.ToString()); // Handle the exception. throw; } tracingService.Trace("Exiting GenerateDocument.Execute(), Correlation Id: {0}", context.CorrelationId); }
public void Profile() { ImagePlaceholder.Solid = true; var container = new DocumentContainer(); Report.Compose(container); var content = container.Compose(); var metadata = Report.GetMetadata(); var pageContext = new PageContext(); DocumentGenerator.RenderPass(pageContext, new FreeCanvas(), content, metadata, null); DocumentGenerator.RenderPass(pageContext, new FreeCanvas(), content, metadata, null); }
public void DocumentFilterIsAppliedToAsyncApiDocument() { // Arrange var options = new AsyncApiOptions(); var documentGenerator = new DocumentGenerator(); // Act options.AddDocumentFilter<ExampleDocumentFilter>(); var document = documentGenerator.GenerateDocument(new[] { GetType().GetTypeInfo() }, options, options.AsyncApi, ActivatorServiceProvider.Instance); // Assert document.ShouldNotBeNull(); document.Channels.Count.ShouldBe(1); document.Channels.ShouldContainKey("foo"); }
private void buttonGo_Click(object sender, System.EventArgs e) { string[] files = System.IO.Directory.GetFiles(this.textBox1.Text, "*.ofx"); List <Transaction> transactions = OFXParserEx.GetTransactions(files, this.checkBoxEnableTagging.Checked); DocumentGenerator.GenerateExcel(this.textBox1.Text + "\\Worksheet.xlsx", transactions); foreach (Transaction transaction in transactions) { System.Diagnostics.Debug.WriteLine(transaction.TransactionType + " " + transaction.Date + " " + transaction.Description + " " + transaction.Value); } MessageBox.Show("Person Budget data generated successfully!!!"); }
public string GenerateTemplate(int id, int templateType, string templateName) { //string templateName = string.Empty; string templatePath = HttpContext.Current.Server.MapPath(string.Format("~/Templates/{0}.dotx", templateName)); string documentPath = HttpContext.Current.Server.MapPath(string.Format("~/Templates/{0}.docx", Guid.NewGuid().ToString())); var generator = new DocumentGenerator(templatePath, documentPath, GetTemplateData(templateType, id), GetTransactionDetails(id), _log); var result = generator.GenerateDocument(); return(result.Value ? result.ResultPath : string.Empty); }
public DiagramViewModel() { //Initialize Diagram Properties Connectors = new ObservableCollection <ConnectorVM>(); Constraints = Constraints.Remove(GraphConstraints.PageEditing, GraphConstraints.PanRails); Menu = null; Tool = Tool.ZoomPan; //HorizontalRuler = new Ruler { Orientation = Orientation.Horizontal }; //VerticalRuler = new Ruler { Orientation = Orientation.Vertical }; DefaultConnectorType = ConnectorType.Orthogonal; // Initialize Command for sample changes Orientation_Command = new DelegateCommand <Object>(OnOrientation_Command); ExportReport = new DelegateCommand(() => DocumentGenerator.MakeDocument(courses)); }
/// <summary> /// The Thrift.Net Thrift compiler. Use this to generate C# code from /// your Thrift IDL files. /// </summary> /// <param name="input">Specifies the path to the input file.</param> /// <param name="outputDirectory"> /// Specifies the output directory. If it does not already exist it will be created. /// </param> /// <param name="console">Used to interact with the console.</param> /// <returns> /// The exit code. This can be used by scripts to determine whether the /// compile was successful or not. /// </returns> public static int Main(FileInfo input, DirectoryInfo outputDirectory, IConsole console) { if (!input.Exists) { console.Error.Write($"The specified input file '{input.Name}' could not be found.{Environment.NewLine}"); return((int)ExitCode.InputFileNotFound); } if (!outputDirectory.Exists) { outputDirectory.Create(); } console.Out.Write($"Starting compilation of {input.Name}{Environment.NewLine}"); var thriftFile = FileProvider.Create( new DirectoryInfo(Directory.GetCurrentDirectory()), input, outputDirectory); using (var stream = input.OpenRead()) { var result = Compiler.Compile(stream); OutputCompilationSummary(console, result); // TODO: Pull message formatting out to its own object. foreach (var message in result.Messages.OrderBy(message => message.LineNumber)) { console.Out.Write($"{thriftFile.RelativePath}({message.LineNumber},{message.StartPosition}-{message.EndPosition}): {message.MessageType} {message.FormattedMessageId}: {message.Message} [{input.FullName}]{Environment.NewLine}"); } if (result.HasErrors) { return((int)ExitCode.CompilationFailed); } if (result.Document.ContainsDefinitions) { var generatedCode = DocumentGenerator.Generate(thriftFile, result.Document); FileWriter.Write(thriftFile, generatedCode); } } return((int)ExitCode.Success); }
public DocumentGenerator GetDocument(string output) { if (output == null) { throw new ArgumentNullException(nameof(output)); } if (!_documents.ContainsKey(output)) { _documents[output] = new DocumentGenerator(); if (FullTypeNames) { _documents[output].Formatter.ForceFullTypeNames = true; } } return(_documents[output]); }
static void Main(string[] args) { // //must have a .xsd file... do checks // if (args.Length < 1) // { // Console.WriteLine("Must have an XSD file to generate an XSL file"); // return; // } // string filePath = args[0]; // //is not xsd file // if (!Regex.Match(filePath, "^.*\.xsd$")) { // Console.WriteLine("File submitted is not of type XSD"); // return; // } DocumentGenerator generator = DocumentGeneratorFacade.GetGenerator <XslGenerator>(); }
/// <summary> /// Processes the build in feature. /// </summary> /// <param name="httpRequest">The HTTP request.</param> /// <param name="runtimeContext">The runtime context.</param> /// <param name="isLocalhost">The is localhost.</param> /// <param name="contentType">Type of the content.</param> /// <returns> /// System.Object. /// </returns> protected override object ProcessBuiltInFeature(HttpRequest httpRequest, RuntimeContext runtimeContext, bool isLocalhost, out string contentType) { object result = null; contentType = HttpConstants.ContentType.Json; switch (runtimeContext?.ResourceName.SafeToLower()) { case "apilist": result = routes.Select(x => new { Url = x.Key.TrimEnd('/') + "/", Method = x.Value.MethodInfo?.Name }).ToList(); break; case "configuration": result = isLocalhost ? Framework.ConfigurationReader.GetValues() : "This API is available at localhost machine." as object; break; case "license": if (isLocalhost) { var licenseDictionary = new Dictionary<string, object>(); foreach (var one in BeyovaLicenseContainer.Licenses) { licenseDictionary.Add(one.Key, new { one.Value.LicensePath, one.Value.Entry }); } } else { result = "This API is available at localhost machine."; } break; case "doc": DocumentGenerator generator = new DocumentGenerator(DefaultSettings.TokenHeaderKey.SafeToString(HttpConstants.HttpHeader.TOKEN)); result = generator.WriteHtmlDocumentToZip((from item in routes select item.Value.InstanceType).Distinct().ToArray()); contentType = HttpConstants.ContentType.ZipFile; break; default: break; } return result ?? base.ProcessBuiltInFeature(httpRequest, runtimeContext, isLocalhost, out contentType); }