Ejemplo n.º 1
0
        public void UpdateMethodOK()
        {
            clsOrderCollection AllOrders = new clsOrderCollection();
            clsOrder           TestItem  = new clsOrder();
            Int32 PrimaryKey             = 0;

            TestItem.customerID      = 3;
            TestItem.dateOrdered     = DateTime.Now.Date;
            TestItem.deliveryAddress = "Ellistown, Amazon BHX2, LE16 1GQ";
            TestItem.paid            = true;
            TestItem.staffID         = 4;
            TestItem.totalPrice      = 15.00;
            AllOrders.ThisOrder      = TestItem;
            PrimaryKey               = AllOrders.Add();
            TestItem.orderID         = PrimaryKey;
            TestItem.customerID      = 4;
            TestItem.dateOrdered     = DateTime.Now.Date;
            TestItem.deliveryAddress = "Another Address, not Amazon";
            TestItem.paid            = false;
            TestItem.staffID         = 6;
            TestItem.totalPrice      = 18.15;
            AllOrders.ThisOrder      = TestItem;
            AllOrders.Update();
            AllOrders.ThisOrder.Find(PrimaryKey);
            Assert.AreEqual(AllOrders.ThisOrder, TestItem);
        }
Ejemplo n.º 2
0
        void Add()
        {
            //create instance of the class
            clsOrderCollection NewOrder = new clsOrderCollection();
            //validate the data on the web form
            String Error = NewOrder.ThisOrder.Valid(txtCustomerID.Text, txtDeliveryTown.Text, txtOrderDate.Text, txtOrderStatus.Text, txtOrderValue.Text, txtCustomerID.Text);

            if (Error == "")
            {
                NewOrder.ThisOrder.CustomerID = Convert.ToInt32(txtCustomerID.Text);
                //capture emailaddress
                NewOrder.ThisOrder.EmailAddress = txtCustomerID.Text;
                //capture delivery town
                NewOrder.ThisOrder.DeliveryTown = txtDeliveryTown.Text;
                //capture date added
                NewOrder.ThisOrder.DateAdded = Convert.ToDateTime(txtOrderDate.Text);
                //capture order value
                NewOrder.ThisOrder.OrderValue = Convert.ToInt32(txtOrderValue.Text);
                //capture order status
                NewOrder.ThisOrder.OrderStatus = txtOrderStatus.Text;
                //add the record
                NewOrder.Add();

                lblError.Text = "New order was added succesfully. ";
            }



            else
            {
                //report error

                lblError1.Text = Error;
            }
        }
