Replace CntrlComparison with LeafGasComparison
This commit is contained in:
@@ -34,20 +34,20 @@ namespace LeafWeb.Web.Controllers
|
||||
.FirstOrDefault(f => f.IsLeafChartFile);
|
||||
|
||||
if (leafOutputFile == null)
|
||||
return View(); // TODO: break
|
||||
throw new ArgumentOutOfRangeException(); // TODO: break
|
||||
|
||||
return File(GetChartImage(leafOutputFile.Contents, number), "image/png", "mychart.png");
|
||||
}
|
||||
|
||||
private byte[] GetChartImage(byte[] fileContents, int number, ChartImageFormat format = ChartImageFormat.Png)
|
||||
{
|
||||
CntrlComparison[] cntrlComparison;
|
||||
using (var parser = new CntrlComparisonParser(fileContents))
|
||||
cntrlComparison = parser.Parse();
|
||||
LeafGasComparison[] leafGasComparisons;
|
||||
using (var parser = new LeafGasComparisonParser(fileContents))
|
||||
leafGasComparisons = parser.Parse();
|
||||
|
||||
var curveData = CurveDataConverter.Convert(cntrlComparison).ToArray();
|
||||
var curveData = CurveDataConverter.Convert(leafGasComparisons).ToArray();
|
||||
|
||||
var charts = LeafWebCharter.ProduceCharts(curveData[2]);
|
||||
var charts = LeafWebCharter.ProduceCharts(curveData[0]);
|
||||
|
||||
//Image.FromFile()
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace LeafWeb.Web.ViewModels.ResultStatus
|
||||
public string LeafInputIdentifier { get; set; }
|
||||
public string LeafInputSiteId { get; set; }
|
||||
public string LeafInputPhotosynthesisType { get; set; }
|
||||
public bool HasLeafChart { get; set; }
|
||||
public string CurrentStatus { get; set; }
|
||||
public string[] ErrorMessages { get; set; }
|
||||
//public string[] LeafOutputFilenames { get; set; }
|
||||
@@ -25,6 +26,7 @@ namespace LeafWeb.Web.ViewModels.ResultStatus
|
||||
{
|
||||
cfg.CreateMap<Core.Entities.LeafInput, ResultStatusViewModel>()
|
||||
.ForMember(dest => dest.LeafInputId, opt => opt.MapFrom(src => src.Id))
|
||||
.ForMember(dest => dest.HasLeafChart, opt => opt.ResolveUsing(src => src.OutputFiles.Any(o => o.IsLeafChartFile)))
|
||||
//.ForMember(dest => dest.LeafOutputFilenames,
|
||||
// opt => opt.ResolveUsing(
|
||||
// src =>
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
|
||||
@for (int i = 0; i < 8; i++)
|
||||
{
|
||||
<img src="@Url.Action("LeafCharts", new {leafInputFileId = Model, number=@i})" alt="image" height="@LeafWebCharter.ChartHeight" width="@LeafWebCharter.ChartWidth" />
|
||||
<img src="@Url.Action("LeafCharts", new {leafInputId = Model, number=@i})" alt="image" height="@LeafWebCharter.ChartHeight" width="@LeafWebCharter.ChartWidth" />
|
||||
}
|
||||
@@ -12,7 +12,11 @@
|
||||
grid.Column("LeafInputIdentifier", "Identifier"),
|
||||
grid.Column("LeafInputSiteId", "Site Id"),
|
||||
grid.Column("LeafInputName", "Submitted By"),
|
||||
grid.Column("CurrentStatus", "Status")
|
||||
),
|
||||
grid.Column("CurrentStatus", "Status"),
|
||||
grid.Column("Chart", "Chart", item =>
|
||||
item.HasLeafChart
|
||||
? Html.ActionLink("Chart", "Index", "LeafCharter", new {leafInputId = item.LeafInputId}, new {})
|
||||
: Html.Raw(""))
|
||||
),
|
||||
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed" }
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user