public ManualPrescription ImportManualPrescription(ISOTask task, WorkItem workItem)
        {
            ManualPrescription manualRx = null;

            if (task.DefaultTreatmentZone != null)
            {
                foreach (ISOProcessDataVariable pdv in task.DefaultTreatmentZone.ProcessDataVariables)
                {
                    if (manualRx == null)
                    {
                        manualRx             = new ManualPrescription();
                        manualRx.ProductUses = new List <ProductUse>();
                        manualRx.ProductIds  = new List <int>();
                        ImportSharedPrescriptionProperties(task, workItem, manualRx);
                    }

                    if (pdv.ProductIdRef != null) //Products on ISO Rxs are optional, but without a place to store a product-agnostic prescription, those will not be imported here.
                    {
                        ProductUse productUse = new ProductUse();
                        int?       productID  = TaskDataMapper.InstanceIDMap.GetADAPTID(pdv.ProductIdRef);
                        if (productID.HasValue)
                        {
                            productUse.ProductId = productID.Value;
                            manualRx.ProductIds.Add(productID.Value);
                        }
                        productUse.Rate = pdv.ProcessDataValue.AsNumericRepresentationValue(pdv.ProcessDataDDI, RepresentationMapper);
                        manualRx.ProductUses.Add(productUse);
                    }
                }
            }
            return(manualRx);
        }
        private Feature Map(ManualPrescription prescription)
        {
            // @ToDo or not to do? use field boundary?
            Feature feature = JsonConvert.DeserializeObject <Feature>("{ \"type\": \"Feature\", \"properties\": {}, \"geometry\": null }");

            feature.Properties.Add("ApplicationStrategy", prescription.ApplicationStrategy.ToString());                // Enum: RatePerArea, RatePerTank, TotalProduct
            feature.Properties.Add("ProductUses", prescription.ProductUses);                                           // ProductId, Rate, AppliedArea , ProductTotal
            feature.Properties.Add("TankAmount", prescription.TankAmount);
            feature.Properties.Add("TotalArea", prescription.TotalArea);
            feature.Properties.Add("TotalTanks", prescription.TotalTanks);

            return(feature);
        }
        private void ExportManualPresciption(ISOTask task, ManualPrescription rx)
        {
            ISOTreatmentZone tzn = new ISOTreatmentZone();

            tzn.TreatmentZoneDesignator   = "Default Treatment Zone";
            tzn.TreatmentZoneCode         = 1;
            task.DefaultTreatmentZoneCode = tzn.TreatmentZoneCode;

            foreach (ProductUse productUse in rx.ProductUses)
            {
                var    isoUnit             = DetermineIsoUnit(rx.RxProductLookups.First(p => p.ProductId == productUse.ProductId).UnitOfMeasure);
                string productIDRef        = TaskDataMapper.InstanceIDMap.GetISOID(productUse.ProductId);
                ISOProcessDataVariable pdv = ExportProcessDataVariable(productUse.Rate, productIDRef, isoUnit);
                tzn.ProcessDataVariables.Add(pdv);
            }

            task.TreatmentZones.Add(tzn);
        }