Beispiel #1
0
        public void DeleteMethodOK()
        {
            //create an instance of the class we want to create
            clsOrderLineCollection AllOrderLines = new clsOrderLineCollection();
            //create the item of test data
            clsOrderLine TestItem = new clsOrderLine();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.OrderLineID = 5;
            TestItem.OrderID     = "5";
            TestItem.ProductID   = "5";
            //set ThisOrder to the test data
            AllOrderLines.ThisOrderLine = TestItem;
            //add the record
            PrimaryKey = AllOrderLines.Add();
            //set the primary key of the test data
            TestItem.OrderLineID = PrimaryKey;
            //Find the record
            AllOrderLines.ThisOrderLine.Find(PrimaryKey);
            //delete the record
            AllOrderLines.Delete();
            //now find the record
            Boolean Found = AllOrderLines.ThisOrderLine.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
        public void DeleteMethodOK()
        {
            //create class instance
            clsOrderLineCollection AllOrderLines = new clsOrderLineCollection();
            // create test data
            clsOrderLine TestItem = new clsOrderLine();
            // primary key variable
            Int32 PrimaryKey = 0;

            // set properties
            TestItem.orderID       = 1;
            TestItem.orderLineID   = 1;
            TestItem.staffID       = 1;
            TestItem.orderComplete = true;
            //set this order to the test data
            AllOrderLines.ThisOrderLine = TestItem;
            // add record
            PrimaryKey = AllOrderLines.Add();
            // set primary key of test data
            TestItem.orderLineID = PrimaryKey;
            // find record
            AllOrderLines.ThisOrderLine.Find(PrimaryKey);
            // delete record
            AllOrderLines.Delete();
            // find the record again
            Boolean Found = AllOrderLines.ThisOrderLine.Find(PrimaryKey);

            // test that record was not found
            Assert.IsFalse(Found);
        }
Beispiel #3
0
        public void DeleteMethodOK()
        {
            clsOrderLineCollection orderLines = new clsOrderLineCollection();

            clsOrderLine orderLine = new clsOrderLine
            {
                OrderId     = 3,
                OrderLineId = 1,
                ProductId   = 1,
                Quantity    = 5
            };

            Int32 primaryKey = 0;

            orderLines.ThisOrderLine = orderLine;

            primaryKey = orderLines.Add();

            orderLine.OrderLineId = primaryKey;

            orderLines.ThisOrderLine.find(primaryKey);

            orderLines.Delete();

            Assert.IsFalse(orderLines.ThisOrderLine.find(primaryKey));
        }
Beispiel #4
0
        public void DeleteMethodOK()
        {
            //instance of class
            clsOrderLineCollection AllOrderLines = new clsOrderLineCollection();
            //create item for test data
            clsOrderLine TestItem = new clsOrderLine();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set properties
            TestItem.OrderId   = 1;
            TestItem.ProductId = "123abc";
            TestItem.Price     = 24.99;
            TestItem.Quantity  = 3;
            TestItem.Available = true;
            //set ThisOrder to the test data
            AllOrderLines.ThisOrderLine = TestItem;
            //add the record
            PrimaryKey = AllOrderLines.Add();
            //set the primary key of the test data
            TestItem.OrderId = PrimaryKey;
            //find the record
            AllOrderLines.ThisOrderLine.Find(PrimaryKey);
            //delete the record
            AllOrderLines.Delete();
            //now find the record
            Boolean Found = AllOrderLines.ThisOrderLine.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
    protected void btnYes_Click(object sender, EventArgs e)
    {
        clsOrderLineCollection OrderLines = new clsOrderLineCollection();

        OrderLines.ThisOrderLine.Find(OrderLineID);
        OrderLines.Delete();
        Response.Redirect("OrderLineList.aspx");
    }
Beispiel #6
0
    protected void btnYes_Click(object sender, EventArgs e)
    {
        clsOrderLineCollection AddressBook = new clsOrderLineCollection();

        AddressBook.ThisOrderLine.Find(TotalCost);

        AddressBook.Delete();
        Response.Redirect("OrderLineList.aspx");
    }
Beispiel #7
0
    void DeleteOrder()
    {
        //function to delete selected record
        //create a new instance of the OrderCollection
        clsOrderLineCollection OrderLineCollection = new clsOrderLineCollection();

        //find the record to delete
        OrderLineCollection.ThisOrderLine.Find(OrderLineID);
        //Delete the record
        OrderLineCollection.Delete();
    }
Beispiel #8
0
    protected void btnYes_Click(object sender, EventArgs e)
    {
        // new instance of order line collection
        clsOrderLineCollection OrderLineList = new clsOrderLineCollection();

        // find record to delete
        OrderLineList.ThisOrderLine.Find(OrderLineID);
        // delete record
        OrderLineList.Delete();
        // redirect to main page
        Response.Redirect("OrderLineList.aspx");
    }
    protected void btnYes_Click(object sender, EventArgs e)
    {
        clsOrderLineCollection orderLines = new clsOrderLineCollection();

        if (orderLines.ThisOrderLine.find(OrderLineId) == true)
        {
            orderLines.ThisOrderLine.find(OrderLineId);
        }

        orderLines.Delete();

        Response.Redirect("OrderLineList.aspx");
    }
        void Delete()
        {
            //var to store primary key value
            Int32 OrderLineID;
            //create a new in stance of collection class
            clsOrderLineCollection AllOrders = new clsOrderLineCollection();

            //find the record to delete
            OrderLineID = Convert.ToInt32(lstOrderLine.SelectedValue);
            AllOrders.ThisOrderLine.Find(OrderLineID);
            //delete the record
            AllOrders.Delete();
        }
      public void DeleteMethodOK()
      {
          clsOrderLineCollection AllOrderLines = new clsOrderLineCollection();
          clsOrderLine           TestItem      = new clsOrderLine();
          Int32 PrimaryKey = 0;

          TestItem.orderLineID          = 1;
          TestItem.selectionDescription = "Nike Air";
          TestItem.orderID            = 1;
          TestItem.productID          = 1;
          TestItem.quantity           = 2;
          AllOrderLines.ThisOrderLine = TestItem;
          PrimaryKey           = AllOrderLines.Add();
          TestItem.orderLineID = PrimaryKey;
          AllOrderLines.ThisOrderLine.Find(PrimaryKey);
          AllOrderLines.Delete();
          Boolean Found = AllOrderLines.ThisOrderLine.Find(PrimaryKey);

          Assert.IsFalse(Found);
      }
Beispiel #12
0
        public void DeleteMethodOk()
        {
            clsOrderLineCollection AllLines = new clsOrderLineCollection();
            clsOrderLine           TestItem = new clsOrderLine();
            Int32 PrimaryKey = 0;

            TestItem.OrderLineId     = 1;
            TestItem.OrderId         = 1;
            TestItem.ItemNo          = 1;
            TestItem.ItemDescription = "Test Item";
            TestItem.Quantity        = 1;
            TestItem.UnitCost        = 15;
            AllLines.ThisOrderLine   = TestItem;
            PrimaryKey       = AllLines.Add();
            TestItem.OrderId = PrimaryKey;
            AllLines.ThisOrderLine.Find(PrimaryKey);
            AllLines.Delete();
            bool Found = AllLines.ThisOrderLine.Find(PrimaryKey);

            Assert.IsFalse(Found);
        }