I can get to the Lots Collection under the Property by doing this
var props = (IList) order["Properties"];
var property = (IOrderItem) props[0];
var lotList = (ICollection)property["Lots"];
However if I want to add to this collection .. what is the type I need to define and add?
Also have the same question for
var mapList = (ICollection)property["TaxMaps"];
Lots and Taxmaps Collection
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Lots and Taxmaps Collection
Our pattern for adding to collections is to get the type from the IOrder then add it to the list.
Similarily, you can add a new TaxMap:
Code: Select all
// Get a property.
IOrderItem property = (IOrderItem)((IList)iOrder["Properties"])[0];
// Add a lot.
IList lots = (IList)property["Lots"];
IOrderItem lot = iOrder.CreateNew("Lot");
lot["Number"] = 22;
lots.Add(lot);
Code: Select all
IList taxMaps = (IList)property["TaxMaps"];
IOrderItem taxMap = iOrder.CreateNew("TaxMap");
taxMap["Identification"] = "New tax map";
taxMaps.Add(taxMap);
Bob Richards, Senior Software Developer, SoftPro