예제 #1
0
    protected void btnFind_Click(object sender, EventArgs e)
    {
        //create an instance of the Order class
        clsOrders AnOrder = new clsOrders();
        //variable to store the primary key
        Int32 OrderId;
        //variable to store the result of the find operation
        Boolean Found = false;

        //get the primart key entered by the user
        OrderId = Convert.ToInt32(txtOrderId.Text);
        //find the record
        Found = AnOrder.Find(OrderId);
        //if found
        if (Found == true)
        {
            //display the values of the properties in the form
            txtCustomerId.Text  = AnOrder.CustomerId.ToString();
            txtProductId.Text   = AnOrder.ProductId;
            txtOrderDate.Text   = AnOrder.OrderDate.ToString();
            txtDescription.Text = AnOrder.Description;
            txtPrice.Text       = AnOrder.Price.ToString();
            txtStatus.Text      = AnOrder.Status;
            txtDateShipped.Text = AnOrder.DateShipped.ToString();
        }
        else
        {
            txtOrderId.Text = "No order with that ID";
        }
    }
예제 #2
0
        public void FindMethodOK()
        {
            clsOrders AnOrder = new clsOrders();
            Boolean   Found   = false;
            Int32     OrderID = 1;

            Found = AnOrder.Find(OrderID);
            Assert.IsTrue(Found);
        }