Ejemplo n.º 3
0
        public void AddMethodOK()
        {
            clsOrderCollection orders = new clsOrderCollection();

            clsOrder order = new clsOrder
            {
                OrderId    = 1,
                CustomerId = 1,
                Date       = DateTime.Now.Date,
                Details    = "Text",
                StaffId    = 1
            };

            Int32 primaryKey = 0;

            orders.ThisOrder = order;

            primaryKey = orders.Add();

            order.OrderId = primaryKey;

            orders.ThisOrder.find(primaryKey);

            Assert.AreEqual(orders.ThisOrder, order);
        }
        public void UpdateOK()
        {
            clsOrderCollection col   = new clsOrderCollection();
            clsDataConnection  db    = new clsDataConnection();
            clsOrder           order = new clsOrder();

            order.Product_Id     = 1;
            order.Customer_Id    = 1;
            order.Date_Ordered   = DateTime.Today;
            order.Dispatch       = true;
            order.Order_Quantity = 4;
            order.Product_Name   = "Gym gloves";
            col.mthisorder       = order;
            col.Add();
            int      key  = order.Product_Id;
            clsOrder test = new clsOrder();

            test.Product_Id     = key;
            test.Customer_Id    = 2;
            test.Date_Ordered   = DateTime.Today;
            test.Dispatch       = false;
            test.Product_Name   = "boxes";
            test.Order_Quantity = 5;
            col.mthisorder      = test;
            col.Update();
            Assert.AreEqual(test.find(key), true);
        }
        public void DeleteMethodOK()
        {
            //instance of class
            clsOrderCollection AllOrders = new clsOrderCollection();
            //create item for test data
            clsOrder TestItem = new clsOrder();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set properties
            TestItem.OrderId        = 1;
            TestItem.ShippingMethod = "sameday";
            TestItem.DateOrdered    = DateTime.Now.Date;
            TestItem.Dispatched     = true;
            //set ThisOrder to the test data
            AllOrders.ThisOrder = TestItem;
            //add the record
            PrimaryKey = AllOrders.Add();
            //set the primary key of the test data
            TestItem.OrderId = PrimaryKey;
            //find the record
            AllOrders.ThisOrder.Find(PrimaryKey);
            //delete the record
            AllOrders.Delete();
            //now find the record
            Boolean Found = AllOrders.ThisOrder.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
Ejemplo n.º 6
0
        public void AddMethodOK()
        {
            //create an instance of the class we want to create
            clsOrderCollection AllOrders = new clsOrderCollection();
            //create the item of test data
            clsOrder TestItem = new clsOrder();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.OrderNo             = 33;
            TestItem.Active              = true;
            TestItem.CollectionPostcode  = "LE2 7EE";
            TestItem.DestinationCountry  = "United Kingdom";
            TestItem.DestinationPostcode = "LE2 7FZ";
            TestItem.DateCreated         = "2018/02/01";
            TestItem.ParcelSize          = "M";
            TestItem.Status              = "Dispatching";
            TestItem.CustomerNo          = 1;
            //set ThisAddress to the test data
            AllOrders.ThisOrder = TestItem;
            //add the record
            PrimaryKey = AllOrders.Add();
            //set the primary key of the test data
            TestItem.OrderNo = PrimaryKey;
            //find the record
            AllOrders.ThisOrder.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllOrders.ThisOrder, TestItem);
        }
        public void AddMethodOK()
        {
            //create an instance of the class we want to create
            clsOrderCollection AllOrders = new clsOrderCollection();
            //create the item of test data
            clsOrder TestItem = new clsOrder();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.CustomerID   = 2;
            TestItem.OrderNo      = 2;
            TestItem.DeliveryTown = "Test Town";
            TestItem.OrderStatus  = "Test Status";
            TestItem.OrderValue   = 1;
            TestItem.EmailAddress = "*****@*****.**";
            TestItem.DateAdded    = DateTime.Now.Date;
            //set ThisOrder to the test data
            AllOrders.ThisOrder = TestItem;
            //add the record
            PrimaryKey = AllOrders.Add();
            //set the primary key to the test data
            TestItem.OrderNo = PrimaryKey;
            //find the record
            AllOrders.ThisOrder.Find(PrimaryKey);

            //test to see that two values are the same
            Assert.AreEqual(AllOrders.ThisOrder, TestItem);
        }
Ejemplo n.º 8
0
        public void AddMethodOK()
        {
            //create an instance of the class we want to create
            clsOrderCollection AllOrders = new clsOrderCollection();
            //create the item of test Customer
            clsOrder TestItem = new clsOrder();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set the properties of the test Customer object
            TestItem.OrderId         = 2;
            TestItem.ShippingAddress = "99 Granby Street, Leicester, UK";
            TestItem.Phonenum        = "1111111111111111";
            TestItem.Email           = "*****@*****.**";
            TestItem.DateOrdered     = DateTime.Now.Date;
            //assign the data to the property
            AllOrders.ThisOrder = TestItem;
            //add the record
            PrimaryKey = AllOrders.Add();
            //set the primary key of the test data
            TestItem.OrderId = PrimaryKey;
            //find the record
            AllOrders.ThisOrder.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllOrders.ThisOrder, TestItem);
        }
