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,59 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Fab2ApprovalSystem.Misc
{
class FTPWrapper
{
string m_OutputFile;
string m_DestinationFileName;
//Functions functions = new Functions();
public FTPWrapper(string outputFile, string destinationFileName)
{
m_OutputFile = outputFile;
m_DestinationFileName = destinationFileName;
using Fab2ApprovalSystem.Models;
namespace Fab2ApprovalSystem.Misc;
internal class FTPWrapper {
private readonly string _OutputFile;
private readonly string _DestinationFileName;
private readonly AppSettings _AppSettings;
public FTPWrapper(AppSettings appSettings, string outputFile, string destinationFileName) {
_OutputFile = outputFile;
_AppSettings = appSettings;
_DestinationFileName = destinationFileName;
}
/// <summary>
///
/// </summary>
public void FTPToSPN() {
FTP ftpLib = new();
//Connect to the FTP server
try {
ftpLib.Connect(_AppSettings.FTPServer, _AppSettings.FTPUser, _AppSettings.FTPPassword);
} catch (Exception ec) {
Functions.WriteEvent(_AppSettings, "Listener - ProcessFile(): FTP Connection Error " + _OutputFile + " - " + ec.Source +
": " + ec.Message, System.Diagnostics.EventLogEntryType.Error);
}
/// <summary>
///
/// </summary>
public void FTPToSPN()
{
FTP ftpLib = new FTP();
//Connect to the FTP server
try
{
ftpLib.Connect(Functions.FTPServer(), Functions.FTPUser(), Functions.FTPPassword());
}
catch (Exception ec)
{
Functions.WriteEvent("Listener - ProcessFile(): FTP Connection Error " + m_OutputFile + " - " + ec.Source +
": " + ec.Message, System.Diagnostics.EventLogEntryType.Error);
}
//Upload the file
try
{
int pct = 0;
ftpLib.OpenUpload(m_OutputFile, m_DestinationFileName);
while (ftpLib.DoUpload() > 0)
pct = (int)((ftpLib.BytesTotal * 100) / ftpLib.FileSize);
Functions.WriteEvent(m_OutputFile + " was sucessfully FTPed to SPN.", System.Diagnostics.EventLogEntryType.Information);
}
catch (Exception eu)
{
Functions.WriteEvent("MRB - FTPToSPN(): FTP Upload Error " + m_OutputFile + " - " + eu.Source +
": " + eu.Message, System.Diagnostics.EventLogEntryType.Error);
throw new Exception(eu.Source + ": " + eu.Message);
}
//Upload the file
try {
int pct = 0;
ftpLib.OpenUpload(_OutputFile, _DestinationFileName);
while (ftpLib.DoUpload() > 0)
pct = (int)((ftpLib.BytesTotal * 100) / ftpLib.FileSize);
Functions.WriteEvent(_AppSettings, _OutputFile + " was sucessfully FTPed to SPN.", System.Diagnostics.EventLogEntryType.Information);
} catch (Exception eu) {
Functions.WriteEvent(_AppSettings, "MRB - FTPToSPN(): FTP Upload Error " + _OutputFile + " - " + eu.Source +
": " + eu.Message, System.Diagnostics.EventLogEntryType.Error);
throw new Exception(eu.Source + ": " + eu.Message);
}
}
}