Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Johan Larsson 28 posts 98 karma points
    Dec 18, 2014 @ 19:42
    Johan Larsson
    0

    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:

    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))), )]

    Why? And how can I do instead?

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Dec 18, 2014 @ 19:48
    Dennis Aaen
    1

    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

  • Johan Larsson 28 posts 98 karma points
    Dec 18, 2014 @ 20:03
    Johan Larsson
    0

    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:

    OrderLine.Find(ol => ol.PurchaseOrder.OrderId == myPurchaseOrderLine.OrderId).First().Shipment.ShipmentName

    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.

  • Martin 181 posts 740 karma points
    Dec 18, 2014 @ 21:09
    Martin
    100

    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

Please Sign in or register to post replies

Write your reply to:

Draft