예제 #3
0
        public void TestOrderDateFound()
        {
            clsOrders AnOrder = new clsOrders();
            Boolean   Found   = false;
            Boolean   OK      = true;
            Int32     OrderId = 32;

            Found = AnOrder.Find(OrderId);
            if (AnOrder.OrderDate != Convert.ToDateTime("15/2/2021"))
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
예제 #4
0
        public void TestOrderIDFound()
        {
            clsOrders AnOrder = new clsOrders();
            Boolean   Found   = false;
            Boolean   OK      = true;
            Int32     OrderID = 1;

            Found = AnOrder.Find(OrderID);
            if (AnOrder.OrderID != 1)
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
예제 #5
0
        public void TestOrderDispatchedStatusFound()
        {
            clsOrders AnOrder = new clsOrders();
            Boolean   Found   = false;
            Boolean   OK      = true;
            Int32     OrderId = 32;

            Found = AnOrder.Find(OrderId);
            if (AnOrder.DispatchedStatus != true)
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
예제 #6
0
        public void FindMethodOK()
        {
            //create an instance of the class
            clsOrders AnOrder = new clsOrders();
            //Boolean variable to store the result of the validation
            Boolean Found = false;
            //create some test data to use with the method
            string OrderNo = "98765";

            //invoke the method
            Found = AnOrder.Find(OrderNo);
            //test to see that the result is correct
            Assert.IsTrue(Found);
        }
예제 #7
0
        public void TestTotalCostFound()
        {
            clsOrders AnOrder   = new clsOrders();
            Boolean   Found     = false;
            Boolean   OK        = true;
            Int32     TotalCost = 15;

            Found = AnOrder.Find(TotalCost);
            if (AnOrder.TotalCost != 15)
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
예제 #8
0
        public void TestOrderItemIdFound()
        {
            clsOrders AnOrder = new clsOrders();
            Boolean   Found   = false;
            Boolean   OK      = true;
            Int32     OrderId = 32;

            Found = AnOrder.Find(OrderId);
            if (AnOrder.ItemId != 1)
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
예제 #9
0
        public void TestDateAddedFound()
        {
            clsOrders AnOrder = new clsOrders();
            Boolean   Found   = false;
            Boolean   OK      = true;
            Int32     OrderID = 1;

            Found = AnOrder.Find(OrderID);
            if (AnOrder.DateAdded != Convert.ToDateTime("18/02/2020"))
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
예제 #10
0
        public void TestOrderQuantityFound()
        {
            clsOrders AnOrder = new clsOrders();
            Boolean   Found   = false;
            Boolean   OK      = true;
            Int32     OrderId = 32;

            Found = AnOrder.Find(OrderId);
            if (AnOrder.Quantity != 2)
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
예제 #11
0
        public void TestOrderProductCodeFound()
        {
            clsOrders AnOrder = new clsOrders();
            Boolean   Found   = false;
            Boolean   OK      = true;
            Int32     OrderId = 32;

            Found = AnOrder.Find(OrderId);
            if (AnOrder.ProductCode != "ABC1234")
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
예제 #12
0
        public void FindMethodOK()
        {
            //create an instance of the class we want to create
            clsOrders AnOrder = new clsOrders();
            //boolean variable to store the result of the validation
            Boolean Found = false;
            //create some test data to use with the method
            Int32 OrderId = 1;

            //invoke the method
            Found = AnOrder.Find(OrderId);
            //test to see if the result is true
            Assert.IsTrue(Found);
        }
예제 #13
0
        public void TestOrderUnitPriceFound()
        {
            clsOrders AnOrder = new clsOrders();
            Boolean   Found   = false;
            Boolean   OK      = true;
            Int32     OrderId = 32;

            Found = AnOrder.Find(OrderId);
            if (AnOrder.UnitPrice != 9.99)
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
예제 #14
0
        public void TestOrderDeliveryAddressFound()
        {
            clsOrders AnOrder = new clsOrders();
            Boolean   Found   = false;
            Boolean   OK      = true;
            Int32     OrderId = 32;

            Found = AnOrder.Find(OrderId);
            if (AnOrder.DeliveryAddress != "An Address")
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
예제 #15
0
        public void TestOrderIdFound()
        {
            //create an instance of the class
            clsOrders AnOrder = new clsOrders();
            //boolean variable to store the result of the search
            Boolean Found = false;
            //boolean variable to record if data is Ok (assuming it is)
            Boolean OK = true;
            //create some test data to use with the method
            Int32 OrderId = 1;

            //Invoke the method
            Found = AnOrder.Find(OrderId);
            //check the orderid
            if (AnOrder.OrderId != 1)
            {
                OK = false;
            }
            //test to see the result is correct
            Assert.IsTrue(OK);
        }
예제 #16
0
        public void testOrderDateFound()
        {
            //create an instance
            clsOrders AnOrder = new clsOrders();
            //boolean to store the result of the search
            Boolean Found = false;
            //boolean variable to record if the data is OK
            Boolean OK = true;
            //create some test data to use with the method
            string OrderNo = "98765";

            //invoke the method
            Found = AnOrder.Find(OrderNo);
            //check the property
            if (AnOrder.OrderDate != Convert.ToDateTime("12/01/2018"))
            {
                OK = false;
            }
            //test to see the result is correct
            Assert.IsTrue(OK);
        }
예제 #17
0
        public void TestCustomerIDFound()
        {
            //create an instance of the class we want to create
            clsOrders AnOrder = new clsOrders();
            //boolean variable to store the result of the search
            Boolean Found = false;
            //boolean variable to record if data is OK (assume it is)
            Boolean OK = true;
            //create some test data to use with the method
            string OrderNo = "98765";

            //invoke the method
            Found = AnOrder.Find(OrderNo);
            //check the customer id
            if (AnOrder.CustomerID != "123456")
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
예제 #18
0
        public void TestDateShippedFound()
        {
            //create an instance of the class that we want to create
            clsOrders AnOrder = new clsOrders();
            //boolean cariable to store the result of the search
            Boolean Found = false;
            //boolean variable recorded if data is OK (assume it is)
            Boolean OK = true;
            //create some test data to use with the method
            Int32 OrderId = 1;

            //invoke method
            Found = AnOrder.Find(OrderId);
            //check the property
            if (AnOrder.DateShipped != Convert.ToDateTime("14/03/2021"))
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
예제 #19
0
        public void TestStatusFound()
        {
            //create an instance of the class that we want to create
            clsOrders AnOrder = new clsOrders();
            //boolean variable to store the result of the search
            Boolean Found = false;
            //boolean variable recorded if data is OK (assume it is)
            Boolean OK = true;
            //create some test data to use with the method
            Int32 OrderId = 1;

            //invoke method
            Found = AnOrder.Find(OrderId);
            //check the property
            if (AnOrder.Status != "Dispatched")
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
예제 #20
0
        public void TestPaymentMethodFound()
        {
            //create an instance
            clsOrders AnOrder = new clsOrders();
            //boolean to store the result of the search
            Boolean Found = false;
            //boolean variable to record if the data is OK
            Boolean OK = true;
            //create some test data to use with the method
            string OrderNo = "98765";

            //invoke the method
            Found = AnOrder.Find(OrderNo);
            //check the property
            if (AnOrder.PaymentMethod != "Card")
            {
                OK = false;
            }
            //test to see the result is correct
            Assert.IsTrue(OK);
        }
예제 #21
0
    protected void btnFind_Click(object sender, EventArgs e)
    {
        //create an instance of the order class
        clsOrders AnOrder = new clsOrders();
        //variable to store the primary key
        Int32 OrderId;
        // variable to store the result of the find operation
        Boolean Found = false;

        //get the primary key entered by the user
        OrderId = Convert.ToInt32(txtOrderId.Text);
        //find the record
        Found = AnOrder.Find(OrderId);
        //if found
        if (Found == true)
        {
            //display the values of the properties in the form

            txtOrderDate.Text    = AnOrder.OrderDate.ToString();
            txtShippingInfo.Text = AnOrder.ShippingInfo;
        }
    }
예제 #22
0
    protected void btnFind_Click(object sender, EventArgs e)
    {
        clsOrders AnOrder = new clsOrders();
        Int32     OrderId;
        Boolean   Found = false;

        OrderId = Convert.ToInt32(txtOrderId.Text);
        Found   = AnOrder.Find(OrderId);
        if (Found == true)
        {
            txtItemId.Text          = Convert.ToString(AnOrder.ItemId);
            txtOrderDate.Text       = Convert.ToString(AnOrder.OrderDate);
            txtDeliveryAddress.Text = AnOrder.DeliveryAddress;
            txtUnitPrice.Text       = Convert.ToString(AnOrder.UnitPrice);
            txtQuantity.Text        = Convert.ToString(AnOrder.Quantity);
            txtProductCode.Text     = Convert.ToString(AnOrder.ProductCode);
            chkDispatched.Checked   = Convert.ToBoolean(AnOrder.DispatchedStatus);
        }
        else
        {
            lblError.Text = "Order ID not recognised";
        }
    }