Tasks 184281, 184799, 184800, 184801 and 184802

Align .editorconfig files

Move Controller logic to DMO classes

GlobalVars.AppSettings = Models.AppSettings.GetFromConfigurationManager();

Question EditorConfig
Project level editorconfig
Format White Spaces
AppSetting when EnvironmentVariable not set
Corrective Actions Tests
Schedule Actions Tests
DMO Tests
Controller Tests

Get ready to use VSCode IDE
This commit is contained in:
2024-12-04 11:58:13 -07:00
parent 538b1f817e
commit b1c6903c1c
150 changed files with 29146 additions and 33456 deletions

View File

@ -1,4 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
#if !NET8
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="PdfViewController.cs" company="SemanticArchitecture">
// http://www.SemanticArchitecture.net pkalkie@gmail.com
// </copyright>
@ -7,21 +9,18 @@
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Fab2ApprovalSystem.PdfGenerator
{
namespace Fab2ApprovalSystem.PdfGenerator {
using System.Web.Mvc;
using System.IO;
/// <summary>
/// Extends the controller with functionality for rendering PDF views
/// </summary>
public class PdfViewController : Controller
{
public class PdfViewController : Controller {
private readonly HtmlViewRenderer htmlViewRenderer;
private readonly StandardPdfRenderer standardPdfRenderer;
public PdfViewController()
{
public PdfViewController() {
this.htmlViewRenderer = new HtmlViewRenderer();
this.standardPdfRenderer = new StandardPdfRenderer();
}
@ -29,12 +28,11 @@ namespace Fab2ApprovalSystem.PdfGenerator
/// <summary>
///
/// </summary>
/// <param name="pageTitle"></param>
/// <param name="viewName"></param>
/// <param name="model"></param>
/// <returns></returns>
protected ActionResult ViewPdf(string pageTitle, string viewName, object model)
{
protected ActionResult ViewPdf(string pageTitle, string viewName, object model) {
// Render the view html to a string.
string htmlText = this.htmlViewRenderer.RenderViewToString(this, viewName, model);
@ -48,22 +46,22 @@ namespace Fab2ApprovalSystem.PdfGenerator
/// <summary>
///
/// </summary>
/// <param name="fileName"></param>
/// <param name="viewName"></param>
/// <param name="model"></param>
protected void SavePdf(string fileName, string viewName, object model)
{
protected void SavePdf(string fileName, string viewName, object model) {
// Render the view html to a string.
string htmlText = this.htmlViewRenderer.RenderViewToString(this, viewName, model);
// Let the html be rendered into a PDF document through iTextSharp.
byte[] buffer = standardPdfRenderer.Render(htmlText, "");
using (FileStream fs = new FileStream(fileName, FileMode.Create))
{
using (FileStream fs = new FileStream(fileName, FileMode.Create)) {
fs.Write(buffer, 0, buffer.Length);
}
}
}
}
}
#endif