AgGateway.ADAPT.ISOv4Plugin.Loaders.PrescriptionLoader.AddRate C# (CSharp) Method

AddRate() private static method

private static AddRate ( int productId, double productRate, AgGateway.ADAPT.ApplicationDataModel.Prescriptions.RxRates rates, AgGateway.ADAPT.ApplicationDataModel.Prescriptions.RasterGridPrescription prescription, AgGateway.ADAPT.ApplicationDataModel.Common.UnitOfMeasure uom ) : void
productId int
productRate double
rates AgGateway.ADAPT.ApplicationDataModel.Prescriptions.RxRates
prescription AgGateway.ADAPT.ApplicationDataModel.Prescriptions.RasterGridPrescription
uom AgGateway.ADAPT.ApplicationDataModel.Common.UnitOfMeasure
return void
        private static void AddRate(int productId, double productRate, RxRates rates, RasterGridPrescription prescription, UnitOfMeasure uom)
        {
            RxProductLookup rxProductLookup;
            if (prescription.RxProductLookups.Any(x => x.ProductId == productId))
                rxProductLookup = prescription.RxProductLookups.Single(x => x.ProductId == productId);
            else
            {
                rxProductLookup = new RxProductLookup
                {
                    ProductId = productId,
                    UnitOfMeasure = uom

                };
                prescription.RxProductLookups.Add(rxProductLookup);
            }

            var rxRate = new RxRate
            {
                Rate = productRate,
                RxProductLookupId = rxProductLookup.Id.ReferenceId,
            };

            rates.RxRate.Add(rxRate);
        }