Exemplo n.º 1
0
        public void UpdateMethodOk()
        {
            clsOrderCollection AllOrder = new clsOrderCollection();
            clsOrder           TestItem = new clsOrder();
            Int32 PrimaryKey            = 0;

            //TestItem.OrderID = 1;
            TestItem.CustomerID = 1;
            TestItem.StaffID    = 1;
            TestItem.CarID      = 1;
            TestItem.Date       = DateTime.Now.Date;
            TestItem.Email      = "";
            TestItem.Price      = 1;
            AllOrder.ThisOrder  = TestItem;
            PrimaryKey          = AllOrder.Add();
            TestItem.OrderID    = PrimaryKey;
            // TestItem.OrderID = 2;
            TestItem.CustomerID = 2;
            TestItem.StaffID    = 2;
            TestItem.CarID      = 2;
            TestItem.Date       = DateTime.Now.Date;
            TestItem.Email      = "";
            TestItem.Price      = 2;
            AllOrder.ThisOrder  = TestItem;
            AllOrder.update();
            AllOrder.ThisOrder.Find(PrimaryKey);
            Assert.AreEqual(AllOrder.ThisOrder, TestItem);
        }
Exemplo n.º 2
0
    void Update()
    {
        clsOrderCollection OrderBook = new clsOrderCollection();
        String             Error     = OrderBook.ThisOrder.Valid(TxtBDate.Text, TxtBEmail.Text, TxtBPrice.Text);

        if (Error == "")
        {
            // OrderBook.ThisOrder.Find(OrderID);

            OrderBook.ThisOrder.CustomerID = Convert.ToInt32(TxtbCustomerID);
            OrderBook.ThisOrder.StaffID    = Convert.ToInt32(txtbStaffID);
            OrderBook.ThisOrder.CarID      = Convert.ToInt32(TxtBCarID);
            OrderBook.ThisOrder.Date       = Convert.ToDateTime(TxtBDate);
            OrderBook.ThisOrder.Email      = TxtBEmail.Text;
            OrderBook.ThisOrder.Price      = Convert.ToInt32(TxtBPrice);
            OrderBook.update();
            Response.Redirect("Order.aspx");
        }
        else
        {
            //report an error
            LblError.Text = "There was a problem with the data that has been entered" + Error;
        }
    }