/// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public override void Run(DfpUser user)
        {
            // Get the OrderService.
              OrderService orderService =
              (OrderService) user.GetService(DfpService.v201302.OrderService);

              // Set the advertiser, salesperson, and trafficker to assign to each
              // order.
              long advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE"));
              long salespersonId = long.Parse(_T("INSERT_SALESPERSON_ID_HERE"));
              long traffickerId = long.Parse(_T("INSERT_TRAFFICKER_ID_HERE"));

              // Create an array to store local order objects.
              Order[] orders = new Order[5];

              for (int i = 0; i < 5; i++) {
            Order order = new Order();
            order.name = string.Format("Order #{0}", i);
            order.advertiserId = advertiserId;
            order.salespersonId = salespersonId;
            order.traffickerId = traffickerId;

            orders[i] = order;
              }

              try {
            // Create the orders on the server.
            orders = orderService.createOrders(orders);

            if (orders != null) {
              foreach (Order order in orders) {
            Console.WriteLine("An order with ID ='{0}' and named '{1}' was created.",
                order.id, order.name);
              }
            } else {
              Console.WriteLine("No orders created.");
            }
              } catch (Exception ex) {
            Console.WriteLine("Failed to create orders. Exception says \"{0}\"",
            ex.Message);
              }
        }
 public Order updateOrder(Order order)
 {
     object[] results = this.Invoke("updateOrder", new object[] { order });
       return ((Order) (results[0]));
 }
        public void TestCreateOrders()
        {
            Order order1 = new Order();
              order1.name = string.Format("Order #{0}", new TestUtils().GetTimeStamp());
              order1.advertiserId = advertiserId;
              order1.traffickerId = traffickerId;
              order1.currencyCode = "USD";

              Order order2 = new Order();
              order2.name = string.Format("Order #{0}", new TestUtils().GetTimeStamp());
              order2.advertiserId = advertiserId;
              order2.traffickerId = traffickerId;
              order2.currencyCode = "USD";

              Order[] newOrders = null;

              Assert.DoesNotThrow(delegate() {
            newOrders = orderService.createOrders(new Order[] {order1, order2});
              });

              Statement statement = new Statement();
              statement.query = string.Format("WHERE advertiserId = '{0}' LIMIT 500", advertiserId);

              OrderPage page = orderService.getOrdersByStatement(statement);
              Assert.NotNull(newOrders);
              Assert.AreEqual(newOrders.Length, 2);

              Assert.AreEqual(order1.name, newOrders[0].name);
              Assert.AreEqual(order1.advertiserId, newOrders[0].advertiserId);
              Assert.AreEqual(order1.traffickerId, newOrders[0].traffickerId);
              Assert.AreEqual(order1.currencyCode, newOrders[0].currencyCode);

              Assert.AreEqual(order2.name, newOrders[1].name);
              Assert.AreEqual(order2.advertiserId, newOrders[1].advertiserId);
              Assert.AreEqual(order2.traffickerId, newOrders[1].traffickerId);
              Assert.AreEqual(order2.currencyCode, newOrders[1].currencyCode);
        }
        public void TestCreateOrder()
        {
            Order order = new Order();
              order.name = string.Format("Order #{0}", new TestUtils().GetTimeStamp());
              order.advertiserId = advertiserId;
              order.traffickerId = traffickerId;
              order.currencyCode = "USD";

              Order newOrder = null;

              Assert.DoesNotThrow(delegate() {
            newOrder = orderService.createOrder(order);
              });

              Assert.NotNull(newOrder);
              Assert.AreEqual(order.name, newOrder.name);
        }
        public Order CreateOrder(DfpUser user, long advertiserId, long salespersonId,
        long traffickerId)
        {
            // Get the OrderService.
              OrderService orderService = (OrderService) user.GetService(DfpService.v201302.OrderService);

              Order order = new Order();
              order.name = string.Format("Order #{0}", GetTimeStamp());
              order.advertiserId = advertiserId;
              order.salespersonId = salespersonId;
              order.traffickerId = traffickerId;

              return orderService.createOrder(order);
        }