Ejemplo n.º 9
0
        public void UpdateMethodOK()
        {
            //create an instance of the class we want to create
            clsOrderCollection AllOrders = new clsOrderCollection();
            //create the item of test Customer
            clsOrder TestItem = new clsOrder();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set the properties of the test Customer object
            TestItem.OrderId         = 2;
            TestItem.ShippingAddress = "99 Granby Street, Leicester, UK";
            TestItem.Phonenum        = "1111111111111111";
            TestItem.Email           = "*****@*****.**";
            TestItem.DateOrdered     = DateTime.Now.Date;
            //assign the data to the property
            AllOrders.ThisOrder = TestItem;
            //add the record
            PrimaryKey = AllOrders.Add();
            //set the primary key of the test data
            TestItem.OrderId = PrimaryKey;
            //modify the test data
            TestItem.ShippingAddress = "102 Jaguar Lane, London";
            TestItem.Phonenum        = "1111111111111111";
            TestItem.Email           = "*****@*****.**";
            TestItem.DateOrdered     = DateTime.Now.Date;
            //set the record based on the new test data
            AllOrders.ThisOrder = TestItem;
            //update the record
            AllOrders.Update();
            //find the record
            AllOrders.ThisOrder.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllOrders.ThisOrder, TestItem);
        }
Ejemplo n.º 10
0
        public void UpdateMethodOK()
        {
            clsOrderCollection AllOrders = new clsOrderCollection();
            clsOrder           TestItem  = new clsOrder();
            Int32 PrimaryKey             = 0;

            TestItem.CustomerID      = 1;
            TestItem.ShippingAddress = "AddressTest";
            TestItem.OrderDate       = DateTime.Now.Date;
            TestItem.OrderShipped    = true;

            AllOrders.ThisOrder = TestItem;
            PrimaryKey          = AllOrders.Add();

            TestItem.OrderID = PrimaryKey;

            TestItem.CustomerID      = 2;
            TestItem.ShippingAddress = "AddressTest2Edited";
            TestItem.OrderDate       = DateTime.Now.Date;
            TestItem.OrderShipped    = false;

            AllOrders.ThisOrder = TestItem;

            AllOrders.Update();
            AllOrders.ThisOrder.Find(PrimaryKey);

            Assert.AreEqual(AllOrders.ThisOrder, TestItem);
        }
Ejemplo n.º 11
0
        public void DeleteMethodOK()
        {
            //create an instance of the class we want to create
            clsOrderCollection AllOrders = new clsOrderCollection();
            //create the item of test data
            clsOrder TestItem = new clsOrder();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set it's properties
            TestItem.OrderId         = 2;
            TestItem.ShippingAddress = "99 Granby Street, Leicester, UK";
            TestItem.Phonenum        = "1111111111111111"; TestItem.Email = "Junnun Malik";
            TestItem.DateOrdered     = DateTime.Now.Date;
            //set ThisAddress to the test data
            AllOrders.ThisOrder = TestItem;
            //add the record
            PrimaryKey = AllOrders.Add();
            //set the primary key of the test data
            TestItem.OrderId = PrimaryKey;
            //find the record
            AllOrders.ThisOrder.Find(PrimaryKey);
            //delete the record
            AllOrders.Delete();
            //now find the record
            Boolean Found = AllOrders.ThisOrder.Find(PrimaryKey);

            //test to see that the two values are the same
            Assert.IsFalse(Found);
        }
