Files
LeafWeb/Web/Services/PiscalService.cs
T
poprhythm 10cd2986cf 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
2016-03-01 07:35:58 -05:00

45 lines
1.2 KiB
C#

using System.Collections.Generic;
using System.Configuration;
using LeafWeb.Core.Entities;
using LeafWeb.Core.Remote;
namespace LeafWeb.Web.Services
{
public class PiscalService
{
private readonly IPiscalClient _piscalClient;
public PiscalService(IPiscalClient piscalClient)
{
_piscalClient = piscalClient;
}
public PiscalService() : this(new PiscalSshClient(ConfigurationManager.ConnectionStrings["PiscalServer"].ConnectionString))
{
}
public void RunLeafInputFile(LeafInputFile leafInputFile)
{
var inputFile = new PiscalLeafInputFile(leafInputFile);
_piscalClient.RunLeafInputFile(inputFile);
}
public PiscalStatus GetLeafInputFileStatus(LeafInputFile leafInputFile)
{
var inputFile = new PiscalLeafInputFile(leafInputFile);
return _piscalClient.GetLeafInputFileStatus(inputFile);
}
public IEnumerable<LeafOutputFile> RetrieveLeafOutputFile(LeafInputFile leafInputFile)
{
var inputFile = new PiscalLeafInputFile(leafInputFile);
var piscalLeafOutputFiles = _piscalClient.RetrieveLeafOutput(inputFile);
foreach (var file in piscalLeafOutputFiles)
{
var leafOutputFile = file.GetLeafOutputFile();
leafOutputFile.LeafInputFile = leafInputFile;
yield return leafOutputFile;
}
}
}
}