My client would like to export orders as they are placed into their fulfillment system. I am doing this inside a .Net event handler, but seem to have problems accessing the OrderLine Properties.
I tried using:
Data.OrderLine ol = order.OrderLines.ElementAt<Data.OrderLine>(i); ol.Properties.GetValue<Data.OrderLineProperty>(strAlias).Value.ToString();
I have just finished a discount thing which I will be posting on line when I can actually describe coherantly how I achieved it with the help of Anders...
Anders taught me to access the orderline properties thusly using linq
OrderLineProperty checkAVar = orderLine.Properties.FirstOrDefault( i => i.Alias == "quantityOverA" );
Accessing OrderLine Properties in C#
Hi Rune, Anders,
My client would like to export orders as they are placed into their fulfillment system. I am doing this inside a .Net event handler, but seem to have problems accessing the OrderLine Properties.
I tried using:
and
This is probably something basic, but what is the correct method/syntax to accessing these values?
Thanks,
Chris
I have just finished a discount thing which I will be posting on line when I can actually describe coherantly how I achieved it with the help of Anders...
Anders taught me to access the orderline properties thusly using linq
OrderLineProperty checkAVar = orderLine.Properties.FirstOrDefault( i => i.Alias == "quantityOverA" );
if(checkAVar != null )
{
Decimal quantityaV = System.Convert.ToDecimal(orderLine.Properties.First(i => i.Alias == "quantityOverA").Value);
}
This is because I was messing about with a price so I converted to a decimal number, the same for a string ect would be..
String thisVar = orderLine.Properties.First(i => i.Alias == "thisProperty").Value;
I hope this helps.
Doogie.
That seems to have done the trick.
Thanks very much for your help.
-Chris
I was stood on Anders shoulders for that one :) I am a bit of a c# noob. I don't fully understand what's going on here..
(i => i.Alias == "thisProperty")
I was assured it was Linq, and it works over multiple properties so...
Cheers
Hi Doogie
Its LINQ and Lambda expressions - just google it :)
Glad you could help Chris with his question!
Kind regards
Anders
is working on a reply...