Ejemplo n.º 12
0
        public void UpdateMethodOK()
        {
            clsOrderCollection AllOrder = new clsOrderCollection();
            clsOrders          TestItem = new clsOrders();
            Int32 PrimaryKey            = 0;

            TestItem.OrderId          = 89;
            TestItem.DeliveryAddress  = "An Address";
            TestItem.DispatchedStatus = true;
            TestItem.UnitPrice        = 5.99;
            TestItem.Quantity         = 2;
            TestItem.OrderDate        = DateTime.Now.Date;
            TestItem.ProductCode      = "ABC1234";
            TestItem.ItemId           = 1;
            AllOrder.ThisOrder        = TestItem;
            PrimaryKey       = AllOrder.Add();
            TestItem.OrderId = PrimaryKey;

            TestItem.DeliveryAddress  = "A new Address";
            TestItem.DispatchedStatus = false;
            TestItem.UnitPrice        = 6.99;
            TestItem.Quantity         = 5;
            TestItem.OrderDate        = DateTime.Now.Date;
            TestItem.ProductCode      = "ABC1245";
            TestItem.ItemId           = 1;
            AllOrder.ThisOrder        = TestItem;

            AllOrder.Update();
            AllOrder.ThisOrder.Find(PrimaryKey);
            Assert.AreEqual(AllOrder.ThisOrder, TestItem);
        }
Ejemplo n.º 13
0
        public void AddMethodOK()
        {
            //create class instance
            clsOrderCollection AllOrders = new clsOrderCollection();
            // create test data
            clsOrder TestItem = new clsOrder();
            // primary key variable
            Int32 PrimaryKey = 0;

            // set properties
            TestItem.orderID     = 1;
            TestItem.numberPlate = "AB09ZXC";
            TestItem.customerID  = 5;
            TestItem.price       = 5000;
            TestItem.quantity    = 1;
            TestItem.dateOrdered = DateTime.Now.Date;
            //set this order to the test data
            AllOrders.ThisOrder = TestItem;
            // add record
            PrimaryKey = AllOrders.Add();
            // set primary key of test data
            TestItem.orderID = PrimaryKey;
            // find record
            AllOrders.ThisOrder.Find(PrimaryKey);
            // test values are the same
            Assert.AreEqual(AllOrders.ThisOrder, TestItem);
        }
Ejemplo n.º 14
0
        public void DeleteMethodOK()
        {
            //create class instance
            clsOrderCollection AllOrders = new clsOrderCollection();
            // create test data
            clsOrder TestItem = new clsOrder();
            // primary key variable
            Int32 PrimaryKey = 0;

            // set properties
            TestItem.orderID     = 1;
            TestItem.numberPlate = "AB09ZXC";
            TestItem.customerID  = 5;
            TestItem.price       = 5000;
            TestItem.quantity    = 1;
            TestItem.dateOrdered = DateTime.Now.Date;
            //set this order to the test data
            AllOrders.ThisOrder = TestItem;
            // add record
            PrimaryKey = AllOrders.Add();
            // set primary key of test data
            TestItem.orderID = PrimaryKey;
            // find record
            AllOrders.ThisOrder.Find(PrimaryKey);
            // delete record
            AllOrders.Delete();
            // find the record again
            Boolean Found = AllOrders.ThisOrder.Find(PrimaryKey);

            // test that record was not found
            Assert.IsFalse(Found);
        }
Ejemplo n.º 15
0
        public void AddMethodOk()
        {
            //create intance of class to create
            clsOrderCollection AllOrders = new clsOrderCollection();
            //var to store primary key
            Int32 PrimaryKey = 0;
            //create test data to assign to the property
            clsOrder TestItem = new clsOrder();

            //set properties
            TestItem.OrderNo     = 4;
            TestItem.DateOrdered = DateTime.Now.Date;
            TestItem.ProductName = "Logitech M220 Silent Wireless Mouse ";
            TestItem.QuantityNo  = 3;
            TestItem.OrderPrice  = 50;
            //set thisorder to test data
            AllOrders.ThisOrder = TestItem;
            //add record
            PrimaryKey = AllOrders.Add();
            //set primary key of the test data
            TestItem.OrderNo = PrimaryKey;
            //find the record
            AllOrders.ThisOrder.Find(PrimaryKey);
            //test to see the values are the same
            Assert.AreEqual(AllOrders.ThisOrder, TestItem);
        }
