Organize Piscal Service items
Add nlog, PiscalQueueManager modified: Core.Tests/Remote/PiscalSshClientTests.cs modified: Core/DAL/DataService.cs modified: Core/Remote/IPiscalClient.cs modified: Core/Remote/PiscalSshClient.cs new file: Web/Attributes/ActionLogAttribute.cs modified: Web/Controllers/ControllerBase.cs modified: Web/Controllers/LeafInputController.cs modified: Web/Controllers/LeafOutputController.cs new file: Web/NLog.config new file: Web/NLog.xsd new file: Web/Services/PiscalQueueManager.cs modified: Web/Services/PiscalService.cs modified: Web/Startup.cs modified: Web/Web.csproj modified: Web/packages.config Ignore logs Organize piscal queue manager modified: Core/Entities/LeafInputFile.cs modified: Web/Controllers/LeafInputController.cs renamed: Web/Startup.cs -> Web/HangfireStartup.cs modified: Web/Services/PiscalQueueManager.cs modified: Web/Web.csproj cleanup usings in leafinputcontroller
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Hangfire;
|
||||
using LeafWeb.Core.Entities;
|
||||
using LeafWeb.Core.Remote;
|
||||
using LeafWeb.Web.Attributes;
|
||||
using LeafWeb.Web.ViewModels;
|
||||
using LeafWeb.Web.ViewModels.LeafInput;
|
||||
using NLog;
|
||||
|
||||
namespace LeafWeb.Web.Controllers
|
||||
{
|
||||
@@ -57,6 +55,7 @@ namespace LeafWeb.Web.Controllers
|
||||
|
||||
[HttpParamAction]
|
||||
[HttpPost]
|
||||
[ActionLog]
|
||||
public ActionResult Confirm(CreateViewModel viewModel)
|
||||
{
|
||||
// directory name is the sessionID
|
||||
@@ -82,17 +81,15 @@ namespace LeafWeb.Web.Controllers
|
||||
|
||||
DeleteBackloadDirectory(Session.SessionID);
|
||||
|
||||
foreach (var file in leafInput.Files.Select(f => new PiscalLeafInputFile(f)))
|
||||
{
|
||||
BackgroundJob.Enqueue(() => ProcessLeafInput(file));
|
||||
}
|
||||
|
||||
var msg = $"A data set has submitted for '{viewModel.Identifier}' from '{viewModel.SiteId}'. " + Environment.NewLine
|
||||
+ $"When complete, an email will be delivered to {viewModel.Name} <{viewModel.Email}> with results.";
|
||||
|
||||
SetStatusMessage(HttpUtility.HtmlEncode(msg),StatusType.Success);
|
||||
|
||||
LogManager.GetCurrentClassLogger().Info(msg);
|
||||
|
||||
HangfireStartup.TriggerPiscalProcessQueue();
|
||||
|
||||
SetStatusMessage(
|
||||
HttpUtility.HtmlEncode(
|
||||
$"A data set has submitted for '{viewModel.Identifier}' from '{viewModel.SiteId}'. " + Environment.NewLine
|
||||
+ $"When complete, an email will be delivered to {viewModel.Name} <{viewModel.Email}> with results."),
|
||||
StatusType.Success);
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
@@ -100,12 +97,6 @@ namespace LeafWeb.Web.Controllers
|
||||
return View("Index", viewModel);
|
||||
}
|
||||
|
||||
public void ProcessLeafInput(PiscalLeafInputFile leafInputFile)
|
||||
{
|
||||
var piscalSshClient = new PiscalSshClient(ConfigurationManager.ConnectionStrings["PiscalServer"].ConnectionString);
|
||||
piscalSshClient.SubmitLeafInputFile(leafInputFile);
|
||||
}
|
||||
|
||||
private FileInfo[] GetBackloadDirectoryFiles(string directoryName)
|
||||
{
|
||||
var path = Path.Combine(Server.MapPath("~/Files/"), directoryName + "\\");
|
||||
|
||||
Reference in New Issue
Block a user