public static OrderTrans CreateOrder() { AmeriCommerceDatabaseIO oWs = InitializeWebservice(); OrderTrans oOrder = new OrderTrans(); oOrder.subTotal = MakeDataMoney(5.00m); oOrder.taxAdded = MakeDataMoney(1.00m); oOrder.shippingAdded = MakeDataMoney(1.00m); oOrder.total = MakeDataMoney(7.00m); oOrder.orderStatusID = MakeDataInt(1); oOrder.customerID = MakeDataInt(1); // create order items collection // this test order will only have one item oOrder.OrderItemColTrans = new OrderItemTrans[1]; OrderItemTrans oItem = new OrderItemTrans(); oItem.itemID = MakeDataInt(209); oItem.itemName = "Product100"; oItem.price = MakeDataMoney(5.00m); oItem.quantity = MakeDataInt(1); oOrder.OrderItemColTrans[0] = oItem; // when an object has child collections (order items in this example), as long as they are assigned // correctly they will be saved automatically along with the parent // just demoing SaveAndGet - can use this or Save return oWs.Order_SaveAndGet(oOrder); }
public static OrderTrans CreateOrder() { AmeriCommerceDatabaseIO oWs = InitializeWebservice(); OrderTrans oOrder = new OrderTrans(); oOrder.subTotal = MakeDataMoney(5.00m); oOrder.taxAdded = MakeDataMoney(1.00m); oOrder.shippingAdded = MakeDataMoney(1.00m); oOrder.total = MakeDataMoney(7.00m); oOrder.orderStatusID = MakeDataInt(1); oOrder.customerID = MakeDataInt(1); // create order items collection // this test order will only have one item oOrder.OrderItemColTrans = new OrderItemTrans[1]; OrderItemTrans oItem = new OrderItemTrans(); oItem.itemID = MakeDataInt(209); oItem.itemName = "Product100"; oItem.price = MakeDataMoney(5.00m); oItem.quantity = MakeDataInt(1); oOrder.OrderItemColTrans[0] = oItem; // when an object has child collections (order items in this example), as long as they are assigned // correctly they will be saved automatically along with the parent // just demoing SaveAndGet - can use this or Save return(oWs.Order_SaveAndGet(oOrder)); }