Ejemplo n.º 16
0
        public void DeleteMethodOK()
        {
            clsOrderCollection AllOrders = new clsOrderCollection();
            clsOrder           TestItem  = new clsOrder();
            Int32 PrimaryKey             = 0;

            //data to delete
            TestItem.StaffId          = 349;
            TestItem.DeliveryAddress  = "SA70 8SQ";
            TestItem.ItemColour       = "Green";
            TestItem.ItemPrice        = 17;
            TestItem.OrderPlaced      = DateTime.Now.Date;
            TestItem.ItemDescription  = "Single Player";
            TestItem.ItemAvailability = true;
            AllOrders.ThisOrder       = TestItem;
            TestItem.OrderNo          = PrimaryKey;

            PrimaryKey       = AllOrders.Add();
            TestItem.OrderNo = PrimaryKey;
            AllOrders.ThisOrder.Find(PrimaryKey);
            AllOrders.Delete();
            Boolean Found = AllOrders.ThisOrder.Find(PrimaryKey);

            Assert.IsFalse(Found);
        }
Ejemplo n.º 17
0
        public void UpdateMethodOK()
        {
            clsOrderCollection AllOrders = new clsOrderCollection();
            clsOrder           TestItem  = new clsOrder();
            Int32 PrimaryKey             = 0;

            TestItem.Payed       = true;
            TestItem.OrderNumber = 1;
            TestItem.OrderPrice  = 10;
            TestItem.ItemCount   = 2;
            TestItem.Address     = "ankara";
            TestItem.Date        = DateTime.Now.Date;

            AllOrders.ThisOrder  = TestItem;
            PrimaryKey           = AllOrders.Add();
            TestItem.OrderNumber = PrimaryKey;

            TestItem.Payed       = true;
            TestItem.OrderNumber = 1;
            TestItem.OrderPrice  = 10;
            TestItem.ItemCount   = 2;
            TestItem.Address     = "ankara";
            TestItem.Date        = DateTime.Now.Date;

            AllOrders.ThisOrder = TestItem;
            AllOrders.Update();

            AllOrders.ThisOrder.Find(PrimaryKey);
            Assert.AreEqual(AllOrders.ThisOrder, TestItem);
        }
Ejemplo n.º 18
0
        public void UpdateMethodOK()
        {
            clsOrderCollection AllOrders = new clsOrderCollection();
            clsOrder           TestItem  = new clsOrder();
            Int32 PrimaryKey             = 0;

            TestItem.ItemAvailable   = true;
            TestItem.OrderID         = 1234;
            TestItem.TotalItem       = 10;
            TestItem.TotalPrice      = 15.55;
            TestItem.DeliveryAddress = "1, A Street, LE1 5AB, Leicester";
            TestItem.DateOrdered     = DateTime.Now.Date;
            AllOrders.ThisOrder      = TestItem;
            PrimaryKey       = AllOrders.Add();
            TestItem.OrderID = PrimaryKey;

            TestItem.ItemAvailable   = false;
            TestItem.OrderID         = 4567;
            TestItem.TotalItem       = 15;
            TestItem.TotalPrice      = 17.99;
            TestItem.DeliveryAddress = "2, B Street, LE1 5AB, Leicester";
            TestItem.DateOrdered     = DateTime.Now.Date;
            AllOrders.ThisOrder      = TestItem;
            AllOrders.Update();
            AllOrders.ThisOrder.Find(PrimaryKey);
            Assert.AreEqual(AllOrders.ThisOrder, TestItem);
        }
