Ran formatting through code
This commit is contained in:
@ -3,62 +3,57 @@ using ReportingServices.Shared.HelperClasses;
|
||||
using ReportingServices.Shared.Models.ProductionReport;
|
||||
using ReportingServices.Shared.ViewModels.ProductionReport;
|
||||
|
||||
namespace ReportingServices.UI.Controllers
|
||||
namespace ReportingServices.UI.Controllers;
|
||||
|
||||
public class ProductionReportController : Controller
|
||||
{
|
||||
public class ProductionReportController : Controller
|
||||
private readonly ILogger<ProductionReportController> _logger;
|
||||
private readonly string _dailyRptFilePath = "wwwroot/Assets/DailyReportInfo.json";
|
||||
private readonly string _toolStateOwnerFilePath = "wwwroot/Assets/ToolStates.json";
|
||||
private readonly string _baseDBUrl;
|
||||
|
||||
public ProductionReportController(ILogger<ProductionReportController> logger)
|
||||
{
|
||||
private readonly ILogger<ProductionReportController> _logger;
|
||||
private readonly string _dailyRptFilePath = "wwwroot/Assets/DailyReportInfo.json";
|
||||
private readonly string _toolStateOwnerFilePath = "wwwroot/Assets/ToolStates.json";
|
||||
private readonly string _baseDBUrl;
|
||||
_logger = logger;
|
||||
_baseDBUrl = "http://localhost:50201/api/";
|
||||
|
||||
public ProductionReportController(ILogger<ProductionReportController> logger)
|
||||
_logger.LogInformation("Base Database Address: {baseUrl}", _baseDBUrl);
|
||||
}
|
||||
|
||||
public IActionResult Index() => View();
|
||||
|
||||
public IActionResult DailyReport()
|
||||
{
|
||||
string baseScrapeDbUrl = _baseDBUrl + "ScrapeDB/";
|
||||
|
||||
try
|
||||
{
|
||||
_logger = logger;
|
||||
_baseDBUrl = "http://localhost:50201/api/";
|
||||
DailyReport dailyReport = DailyReportHelper.SetUpDailyReport(_logger, baseScrapeDbUrl);
|
||||
Dictionary<string, List<string>> toolStateOwners = JsonFileHandler.LoadJSONFile<Dictionary<string, List<string>>>(_toolStateOwnerFilePath);
|
||||
|
||||
_logger.LogInformation("Base Database Address: {baseUrl}", _baseDBUrl);
|
||||
dailyReport.ToolStatesByOwner = toolStateOwners;
|
||||
|
||||
return View(dailyReport);
|
||||
}
|
||||
|
||||
|
||||
public IActionResult Index()
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogCritical(ex, "Failed to load report");
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult DailyReport()
|
||||
{
|
||||
string baseScrapeDbUrl = _baseDBUrl + "ScrapeDB/";
|
||||
|
||||
try
|
||||
{
|
||||
DailyReport dailyReport = DailyReportHelper.SetUpDailyReport(_logger, baseScrapeDbUrl);
|
||||
Dictionary<string, List<string>> toolStateOwners = JsonFileHandler.LoadJSONFile<Dictionary<string, List<string>>>(_toolStateOwnerFilePath);
|
||||
|
||||
dailyReport.ToolStatesByOwner = toolStateOwners;
|
||||
|
||||
return View(dailyReport);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogCritical(ex, "Failed to load report");
|
||||
return View();
|
||||
}
|
||||
}
|
||||
|
||||
public IActionResult EditDailyReport()
|
||||
{
|
||||
ManualReportEntries entries = JsonFileHandler.LoadJSONFile<ManualReportEntries>(_dailyRptFilePath);
|
||||
|
||||
return View(entries);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult EditDailyReport(ManualReportEntries rpt)
|
||||
{
|
||||
JsonFileHandler.SaveJSONFile(rpt, _dailyRptFilePath);
|
||||
|
||||
return RedirectToAction("DailyReport");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IActionResult EditDailyReport()
|
||||
{
|
||||
ManualReportEntries entries = JsonFileHandler.LoadJSONFile<ManualReportEntries>(_dailyRptFilePath);
|
||||
|
||||
return View(entries);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult EditDailyReport(ManualReportEntries rpt)
|
||||
{
|
||||
JsonFileHandler.SaveJSONFile(rpt, _dailyRptFilePath);
|
||||
|
||||
return RedirectToAction("DailyReport");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user