Sage.Integration.Northwind.Adapter.Data.SalesOrderFeedEntryWrapper.GetLineItem C# (CSharp) Method

GetLineItem() private method

private GetLineItem ( Sage row, NorthwindConfig config ) : SalesOrderLineFeedEntry
row Sage
config Sage.Integration.Northwind.Application.NorthwindConfig
return SalesOrderLineFeedEntry
        private SalesOrderLineFeedEntry GetLineItem(Sage.Integration.Northwind.Adapter.Data.SalesOrders.DataSets.Order.CalculatedOrderDetailsRow row, NorthwindConfig config)
        {
            #region Declarations
            SalesOrderLineFeedEntry payload;
            string id;
            decimal discountPercentage;
            #endregion

            id = row.OrderID.ToString() + "-" + row.ProductID.ToString();

            payload = new SalesOrderLineFeedEntry();
            payload.UUID = GetUuid(id, "", SupportedResourceKinds.salesOrderLines);

            payload.commodity = (CommodityFeedEntry)_commoditiesFeedEntryWrapper.GetFeedEntry(row.ProductID.ToString());

               /* payload.commodity = new CommodityFeedEntry();
            payload.commodity.UUID = GetUuid(row.ProductID.ToString(), "", SupportedResourceKinds.commodities);*/

            payload.salesOrder = new SalesOrderFeedEntry();
            payload.salesOrder.UUID = GetUuid(row.OrderID.ToString(), "", SupportedResourceKinds.salesOrders);

            payload.unitOfMeasure = (UnitOfMeasureFeedEntry)_unitsOfMeasureFeedEntryWrapper.GetFeedEntry(row.ProductID.ToString());
            /*payload.unitOfMeasure = new UnitOfMeasureFeedEntry();
            payload.unitOfMeasure.UUID = GetUuid(row.ProductID.ToString(), "", SupportedResourceKinds.unitsOfMeasure);*/

            payload.quantity = row.IsQuantityNull() ? Convert.ToInt16(0) : row.Quantity;

            payload.initialPrice = row.IsUnitPriceNull() ? new decimal(0) : row.UnitPrice;

            payload.orderLineDiscountPercent = row.IsDiscountNull() ? (decimal)0 : Convert.ToDecimal(row.Discount);

            payload.discountTotal = payload.initialPrice * (decimal)payload.orderLineDiscountPercent;

            payload.costTotal = (decimal)payload.initialPrice * (1 - payload.orderLineDiscountPercent);

            payload.netTotal = Convert.ToDecimal(payload.quantity) * Convert.ToDecimal(payload.costTotal);

            SetCommonProperties(id, payload, SupportedResourceKinds.salesOrderLines);

            return payload;
        }