Ejemplo n.º 19
0
        public void UpdateMethodOK()
        {
            clsOrderCollection AllOrders = new clsOrderCollection();
            clsOrder           TestItem  = new clsOrder();
            Int32 PrimaryKey             = 0;

            TestItem.Delivered    = true;
            TestItem.CustomerId   = 1;
            TestItem.OrderPrice   = 1;
            TestItem.DateReceived = DateTime.Now.Date;
            TestItem.Description  = "Blue Shirt";
            TestItem.Quantity     = 1;
            AllOrders.ThisOrder   = TestItem;
            PrimaryKey            = AllOrders.Add();
            TestItem.OrderId      = PrimaryKey;

            TestItem.Delivered    = false;
            TestItem.CustomerId   = 2;
            TestItem.OrderPrice   = 2;
            TestItem.DateReceived = DateTime.Now.Date;
            TestItem.Description  = "Pink Shirt";
            TestItem.Quantity     = 2;
            AllOrders.ThisOrder   = TestItem;
            AllOrders.Update();
            AllOrders.ThisOrder.Find(PrimaryKey);
            Assert.AreEqual(AllOrders.ThisOrder, TestItem);
        }
        public void DeleteMethodOK()
        {
            //create an instance of the class we want to create
            clsOrderCollection AllOrders = new clsOrderCollection();
            //string variable to store
            clsOrder TestItem = new clsOrder();

            Int32 PrimaryKey = 0;

            TestItem.OrderNo      = 1;
            TestItem.DeliveryDate = DateTime.Now.Date;
            TestItem.OrderDate    = DateTime.Now.Date;
            TestItem.PartNo       = 1234567;

            AllOrders.ThisOrder = TestItem;

            PrimaryKey = AllOrders.Add();

            TestItem.OrderNo = PrimaryKey;

            AllOrders.ThisOrder.Find(PrimaryKey);

            AllOrders.Delete();

            Boolean Found = AllOrders.ThisOrder.Find(PrimaryKey);

            Assert.IsFalse(Found);
        }
Ejemplo n.º 21
0
        //function for adding new records
        void Add()
        {
            //create an instance of the OrderCollection class
            clsOrderCollection Orders = new clsOrderCollection();
            //validate the data on the web form
            String Error = Orders.ThisOrder.Valid(txtComputerNo.Text, txtCustomerNo.Text, txtItemName.Text, txtCustomerName.Text, txtInvoice.Text, txtDeliveryDate.Text, txtOrderDate.Text, ddlStatus.Text);

            //if the data is OK then add it to the object
            if (Error == "")
            {
                //copy the data from the interface to the object
                Orders.ThisOrder.ComputerNo   = Convert.ToInt32(txtComputerNo.Text);
                Orders.ThisOrder.CustomerNo   = Convert.ToInt32(txtCustomerNo.Text);
                Orders.ThisOrder.ItemName     = txtItemName.Text;
                Orders.ThisOrder.CustomerName = txtCustomerName.Text;
                Orders.ThisOrder.Invoice      = Convert.ToInt32(txtInvoice.Text);
                Orders.ThisOrder.DeliveryDate = Convert.ToDateTime(txtDeliveryDate.Text);
                Orders.ThisOrder.OrderDate    = Convert.ToDateTime(txtOrderDate.Text);
                Orders.ThisOrder.Status       = ddlStatus.Text;
                //add the new record
                Orders.Add();
                //all done so redirect back to the main page
                Response.Redirect("Order.aspx");
            }
            else
            {
                //report an error
                lblError.Text = "There were problems with the data entered " + Error;
            }
        }
        public void UpdateMethodOK()
        {
            //create an instance of the class we want to create
            clsOrderCollection AllOrders = new clsOrderCollection();
            //create the item of test data
            clsOrder TestItem = new clsOrder();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.OrderNo      = 1;
            TestItem.DeliveryDate = DateTime.Now.Date;
            TestItem.OrderDate    = DateTime.Now.Date;
            //set ThisCustomer to the test data
            AllOrders.ThisOrder = TestItem;
            //add the record
            PrimaryKey = AllOrders.Add();
            //set the primary key of the test data
            TestItem.OrderNo = PrimaryKey;
            //modify the test data

            TestItem.DeliveryDate = DateTime.Now.Date;
            //set the record based on the new test data
            AllOrders.ThisOrder = TestItem;
            //update the record
            AllOrders.Update();
            //find the record
            AllOrders.ThisOrder.Find(PrimaryKey);
            //test to see ThisCustomer matches the test data
            Assert.AreEqual(AllOrders.ThisOrder, TestItem);
        }
