public HttpResponseMessage Get() { var rs = new LocalReporting().UseBinary(JsReportBinary.GetBinary()).AsUtility().Create(); var report = rs.RenderAsync(new RenderRequest() { Template = new Template() { Recipe = Recipe.PhantomPdf, Engine = Engine.Handlebars, Content = "Hello from pdf, {{message}}", Phantom = new Phantom { Header = "<div style='text-align:center'>Page number {#pageNum}/{#numPages}</div>" } }, Data = new { message = "B&A Migrando a jsreport for .NET!!!" } }).Result; string nombre = "Test"; HttpResponseMessage response = DescargarPdf(ReadFully(report.Content), nombre); return(response); }
public static IServiceCollection AddPdfRendering(this IServiceCollection services) { IReportingBinary binary = null; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { binary = JsReportBinary.GetBinary(); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { binary = jsreport.Binary.OSX.JsReportBinary.GetBinary(); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { binary = jsreport.Binary.Linux.JsReportBinary.GetBinary(); } services.AddJsReport(new LocalReporting() .UseBinary(binary) .KillRunningJsReportProcesses() .AsUtility() .Create()); return(services); }
public void GenerateEventReport(int eventId) { var rs = new LocalReporting() .RunInDirectory(Path.Combine(Directory.GetCurrentDirectory(), "jsreport")) .KillRunningJsReportProcesses() .UseBinary(JsReportBinary.GetBinary()) .Configure(cfg => cfg.AllowedLocalFilesAccess().FileSystemStore().BaseUrlAsWorkingDirectory()) .AsUtility() .Create(); var r = new PaxResult { pos = 1, number = 25, class_name = "GS", car = "GTI", name = "Aaron Hall", best_run = 33.456, pax_time = 30.234, diff = 0, from_first = 0, points = 10000 }; var p = new Pax { year = 2019, event_num = 5, date = "8/19/2018", drivers = new List <PaxResult>() }; for (int i = 0; i < 200; ++i) { p.drivers.Add(r); } var json = JsonConvert.SerializeObject(p); var invoiceReport = rs.RenderByNameAsync("EventPaxReport", json).Result; invoiceReport.Content.CopyTo(File.OpenWrite("event.pdf")); invoiceReport.Content.Close(); rs.KillAsync(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.Configure <RCIConfig>(Configuration.GetSection("RCIConfig")); services.AddTransient <IEmailSender, AuthMessageSender>(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddJsReport(new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .AsUtility() .Create()); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddDbContext <ClubTreasurerContext>(options => options.UseSqlServer(Configuration.GetConnectionString("LocalDBClubTreasurerContext"))); services.AddIdentity <AppUser, AppRole>( options => options.Stores.MaxLengthForKeys = 128) .AddEntityFrameworkStores <ClubTreasurerContext>() .AddDefaultUI() .AddDefaultTokenProviders(); services.AddAutoMapper(typeof(Startup)); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <MojContext>(options => options.UseSqlServer(Configuration.GetConnectionString("lokalni1"))); services.AddDbContext <MojContext>(options => options.UseSqlServer(Configuration.GetConnectionString("fit-server4"))); services.AddDistributedMemoryCache(); services.AddSession(options => { options.IdleTimeout = TimeSpan.FromMinutes(10); options.Cookie.HttpOnly = true; }); services.AddScoped <IViewRenderService, ViewRenderService>(); // services.AddJsReport(new ReportingService("http://jsreport:5488")); services.AddJsReport(new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .AsUtility() .Create()); services.AddMemoryCache(); services.AddSession(); }
static void Main(string[] args) { try { //Configure the Local JsReportServer as utility //This would save templates in the running application directory (bin/debug) var rs = new LocalReporting() .RunInDirectory(Path.Combine(Directory.GetCurrentDirectory(), "jsreport")) .KillRunningJsReportProcesses() .UseBinary(JsReportBinary.GetBinary()) .Configure(cfg => cfg.AllowedLocalFilesAccess().FileSystemStore().BaseUrlAsWorkingDirectory()) .AsUtility() .Create(); //Render the invoice template as PDF, by default is renders as portrait. //If you want to render as landscape, set landscape=true in config.json file of invoice template //Here we are using saved templates in local server. Console.WriteLine("Rendering localy stored template jsreport/data/templates/Invoice into invoice.pdf"); var invoiceReport = rs.RenderByNameAsync("Invoice", InvoiceData).Result; invoiceReport.Content.CopyTo(File.OpenWrite("invoice.pdf")); //Render the sample template as PDF, by default is renders as portrait. //If you want to render as landscape, set landscape=true in below template object. //Here we are managing template from our code Console.WriteLine("Rendering custom report fully described through the request object into customReport.pdf"); var customReport = rs.RenderAsync(CustomRenderRequest).Result; customReport.Content.CopyTo(File.OpenWrite("customReport.pdf")); } catch (Exception ex) { throw ex; } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <ApplicationDbContext>(options => options.UseSqlite(Configuration.GetConnectionString("DefaultConnection"))); services.AddIdentity <ApplicationUser, IdentityRole>(options => { options.SignIn.RequireConfirmedEmail = true; }) .AddEntityFrameworkStores <ApplicationDbContext>() .AddDefaultTokenProviders(); // Add application services. services.AddTransient <IEmailSender, EmailSender>(); services.Configure <SendGridSettings>(Configuration.GetSection("SendGrid")); services.AddAuthentication().AddGoogle(options => { options.ClientId = "816410532546-pi1a2h38i0lspipv9cq4im7bd7jcn614.apps.googleusercontent.com"; options.ClientSecret = "L6fQlpWlEPKslTkgeFFMzKr0"; }) .AddFacebook(facebookOptions => { facebookOptions.AppId = "1163579840488666"; facebookOptions.AppSecret = "8439198806a6fd28770b711210122e57"; }); services.Configure <StripeSettings>(Configuration.GetSection("Stripe")); services.AddTransient <Seeder>(); services.AddMvc(); services.AddJsReport(new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .AsUtility() .Create()); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <Contexto>(options => options.UseSqlServer( Configuration.GetConnectionString("DefaultConnection"))); services.AddIdentity <Usuario, NiveisAcesso>(options => options.SignIn.RequireConfirmedAccount = true) .AddEntityFrameworkStores <Contexto>(); services.ConfigureApplicationCookie(opcoes => { opcoes.AccessDeniedPath = "/Usuarios/AccessDenied"; opcoes.Cookie.HttpOnly = true; opcoes.ExpireTimeSpan = TimeSpan.FromMinutes(60); opcoes.LoginPath = "/Usuarios/Login"; opcoes.SlidingExpiration = true; }); services.Configure <IdentityOptions>(opcoes => { opcoes.Password.RequireDigit = false; opcoes.Password.RequireLowercase = false; opcoes.Password.RequireNonAlphanumeric = false; opcoes.Password.RequireUppercase = false; opcoes.Password.RequiredLength = 6; opcoes.Password.RequiredUniqueChars = 1; }); services.AddControllersWithViews(); services.AddRazorPages(); services.AddScoped <IPacienteRepositorio, PacienteRepositorio>(); services.AddScoped <IContatoRepositorio, ContatoRepositorio>(); services.AddScoped <IConselhoRepositorio, ConselhoRepositorio>(); services.AddScoped <ITipoPrestadorRepositorio, TipoPrestadorRepositorio>(); services.AddScoped <IEspecialidadeRepositorio, EspecialidadeRepositorio>(); services.AddScoped <IPrestadorRepositorio, PrestadorRepositorio>(); services.AddScoped <IPrestadorEspecialidadeRepositorio, PrestadorEspecialidadeRepositorio>(); services.AddScoped <IConvenioRepositorio, ConvenioRepositorio>(); services.AddScoped <ISetorRepositorio, SetorRepositorio>(); services.AddScoped <IExameRepositorio, ExameRepositorio>(); services.AddScoped <IGrupoFaturamentoRepositorio, GrupoFaturamentoRepositorio>(); services.AddScoped <IProcedimentoRepositorio, ProcedimentoRepositorio>(); services.AddScoped <ITabelaFaturamentoRepositorio, TabelaFaturamentoRepositorio>(); services.AddScoped <ITabelaFatuProcedimentoRepositorio, TabelaFatuProcedimentoRepositorio>(); services.AddScoped <IItemAgendamentoRepositorio, ItemAgendamentoRepositorio>(); services.AddScoped <IItemAgendamentoPrestadorRepositorio, ItemAgendamentoPrestadorRepositorio>(); services.AddScoped <IRecursoAgendamentoRepositorio, RecursoAgendamentoRepositorio>(); services.AddScoped <IEmpresaRepositorio, EmpresaRepositorio>(); services.AddScoped <INivelAcessoRepositorio, NivelAcessoRepositorio>(); services.AddScoped <IUsuarioRepositorio, UsuarioRepositorio>(); services.AddScoped <IAgendaMedicaRepositorio, AgendaMedicaRepositorio>(); services.AddScoped <IAgendamentoRepositorio, AgendamentoRepositorio>(); services.AddScoped <ICartaoConvenioRepositorio, CartaoConvenioRepositorio>(); services.AddScoped <IAtendimentoRepositorio, AtendimentoRepositorio>(); // Configuração do JS Report para gerar o relatório em PDF services.AddJsReport(new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .AsUtility() .Create()); }
public async Task <IHttpActionResult> Post(CertificateGeneratorDTO payload) { var ex = new Exception(); var msg = string.Empty; try { var rs = new LocalReporting().UseBinary(JsReportBinary.GetBinary()) .Configure(cfg => cfg.AllowedLocalFilesAccess().BaseUrlAsWorkingDirectory()) .AsUtility().Create(); var report = await rs.RenderAsync(new RenderRequest() { Template = new Template() { Recipe = Recipe.PhantomPdf, Engine = Engine.Handlebars, Content = "Hello from pdf" } }); return(Ok(new { data = string.Empty, msg })); } catch (Exception caughtEx) { return(BadRequest(msg)); } }
static void Main(string[] args) { Console.WriteLine("Initializing local jsreport.exe utility"); var rs = new LocalReporting() .RunInDirectory(Path.Combine(Directory.GetCurrentDirectory(), "jsreport")) .KillRunningJsReportProcesses() .UseBinary(JsReportBinary.GetBinary()) .Configure(cfg => cfg.AllowLocalFilesAccess().FileSystemStore().BaseUrlAsWorkingDirectory()) .AsWebServer() .Create(); rs.StartAsync().Wait(); Console.ReadKey(); Console.WriteLine("Rendering localy stored template jsreport/data/templates/Invoice into invoice.pdf"); var invoiceReport = rs.RenderByNameAsync("Invoice", InvoiceData).Result; invoiceReport.Content.CopyTo(File.OpenWrite("invoice.pdf")); Console.WriteLine("Rendering custom report fully described through the request object into customReport.pdf"); var customReport = rs.RenderAsync(CustomRenderRequest).Result; customReport.Content.CopyTo(File.OpenWrite("customReport.pdf")); byte[] pdfByte = ReadFully(customReport.Content); }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddMvc() .SetCompatibilityVersion(CompatibilityVersion.Version_2_1); // Configuração do JS Report para gerar o relatório em PDF services.AddJsReport(new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .AsUtility() .Create()); // Configurações do DinkToPDF // Verifica qual a arquiterura para utilizar os arquivos necessários var architectureFolder = (IntPtr.Size == 8) ? "64 bit" : "32 bit"; // Encontra o caminho onde estão os arquivos var wkHtmlToPdfPath = Path.Combine(_hostingEnvironment.ContentRootPath, $"v0.12.4\\{architectureFolder}\\libwkhtmltox"); // Carrega os arquivos necessários, passadas as configurações CustomAssemblyLoadContext context = new CustomAssemblyLoadContext(); context.LoadUnmanagedLibrary(wkHtmlToPdfPath); // Configuração do DinkToPdf services.AddSingleton(typeof(IConverter), new SynchronizedConverter(new PdfTools())); // Configuração do conversor de razor views para string services.AddScoped <IViewRenderService, ViewRenderService>(); services.AddCors(options => { options.AddPolicy("AllowDev", builder => builder.WithOrigins("*").AllowAnyHeader() .AllowAnyMethod() ); }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); services.AddIdentity <ApplicationUser, IdentityRole>(opt => { opt.Password.RequireDigit = false; opt.Password.RequiredLength = 4; opt.Password.RequiredUniqueChars = 0; opt.Password.RequireLowercase = false; opt.Password.RequireNonAlphanumeric = false; opt.Password.RequireUppercase = false; }) .AddEntityFrameworkStores <ApplicationDbContext>() .AddDefaultTokenProviders(); // Add application services. services.AddTransient <IEmailSender, EmailSender>(); services.ConfigureApplicationCookie(opt => opt.LoginPath = "/Account/LDAP"); services.AddMvc(); services.AddMvcGrid(); services.AddJsReport(new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .Configure(cfg => cfg.AllowLocalFilesAccess().BaseUrlAsWorkingDirectory()) .AsUtility() .Create()); }
static void Main(string[] args) { var jsreportDirectory = Path.Combine(System.Environment.CurrentDirectory.Substring(0, System.Environment.CurrentDirectory.LastIndexOf("bin")), "jsreport"); Console.WriteLine("Starting jsreport in " + jsreportDirectory); var rs = new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .KillRunningJsReportProcesses() .RunInDirectory(jsreportDirectory) .Configure(cfg => cfg.CreateSamples() .FileSystemStore() .BaseUrlAsWorkingDirectory()) .AsWebServer() .RedirectOutputToConsole() .Create(); rs.StartAsync().Wait(); Process.Start(new ProcessStartInfo("cmd", $"/c start http://localhost:5488")); Console.ReadKey(); rs.KillAsync().Wait(); }
public async Task <string> Generate(object data) { string msg = "success"; try { System.Diagnostics.Debug.WriteLine("Initializing local jsreport.exe utility"); Console.WriteLine("Initializing local jsreport.exe utility"); var rs = new LocalReporting() .RunInDirectory(Path.Combine(Directory.GetCurrentDirectory(), "jsreport")) .KillRunningJsReportProcesses() .UseBinary(JsReportBinary.GetBinary()) .Configure(cfg => cfg.AllowedLocalFilesAccess().FileSystemStore().BaseUrlAsWorkingDirectory()) .AsUtility() .Create(); Console.WriteLine("Rendering localy stored template jsreport/data/templates/Invoice into invoice.pdf"); var studentReport = rs.RenderByNameAsync("ReportTemplate", data).Result; using (var fs = File.Create("ReportCard\\StudentReport.pdf")) { studentReport.Content.CopyTo(fs); fs.Close(); } } catch (Exception ex) { msg = ex.Message; } return(msg); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddJsReport(new LocalReporting().UseBinary(JsReportBinary.GetBinary()).AsUtility().Create()); services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer( Configuration.GetConnectionString("DefaultConnection"))); services.AddDefaultIdentity <ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true) .AddEntityFrameworkStores <ApplicationDbContext>(); services.AddIdentityServer() .AddApiAuthorization <ApplicationUser, ApplicationDbContext>(); services.AddAuthentication() .AddIdentityServerJwt(); services.AddControllersWithViews(); services.AddRazorPages().AddRazorOptions(option => option.ViewLocationFormats.Add("/TemplateViews/{0}Template/{0}Template.cshtml")); // In production, the React files will be served from this directory services.AddSpaStaticFiles(configuration => { configuration.RootPath = "ClientApp/build"; }); }
public HomeController() { rs = new LocalReporting() .KillRunningJsReportProcesses() .UseBinary(JsReportBinary.GetBinary()) .AsUtility() .Create(); }
public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new JsReportFilterAttribute(new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .AsUtility() .Create())); filters.Add(new HandleErrorAttribute()); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddJsReport(new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .AsUtility() .Create()); }
static PDFRender() { reportingService = new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .Configure(cfg => cfg.FileSystemStore().BaseUrlAsWorkingDirectory()) .AsUtility() .Create(); }
public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddJsReport(new LocalReporting().UseBinary(JsReportBinary.GetBinary()).AsUtility().Create()); // Add Applciation Services services.AddScoped <IViewRenderService, ViewRenderService>(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer( Configuration.GetConnectionString("DefaultConnection"))); services.AddIdentity <IdentityUser, IdentityRole>() .AddEntityFrameworkStores <ApplicationDbContext>() .AddDefaultTokenProviders(); // services.AddDefaultIdentity<IdentityUser>() // .AddDefaultUI(UIFramework.Bootstrap4) // .AddEntityFrameworkStores<ApplicationDbContext>(); services.AddMvc(cfg => { cfg.ModelBinderProviders.Insert(0, new InvariantDecimalModelBinderProvider()); } ).SetCompatibilityVersion(CompatibilityVersion.Version_2_2) .AddRazorPagesOptions(options => { options.AllowAreas = true; options.Conventions.AuthorizeAreaFolder("Identity", "/Account/Manage"); options.Conventions.AuthorizeAreaPage("Identity", "/Account/Logout"); }); services.ConfigureApplicationCookie(options => { options.LoginPath = $"/Identity/Account/Login"; options.LogoutPath = $"/Identity/Account/Logout"; options.AccessDeniedPath = $"/Identity/Account/AccessDenied"; }); services.Configure <IdentityOptions>(options => { // Default Password settings. options.Password.RequireDigit = true; options.Password.RequireLowercase = true; options.Password.RequireNonAlphanumeric = false; options.Password.RequireUppercase = true; options.Password.RequiredLength = 6; options.Password.RequiredUniqueChars = 0; }); services.AddJsReport(new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .AsUtility() .Create()); }
public void SetUp() { _rs = new LocalReporting() .KillRunningJsReportProcesses() .UseBinary(JsReportBinary.GetBinary()) .UseContractResolverForDataProperty(new CamelCasePropertyNamesContractResolver()) .AsUtility() .Create(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; }); services.AddTransient(_ => new ApplicationRestClient(Configuration["AppServiceUri"])); services.AddTransient(_ => new ApplicationDbContext(Configuration["ConnectionString"])); services.AddHttpContextAccessor(); bool IsWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); if (IsWindows == true) { services.AddJsReport(new LocalReporting().UseBinary(JsReportBinary.GetBinary()).AsUtility().Create()); } else { services.AddJsReport(new LocalReporting().UseBinary(jsreport.Binary.Linux.JsReportBinary.GetBinary()).AsUtility().Create()); } services.AddControllersWithViews() .AddNewtonsoftJson(); services.AddRazorPages().AddMvcOptions(options => { options.MaxModelValidationErrors = 50; options.ModelBindingMessageProvider.SetValueMustNotBeNullAccessor( _ => "The field is required."); }); services.AddDistributedMemoryCache(); services.AddSession(options => { options.IdleTimeout = TimeSpan.FromHours(2); options.Cookie.SameSite = SameSiteMode.Strict; // Make the session cookie essential options.Cookie.IsEssential = true; }); services.AddAuthentication("CookieAuth") // Sets the default scheme to cookies .AddCookie("CookieAuth", options => { options.AccessDeniedPath = "/Account/AccessDenied"; options.LoginPath = "/Account/Login"; }).Services.ConfigureApplicationCookie(options => { options.SlidingExpiration = true; options.ExpireTimeSpan = TimeSpan.FromHours(12); }); services.AddScoped <IRegistrationRequest, RegistrationRequestRepository>(); services.AddScoped <IFamilyResearch, FamilyResearchRepository>(); services.AddScoped <IUser, UserRepository>(); }
public void SetUp() { _rs = new LocalReporting() .KillRunningJsReportProcesses() .RunInDirectory(Path.Combine(Directory.GetCurrentDirectory(), "..\\..\\..\\jsreportTest")) .Configure((cfg => cfg.FileSystemStore())) .UseBinary(JsReportBinary.GetBinary()) .AsUtility() .Create(); }
public HttpResponseMessage GetMultiple() { var rs = new LocalReporting().UseBinary(JsReportBinary.GetBinary()).AsUtility().Create(); List <string> mensajes = new List <string> { "1", "2", "3" }; List <Stream> streamPdfs = new List <Stream>(); foreach (var m in mensajes) { var report = rs.RenderAsync(new RenderRequest() { Template = new Template() { Recipe = Recipe.PhantomPdf, Engine = Engine.Handlebars, Content = "Hello from pdf, {{message}}", Phantom = new Phantom { Header = "B&A Systems SAS", Footer = "<div style='text-align:center'>Page number {#pageNum}/{#numPages}</div>", } }, Data = new { message = $"B&A Migrando a jsreport for .NET!!! {m}" } }).Result; streamPdfs.Add(report.Content); } byte[] result = null; using (MemoryStream ms = new MemoryStream()) { Document pdfDoc = new Document(PageSize.A4); PdfCopy pdfUnido = new PdfCopy(pdfDoc, ms); pdfDoc.Open(); streamPdfs.ForEach(item => { var itemPdf = new PdfReader(item); pdfUnido.AddDocument(itemPdf); }); pdfDoc.Close(); result = ms.ToArray(); result = ms.ToArray(); } string nombre = "Test Multiple"; HttpResponseMessage response = DescargarPdf(result, nombre); return(response); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <VPMDBContext>(options => options.UseSqlServer(Configuration.GetConnectionString("ConnectionString"))); services.AddControllersWithViews(); services.AddMvc(); services.AddJsReport(new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .AsUtility() .Create()); }
public static void RegisterGlobalFilters(GlobalFilterCollection filters) { var rs = new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .TempDirectory(Path.Combine((string)AppDomain.CurrentDomain.GetData("DataDirectory"), "jsreport-temp")) .AsUtility() .Create(); filters.Add(new JsReportFilterAttribute(rs)); filters.Add(new HandleErrorAttribute()); }
public void SetUp() { _rs = new LocalReporting() .KillRunningJsReportProcesses() .Configure((cfg) => { cfg.TempDirectory = Path.Combine(Path.GetTempPath(), "jsreport with space temp"); return(cfg); }).UseBinary(JsReportBinary.GetBinary()) .AsUtility() .Create(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddJsReport(new LocalReporting().UseBinary(JsReportBinary.GetBinary()).KillRunningJsReportProcesses().AsUtility().Create()); //services.AddDbContext<ApplicationDbContext>(options => // options.UseSqlServer( // Configuration.GetConnectionString("DefaultConnection"))); services.AddDbContextPool <RentCarDbContext>(options => { options.UseSqlServer(Configuration.GetConnectionString("RentCarConnectionSQL")); options.UseLoggerFactory(Microsoft.Extensions.Logging.LoggerFactory.Create(builder => { builder.AddConsole(); })); }); services.AddTransient <IVehicleTypeService, VehicleTypeService>(); services.AddTransient <IVehicleColorService, VehicleColorService>(); services.AddTransient <IFuelTypeService, FuelTypeService>(); services.AddTransient <IFuelTankStateService, FuelTankStateService>(); services.AddTransient <ITransmissionTypeService, TransmissionTypeService>(); services.AddTransient <IManufacturerService, ManufacturerService>(); services.AddTransient <IModelService, ModelService>(); services.AddTransient <IClientService, ClientService>(); services.AddTransient <IShiftTypeService, ShiftTypeService>(); services.AddTransient <IEmployeeService, EmployeeService>(); services.AddTransient <IVehicleService, VehicleService>(); services.AddTransient <ICarRentInformationService, CarRentInformationService>(); services.AddTransient <IVehicleCheckService, VehicleCheckService>(); services.AddTransient <IRentReturnService, RentReturnService>(); services.AddTransient <IRentStateService, RentStateService>(); services.AddTransient <IIdentificationTypeService, IdentificationTypeService>(); services.AddTransient <IClientTypeService, ClientTypeService>(); services.AddDefaultIdentity <RentCarUser>(options => { options.SignIn.RequireConfirmedAccount = false; options.Password.RequireDigit = false; options.Password.RequireLowercase = false; options.Password.RequireNonAlphanumeric = false; options.Password.RequireUppercase = false; options.Password.RequiredLength = 5; options.Password.RequiredUniqueChars = 0; }) .AddEntityFrameworkStores <RentCarDbContext>(); services.AddRazorPages(); services.AddDbContext <RentCarDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("RentCarDBContext"))); }
// public void Configure(IServiceCollection services) // { // services.AddControllersWithViews(); // services.AddJsReport(new LocalReporting() //.UseBinary(JsReportBinary.GetBinary()) //.AsUtility() //.Create()); // } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllersWithViews(); services.AddJsReport(new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .AsUtility() .Create()); services.AddScoped <Microsoft.AspNetCore.Identity.UI.Services.IEmailSender, EmailSender>(); //services.Configure<AuthMessageSenderOptions>(Configuration); services.AddRazorPages(); }