Esempio n. 1
0
        public void FindOK()
        {
            clsShipping AShipment  = new clsShipping();
            Boolean     Found      = false;
            int         ShippingId = 5;

            Found = AShipment.Find(ShippingId);
            Assert.IsTrue(Found);
        }
Esempio n. 2
0
        public void TestDateOfDispatchFound()
        {
            clsShipping AShipment  = new clsShipping();
            Boolean     Found      = false;
            Boolean     OK         = true;
            int         ShippingId = 8;

            Found = AShipment.Find(ShippingId);
            if (AShipment.DateOfDispatch != Convert.ToDateTime("20/04/2021"))
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
Esempio n. 3
0
        public void TestShippingIdFound()
        {
            clsShipping AShipment  = new clsShipping();
            Boolean     Found      = false;
            Boolean     OK         = true;
            int         ShippingId = 5;

            Found = AShipment.Find(ShippingId);
            if (AShipment.ShippingId != 5)
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
Esempio n. 4
0
        public void TestDispatchedFound()
        {
            clsShipping AShipment  = new clsShipping();
            Boolean     Found      = false;
            Boolean     OK         = true;
            int         ShippingId = 8;

            Found = AShipment.Find(ShippingId);
            if (AShipment.Dispatched != true)
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
    protected void btnFind_Click(object sender, EventArgs e)
    {
        lblError.Text = "";

        clsShipping AShipment = new clsShipping();

        Int32   ShippingId;
        Boolean Found = false;

        ShippingId = Convert.ToInt32(txtShippingId.Text);

        Found = AShipment.Find(ShippingId);

        if (Found == true)
        {
            lstShippingType.SelectedValue = AShipment.ShippingType;
            txtPrice.Text = AShipment.Price.ToString();
            if (txtDateOfDispatch.Text == null)
            {
                //do nothing
            }
            else
            {
                txtDateOfDispatch.Text = AShipment.DateOfDispatch.ToString();
            }
        }
        else
        {
            //reset the text boxes to empty
            txtShippingId.Text            = "";
            lstShippingType.SelectedIndex = 0;
            txtPrice.Text          = "";
            txtDateOfDispatch.Text = "";
            //output an error message
            lblError.Text = "Error! Item does not exist";
        }
    }