Ejemplo n.º 23
0
    //function for adding new records
    void Add()
    {
        // create an instance of the order book
        clsOrderCollection OrderBook = new clsOrderCollection();
        // validate the data on the web form
        String Error = OrderBook.ThisOrder.Valid(txtFirstPrice.Text, txtSecondPrice.Text, txtThirdPrice.Text, txtOrderTotal.Text);

        // if the data is OK then add it to the object
        if (Error == "")
        {
            OrderBook.ThisOrder.FirstChoice  = Convert.ToInt32(ddlFirstChoice.SelectedValue);
            OrderBook.ThisOrder.SecondChoice = Convert.ToInt32(ddlSecondChoice.SelectedValue);
            OrderBook.ThisOrder.ThirdChoice  = Convert.ToInt32(ddlThirdChoice.SelectedValue);

            OrderBook.ThisOrder.FirstPrice  = Convert.ToInt32(txtFirstPrice.Text);
            OrderBook.ThisOrder.SecondPrice = Convert.ToInt32(txtSecondPrice.Text);
            OrderBook.ThisOrder.ThirdPrice  = Convert.ToInt32(txtThirdPrice.Text);
            OrderBook.ThisOrder.OrderTotal  = Convert.ToInt32(txtOrderTotal.Text);
            // add the record
            OrderBook.Add();
            //Response.Redirect("OrderDefault.aspx");
            Response.Redirect("ACardDetails.aspx");
        }
        else
        {
            //report an error
            lblError.Text = "There were problems with the data entered " + Error;
        }
    }
Ejemplo n.º 24
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);
        }
        public void AddMethodOK()
        {
            //instance of class
            clsOrderCollection AllOrders = new clsOrderCollection();
            //create item for test data
            clsOrder TestItem = new clsOrder();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set properties
            TestItem.OrderId        = 1;
            TestItem.ShippingMethod = "sameday";
            TestItem.DateOrdered    = DateTime.Now.Date;
            TestItem.Dispatched     = true;
            //set ThisOrder to the test data
            AllOrders.ThisOrder = TestItem;
            //add the record
            PrimaryKey = AllOrders.Add();
            //set the primary key of the test data
            TestItem.OrderId = PrimaryKey;
            //find the record
            AllOrders.ThisOrder.Find(PrimaryKey);
            //test if values are the same
            Assert.AreEqual(AllOrders.ThisOrder, TestItem);
        }
Ejemplo n.º 26
0
        public void AddMethodOK()
        {
            //create an instance of the class we want to create
            clsOrderCollection AllOrders = new clsOrderCollection();
            //create the test data
            clsOrders TestItem = new clsOrders();
            //varaible to store the primary key
            Int32 PrimaryKey = 0;

            //set it's properties
            TestItem.OrderId     = 5;
            TestItem.CustomerId  = 1;
            TestItem.ProductId   = "26g";
            TestItem.OrderDate   = DateTime.Now.Date;
            TestItem.Description = "Description 3";
            TestItem.Price       = 12.99;
            TestItem.Paid        = true;
            TestItem.Status      = "Processing";
            TestItem.DateShipped = DateTime.Now.Date;
            //set ThisOrder to the test data
            AllOrders.ThisOrder = TestItem;
            //add the record
            PrimaryKey = AllOrders.Add();
            //set the primary key of the test data
            TestItem.OrderId = PrimaryKey;
            //find the record
            AllOrders.ThisOrder.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllOrders.ThisOrder, TestItem);
        }
