I have a situation where I have an object of type PurchaseOrder. From this object I need to have the orders selected shipment name. I thought I could do like this:
var orderLine = OrderLine.First(ol => ol.Id == myPurchaseOrder.OrderId); var shipmentName = orderLine.Shipment.ShipementName;
But this will generate the following exception:
could not resolve property: Id of: UCommerce.EntitiesV2.OrderLine [.Where[UCommerce.EntitiesV2.OrderLine](.Select[UCommerce.EntitiesV2.OrderLine,UCommerce.EntitiesV2.OrderLine](.Cacheable[UCommerce.EntitiesV2.OrderLine](NHibernate.Linq.NhQueryable`1[UCommerce.EntitiesV2.OrderLine], ), Quote((entity, ) => (entity)), ), Quote((ol, ) => (Equal(ol.Id, p1))), )]
Sorry, my title was "Get ShipmentName from a PurchaseOrder", but I forgot to append the word "Line" in the end of the title. The title should be "Get ShipmentName from a PurchaseOrderLine". Seems that I cant edit my previous post. :(
Can I ask what you want to archive? As Dennis has pointed out there is several ways to fetch Shipments. In your small code example it seems you already have fetched your purchaseorder.
If that is the case you should be able to say:
var shipmentNames = myPurchaseOrderLine.PurchaseOrder.Shipments.Select(shipment => shipment.ShipmentName).ToList();
Get ShipmentName from a PurchaseOrder
I have a situation where I have an object of type PurchaseOrder. From this object I need to have the orders selected shipment name. I thought I could do like this:
But this will generate the following exception:
Why? And how can I do instead?
Hi Johan,
I must admit that I am not a backend developer, but perhaps, these two links can help you a step further to reach your goal.
http://our.umbraco.org/projects/website-utilities/ucommerce/ucommerce-support/19446-Getting-Shipping-Address-in-various-contexts-within-uCommerce-and-Umbraco
http://www.ucommerce.net/docs/html/T_UCommerce_EntitiesV2_PurchaseOrder.htm
Hope this helps,
/Dennis
Sorry, my title was "Get ShipmentName from a PurchaseOrder", but I forgot to append the word "Line" in the end of the title. The title should be "Get ShipmentName from a PurchaseOrderLine". Seems that I cant edit my previous post. :(
None of your links helped me, but thanks anyway!
I have a solution if I use this code:
But I need to run this query for every row in a gridview, so from a performance perspective I guess it's not so good.
Hi Johan,
Can I ask what you want to archive? As Dennis has pointed out there is several ways to fetch Shipments. In your small code example it seems you already have fetched your purchaseorder.
If that is the case you should be able to say:
var shipmentNames = myPurchaseOrderLine.PurchaseOrder.Shipments.Select(shipment => shipment.ShipmentName).ToList();
Best regards Martin
is working on a reply...