private void LoadRateUnits(TreatmentZone treatmentZone, RasterGridPrescription prescription)
{
if(prescription.RxProductLookups == null)
prescription.RxProductLookups = new List<RxProductLookup>();
var rxRates = new List<RxRate>();
foreach (var dataVariable in treatmentZone.Variables)
{
var product = _taskDocument.Products.FindById(dataVariable.ProductId) ?? _taskDocument.ProductMixes.FindById(dataVariable.ProductId);
var rxProductLookup = new RxProductLookup
{
ProductId = product == null ? 0 : product.Id.FindIntIsoId(),
UnitOfMeasure = dataVariable.IsoUnit.ToAdaptUnit(),
};
prescription.RxProductLookups.Add(rxProductLookup);
var rxRate = new RxRate
{
Rate = dataVariable.Value,
RxProductLookupId = rxProductLookup.Id.ReferenceId,
};
rxRates.Add(rxRate);
}
prescription.Rates = new List<RxRates>{ new RxRates{ RxRate = rxRates }};
}