public CodeGenerator( IEntityGenerator entityGenerator, IServiceGenerator serviceGenerator, IViewGenerator viewGenerator, IControllerGenerator controllerGenerator) { _entityGenerator = entityGenerator; _serviceGenerator = serviceGenerator; _viewGenerator = viewGenerator; _controllerGenerator = controllerGenerator; }
public EntitiesCodeGenerator( IEntityGenerator entityGenerator, IServiceGenerator serviceGenerator, IViewGenerator viewGenerator, IControllerGenerator controllerGenerator, BaseGeneratorDatabaseCreator databaseGenerator) : base(databaseGenerator) { _entityGenerator = entityGenerator; _serviceGenerator = serviceGenerator; _viewGenerator = viewGenerator; _controllerGenerator = controllerGenerator; }
public PdfApplicationDocumentGenerator( IDataContext dataContext, IPathProvider templatePathProvider, IViewGenerator viewGenerator, IConfiguration configuration, IPdfGenerator pdfGenerator, ILogger <PdfApplicationDocumentGenerator> logger) { //Consistent null checks _dataContext = dataContext ?? throw new ArgumentNullException(nameof(dataContext)); _templatePathProvider = templatePathProvider ?? throw new ArgumentNullException(nameof(templatePathProvider)); _view_Generator = viewGenerator ?? throw new ArgumentNullException(nameof(viewGenerator)); _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _pdfGenerator = pdfGenerator ?? throw new ArgumentNullException(nameof(pdfGenerator)); }
//NB This assumes that the parameters passed in are from derived classes which already implement their respective interfaces //Achieves abstraction and DI public PdfApplicationDocumentGenerator( IDataContext dataContext, IPathProvider templatePathProvider, IViewGenerator viewGenerator, IConfiguration configuration, IPdfGenerator pdfGenerator, ILogger<PdfApplicationDocumentGenerator> logger) { //Initialize the attributes //Check for initializing with null value parameters _dataContext = dataContext ?? throw new ArgumentNullException(nameof(dataContext)); _templatePathProvider = templatePathProvider ?? throw new ArgumentNullException(nameof(templatePathProvider)); _viewGenerator = viewGenerator ?? throw new ArgumentNullException(nameof(viewGenerator)); _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _pdfGenerator = pdfGenerator ?? throw new ArgumentNullException(nameof(pdfGenerator)); }
public PdfApplicationDocumentGenerator( IDataContext dataContext, IPathProvider templatePathProvider, IViewGenerator viewGenerator, IConfiguration configuration, IPdfGenerator pdfGenerator, ILogger <PdfApplicationDocumentGenerator> logger) { if (dataContext != null) { throw new ArgumentNullException(nameof(dataContext)); } DataContext = dataContext; _templatePathProvider = templatePathProvider ?? throw new ArgumentNullException("templatePathProvider"); View_Generator = viewGenerator; _configuration = configuration; _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _pdfGenerator = pdfGenerator; }
public static string AppPending(Application application, IPathProvider _templatePathProvider, IConfiguration _configuration, IViewGenerator View_Generator, string baseUri) { string view; string path = _templatePathProvider.Get("PendingApplication"); PendingApplicationViewModel vm = new PendingApplicationViewModel { ReferenceNumber = application.ReferenceNumber, State = application.State.ToDescription(), FullName = application.Person.FirstName + " " + application.Person.Surname, AppliedOn = application.Date, SupportEmail = _configuration.SupportEmail, Signature = _configuration.Signature }; return(view = View_Generator.GenerateFromPath(string.Format("{0}{1}", baseUri, path), vm)); }
public static string AppInReview(Application application, IPathProvider _templatePathProvider, IConfiguration _configuration, IViewGenerator View_Generator, string baseUri) { string view; var templatePath = _templatePathProvider.Get("InReviewApplication"); var inReviewMessage = "Your application has been placed in review" + application.CurrentReview.Reason switch { { } reason when reason.Contains("address") => " pending outstanding address verification for FICA purposes.", { } reason when reason.Contains("bank") => " pending outstanding bank account verification.", _ => " because of suspicious account behaviour. Please contact support ASAP." }; var inReviewApplicationViewModel = new InReviewApplicationViewModel(); inReviewApplicationViewModel.ReferenceNumber = application.ReferenceNumber; inReviewApplicationViewModel.State = application.State.ToDescription(); inReviewApplicationViewModel.FullName = string.Format( "{0} {1}", application.Person.FirstName, application.Person.Surname); inReviewApplicationViewModel.LegalEntity = application.IsLegalEntity ? application.LegalEntity : null; inReviewApplicationViewModel.PortfolioFunds = application.Products.SelectMany(p => p.Funds); inReviewApplicationViewModel.PortfolioTotalAmount = application.Products.SelectMany(p => p.Funds) .Select(f => (f.Amount - f.Fees) * _configuration.TaxRate) .Sum(); inReviewApplicationViewModel.InReviewMessage = inReviewMessage; inReviewApplicationViewModel.InReviewInformation = application.CurrentReview; inReviewApplicationViewModel.AppliedOn = application.Date; inReviewApplicationViewModel.SupportEmail = _configuration.SupportEmail; inReviewApplicationViewModel.Signature = _configuration.Signature; return(view = View_Generator.GenerateFromPath($"{baseUri}{templatePath}", inReviewApplicationViewModel)); } }
public static string AppActivated(Application application, IPathProvider _templatePathProvider, IConfiguration _configuration, IViewGenerator View_Generator, string baseUri) { string view; string path = _templatePathProvider.Get("ActivatedApplication"); ActivatedApplicationViewModel vm = new ActivatedApplicationViewModel { ReferenceNumber = application.ReferenceNumber, State = application.State.ToDescription(), FullName = $"{application.Person.FirstName} {application.Person.Surname}", LegalEntity = application.IsLegalEntity ? application.LegalEntity : null, PortfolioFunds = application.Products.SelectMany(p => p.Funds), PortfolioTotalAmount = application.Products.SelectMany(p => p.Funds) .Select(f => (f.Amount - f.Fees) * _configuration.TaxRate) .Sum(), AppliedOn = application.Date, SupportEmail = _configuration.SupportEmail, Signature = _configuration.Signature }; return(view = View_Generator.GenerateFromPath(baseUri + path, vm)); }
/// <summary> /// Initializes a new instance of the <see cref="EmbeddedViewFileProvider"/> class. /// </summary> /// <param name="siteRoot">Root directory of the web site</param> /// <param name="viewGenerator">View fixer</param> /// <example> /// <code> /// var embeddedProvider = new EmbeddedViewFileProvider(VirtualPathUtility.ToAbsolute("~/"), new ExternalViewFixer()); /// </code> /// </example> public EmbeddedViewFileProvider(string siteRoot, IViewGenerator viewGenerator) : base(siteRoot) { _viewGenerator = viewGenerator; AllowedFileExtensions = new[] { "cshtml", "ascx", "aspx" }; }
/// <summary> /// Initializes a new instance of the <see cref="EmbeddedViewFileProvider"/> class. /// </summary> /// <param name="siteRoot">Root directory of the web site</param> /// <example> /// <code> /// var embeddedProvider = new EmbeddedViewFileProvider(VirtualPathUtility.ToAbsolute("~/")); /// </code> /// </example> public EmbeddedViewFileProvider(string siteRoot) : base(siteRoot) { _viewGenerator = DependencyResolver.Current.GetService<IViewGenerator>(); AllowedFileExtensions = new[] { "cshtml", "ascx", "aspx" }; }
public Runner(ISourceMonitor sourceMonitor, IViewController viewController, IViewGenerator viewGenerator) { SourceMonitor = sourceMonitor; ViewController = viewController; ViewGenerator = viewGenerator; SourceMonitor.SourceChanged += SourceMonitor_SourceChanged; }
/// <summary> /// Initializes a new instance of the <see cref="EmbeddedViewFileProvider"/> class. /// </summary> /// <param name="siteRoot">Root directory of the web site</param> /// <param name="viewGenerator">View fixer</param> /// <example> /// <code> /// var embeddedProvider = new EmbeddedViewFileProvider(VirtualPathUtility.ToAbsolute("~/"), new ExternalViewFixer()); /// </code> /// </example> public EmbeddedViewFileProvider(string siteRoot, IViewGenerator viewGenerator) : base(siteRoot) { _viewGenerator = viewGenerator; AllowedFileExtensions = new[] { "cshtml", "ascx", "aspx" }; }
/// <summary> /// Initializes a new instance of the <see cref="EmbeddedViewFileProvider"/> class. /// </summary> /// <param name="siteRoot">Root directory of the web site</param> /// <example> /// <code> /// var embeddedProvider = new EmbeddedViewFileProvider(VirtualPathUtility.ToAbsolute("~/")); /// </code> /// </example> public EmbeddedViewFileProvider(string siteRoot) : base(siteRoot) { _viewGenerator = DependencyResolver.Current.GetService <IViewGenerator>(); AllowedFileExtensions = new[] { "cshtml", "ascx", "aspx" }; }
/// <summary> /// Initializes a new instance of the <see cref="PageNavigation"/> class. /// </summary> /// <param name="viewGenerator">The view generator.</param> public PageNavigation(IViewGenerator viewGenerator) { _viewGenerator = viewGenerator; }