Ejemplo n.º 27
0
        public void DeleteMethodOK()
        {
            clsOrderCollection orders = new clsOrderCollection();

            clsOrder order = new clsOrder
            {
                OrderId    = 1,
                CustomerId = 1,
                Date       = DateTime.Now.Date,
                StaffId    = 1,
                Details    = "Text"
            };

            Int32 primaryKey = 0;

            orders.ThisOrder = order;

            primaryKey = orders.Add();

            order.OrderId = primaryKey;

            orders.ThisOrder.find(primaryKey);

            orders.Delete();

            Assert.IsFalse(orders.ThisOrder.find(primaryKey));
        }
Ejemplo n.º 28
0
        public void DeleteMethodOK()
        {
            //create an instance of the class we want to create
            clsOrderCollection AllOrders = new clsOrderCollection();
            //create the test data
            clsOrders TestItem = new clsOrders();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set it's properties
            TestItem.OrderId     = 20;
            TestItem.CustomerId  = 1;
            TestItem.ProductId   = "32g";
            TestItem.OrderDate   = DateTime.Now.Date;
            TestItem.Description = "Another Description";
            TestItem.Price       = 24.99;
            TestItem.Paid        = true;
            TestItem.Status      = "Shipped";
            TestItem.DateShipped = DateTime.Now.Date;
            //set ThisOrder to the test data
            AllOrders.ThisOrder = TestItem;
            //add the record
            PrimaryKey = AllOrders.Add();
            //set the primary key of the test data
            TestItem.OrderId = PrimaryKey;
            //find the record
            AllOrders.ThisOrder.Find(PrimaryKey);
            //delete the record
            AllOrders.Delete();
            //now find the record
            Boolean Found = AllOrders.ThisOrder.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
Ejemplo n.º 29
0
        public void UpdateMethodOk()
        {
            clsOrderCollection AllOrders = new clsOrderCollection();
            clsOrder           TestItem  = new clsOrder();
            Int32 PrimaryKey             = 0;

            TestItem.Shipment     = true;
            TestItem.GameTitle    = "game1"; //first set of attributes
            TestItem.TotalPrice   = 1;
            TestItem.DeliveryDate = DateTime.Now.Date;


            AllOrders.ThisOrder = TestItem;
            PrimaryKey          = AllOrders.Add();
            TestItem.orderID    = PrimaryKey;

            TestItem.Shipment     = false;
            TestItem.GameTitle    = "game2"; //second set of attributes
            TestItem.TotalPrice   = 2;
            TestItem.DeliveryDate = DateTime.Now.Date;


            AllOrders.ThisOrder = TestItem;
            AllOrders.Update();
            AllOrders.ThisOrder.Find(PrimaryKey);
            Assert.AreEqual(AllOrders.ThisOrder, TestItem);//check if they are the same
        }
Ejemplo n.º 30
0
        public void UpdateMethodOk()
        {
            clsOrderCollection AllOrders = new clsOrderCollection();
            clsOrder           TestItem  = new clsOrder();
            Int32 PrimaryKey             = 0;

            TestItem.OrderDate     = DateTime.Now.Date;
            TestItem.OrderTotal    = 200;
            TestItem.CustomerId    = 5;
            TestItem.StaffId       = 2;
            TestItem.OrderStatus   = true;
            TestItem.OrderProgress = "test";
            AllOrders.ThisOrder    = TestItem;
            PrimaryKey             = AllOrders.Add();
            TestItem.OrderId       = PrimaryKey;
            TestItem.OrderDate     = DateTime.Now.Date;
            TestItem.OrderTotal    = 250;
            TestItem.CustomerId    = 5;
            TestItem.StaffId       = 1;
            TestItem.OrderStatus   = false;
            TestItem.OrderProgress = "test";
            AllOrders.ThisOrder    = TestItem;
            AllOrders.Update();
            AllOrders.ThisOrder.Find(PrimaryKey);
            Assert.AreEqual(AllOrders.ThisOrder, TestItem);
        }