Get chart file a bit quicker from DB
This commit is contained in:
@@ -51,6 +51,23 @@ namespace LeafWeb.Core.DAL
|
||||
return _db.LeafInputs.FirstOrDefault(li => li.Id == id);
|
||||
}
|
||||
|
||||
public LeafOutputFile GetLeafOutput_ChartFile(int leafInputId)
|
||||
{
|
||||
return GetLeafOutput_FilenameLike(leafInputId, LeafOutputFile.Filename_LeafChart);
|
||||
}
|
||||
|
||||
private LeafOutputFile GetLeafOutput_FilenameLike(int leafInputId, string filename)
|
||||
{
|
||||
var leafOutputChartFile =
|
||||
from leafInput in _db.LeafInputs
|
||||
where leafInput.Id == leafInputId
|
||||
from leafOutput in leafInput.OutputFiles
|
||||
where leafOutput.Filename.Contains(filename)
|
||||
select leafOutput;
|
||||
|
||||
return leafOutputChartFile.FirstOrDefault();
|
||||
}
|
||||
|
||||
public LeafInput GetLeafInput(string uniqueToken)
|
||||
{
|
||||
return _db.LeafInputs.FirstOrDefault(li => li.UniqueToken == uniqueToken);
|
||||
|
||||
@@ -3,6 +3,11 @@ namespace LeafWeb.Core.Entities
|
||||
{
|
||||
public class LeafOutputFile
|
||||
{
|
||||
// convention for the filename which LeafCharter uses
|
||||
public const string Filename_LeafChart = "leafgascomparison";
|
||||
public const string Filename_ErrorMessage = "errormessage";
|
||||
public const string Filename_WarningMessage = "warningmessage";
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public virtual LeafInput LeafInput { get; set; }
|
||||
@@ -11,9 +16,8 @@ namespace LeafWeb.Core.Entities
|
||||
|
||||
public byte[] Contents { get; set; }
|
||||
|
||||
// convention for the filename which LeafCharter uses
|
||||
public bool IsLeafChartFile => Filename?.Contains("leafgascomparison") ?? false;
|
||||
public bool IsErrorMessage => Filename?.Contains("errormessage") ?? false;
|
||||
public bool IsWarningMessage => Filename?.Contains("warningmessage") ?? false;
|
||||
public bool IsLeafChartFile => Filename?.Contains(Filename_LeafChart) ?? false;
|
||||
public bool IsErrorMessage => Filename?.Contains(Filename_ErrorMessage) ?? false;
|
||||
public bool IsWarningMessage => Filename?.Contains(Filename_WarningMessage) ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user