fix arrangement
This commit is contained in:
parent
d5e5fe9a3f
commit
d9fe781343
@ -278,7 +278,10 @@ namespace PSTW_CentralSystem.Areas.MMS.Controllers
|
|||||||
// ===== 1. NEW SQL QUERY APPROACH =====
|
// ===== 1. NEW SQL QUERY APPROACH =====
|
||||||
var query = @"
|
var query = @"
|
||||||
SELECT
|
SELECT
|
||||||
marine.*, station.LocationName, state.StateName,user.FullName,level.LevelName
|
marine.*,
|
||||||
|
station.LocationName,
|
||||||
|
state.StateName,
|
||||||
|
user.FullName,level.LevelName
|
||||||
FROM tbl_marine_tarball marine
|
FROM tbl_marine_tarball marine
|
||||||
JOIN tbl_marine_station station ON marine.StationID = station.StationID
|
JOIN tbl_marine_station station ON marine.StationID = station.StationID
|
||||||
JOIN tbl_state state ON station.StateID = state.StateID
|
JOIN tbl_state state ON station.StateID = state.StateID
|
||||||
@ -305,48 +308,38 @@ namespace PSTW_CentralSystem.Areas.MMS.Controllers
|
|||||||
var sampleTimePrefix = ((int)tarball.TimeSample.TotalHours).ToString("D2") +
|
var sampleTimePrefix = ((int)tarball.TimeSample.TotalHours).ToString("D2") +
|
||||||
tarball.TimeSample.Minutes.ToString("D2");
|
tarball.TimeSample.Minutes.ToString("D2");
|
||||||
var stationFolder = Path.Combine(PhotoBasePath, tarball.StationID);
|
var stationFolder = Path.Combine(PhotoBasePath, tarball.StationID);
|
||||||
|
|
||||||
|
//Image collection
|
||||||
var stationImages = new Dictionary<string, string>();
|
var stationImages = new Dictionary<string, string>();
|
||||||
|
|
||||||
if (Directory.Exists(stationFolder))
|
if (Directory.Exists(stationFolder))
|
||||||
{
|
{
|
||||||
var allImages = Directory.GetFiles(stationFolder)
|
var imageTypes = new Dictionary<string, string>
|
||||||
.Where(f =>
|
|
||||||
{
|
{
|
||||||
var fileName = Path.GetFileNameWithoutExtension(f);
|
{ "LEFTSIDECOASTALVIEW", null },
|
||||||
var parts = fileName.Split('_');
|
{ "RIGHTSIDECOASTALVIEW", null },
|
||||||
return parts.Length >= 3 &&
|
{ "DRAWINGVERTICALLINES", null },
|
||||||
parts[0] == tarball.StationID &&
|
{ "DRAWINGHORIZONTALLINES", null },
|
||||||
parts[1] == sampleDateString &&
|
{ "OPTIONAL01", null }, // Will remain null if not found
|
||||||
parts[2].StartsWith(sampleTimePrefix);
|
{ "OPTIONAL02", null },
|
||||||
})
|
{ "OPTIONAL03", null },
|
||||||
.ToList();
|
{ "OPTIONAL04", null }
|
||||||
|
|
||||||
var imageTypes = new List<string>
|
|
||||||
{
|
|
||||||
"LEFTSIDECOASTALVIEW",
|
|
||||||
"RIGHTSIDECOASTALVIEW",
|
|
||||||
"DRAWINGVERTICALLINES",
|
|
||||||
"DRAWINGHORIZONTALLINES",
|
|
||||||
"OPTIONAL01",
|
|
||||||
"OPTIONAL02",
|
|
||||||
"OPTIONAL03",
|
|
||||||
"OPTIONAL04"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var imagePath in allImages)
|
foreach (var imagePath in Directory.GetFiles(stationFolder))
|
||||||
{
|
{
|
||||||
var fileName = Path.GetFileNameWithoutExtension(imagePath);
|
var fileName = Path.GetFileNameWithoutExtension(imagePath);
|
||||||
foreach(var type in imageTypes)
|
foreach (var type in imageTypes.Keys.ToList())
|
||||||
{
|
{
|
||||||
if (fileName.EndsWith(type, StringComparison.OrdinalIgnoreCase))
|
if (fileName.EndsWith(type, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
stationImages[type] = imagePath;
|
imageTypes[type] = imagePath;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stationImages = imageTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Mandatory images
|
//Mandatory images
|
||||||
var mandatoryImages = new List<string>
|
var mandatoryImages = new List<string>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,7 +7,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
|
|||||||
|
|
||||||
namespace PSTW_CentralSystem.Areas.MMS.Models.PDFGenerator
|
namespace PSTW_CentralSystem.Areas.MMS.Models.PDFGenerator
|
||||||
{
|
{
|
||||||
public class TarBallPDF(string stationID, string stateName, string locationName,
|
public class TarBallPDF(string stateName, string stationID, string locationName,
|
||||||
string longitude, string latitude, DateTime dateSample, TimeSpan timeSample,
|
string longitude, string latitude, DateTime dateSample, TimeSpan timeSample,
|
||||||
string classifyID, bool tarBallYes, bool tarBallNo, bool isSand, bool isNonSandy,
|
string classifyID, bool tarBallYes, bool tarBallNo, bool isSand, bool isNonSandy,
|
||||||
bool isCoquina, string photoPath1, string photoPath2, string photoPath3, string photoPath4,
|
bool isCoquina, string photoPath1, string photoPath2, string photoPath3, string photoPath4,
|
||||||
@ -17,8 +17,9 @@ namespace PSTW_CentralSystem.Areas.MMS.Models.PDFGenerator
|
|||||||
)
|
)
|
||||||
: IDocument
|
: IDocument
|
||||||
{
|
{
|
||||||
private readonly string _stationId = stationID;
|
//have to be arranged accordingly(?)
|
||||||
private readonly string _stateName = stateName;
|
private readonly string _stateName = stateName;
|
||||||
|
private readonly string _stationId = stationID;
|
||||||
private readonly string _locationName = locationName;
|
private readonly string _locationName = locationName;
|
||||||
private readonly string _longitude = longitude;
|
private readonly string _longitude = longitude;
|
||||||
private readonly string _latitude = latitude;
|
private readonly string _latitude = latitude;
|
||||||
@ -343,10 +344,10 @@ namespace PSTW_CentralSystem.Areas.MMS.Models.PDFGenerator
|
|||||||
table.Cell().Element(CellStyle).Text("Signature").FontSize(12);
|
table.Cell().Element(CellStyle).Text("Signature").FontSize(12);
|
||||||
table.Cell().Element(CellStyle).Text("");
|
table.Cell().Element(CellStyle).Text("");
|
||||||
table.Cell().Element(CellStyle).Text("Date").FontSize(12);
|
table.Cell().Element(CellStyle).Text("Date").FontSize(12);
|
||||||
table.Cell().Element(CellStyle).Text("");
|
table.Cell().Element(CellStyle).Text(_dateSample.ToString("yyyy/MM/dd")).FontSize(12);
|
||||||
|
|
||||||
table.Cell().Element(CellStyle).Text("Designation").FontSize(12);
|
table.Cell().Element(CellStyle).Text("Designation").FontSize(12);
|
||||||
table.Cell().ColumnSpan(3).Element(CellStyle).Text(_levelName);
|
table.Cell().ColumnSpan(3).Element(CellStyle).Text(_levelName).FontSize(12);
|
||||||
|
|
||||||
table.Cell().RowSpan(2).Element(CellStyle)
|
table.Cell().RowSpan(2).Element(CellStyle)
|
||||||
.Text(text =>
|
.Text(text =>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user