Пример #1
0
        public void DeleteMethodOK()
        {
            //create an instance of the class we want to create
            clsBookingCollection AllBookings = new clsBookingCollection("Fbloggs");
            //create an instance of test data
            clsBooking TestItem = new clsBooking();
            //var to store primary key
            Int32 PK = 0;

            //set the properties
            //TestItem.CustomerID = 3;
            TestItem.useremail    = "*****@*****.**";
            TestItem.DateBooked   = DateTime.Now.Date;
            TestItem.TimeBooked   = DateTime.Now.Date.ToString();
            TestItem.GuestsBooked = "10";
            TestItem.DiningBooked = "Dinner";
            //set ThisCustomer to validate test data
            AllBookings.ThisBookings = TestItem;
            //add the record
            PK = AllBookings.Add();
            //set primary key of test data
            TestItem.BookRef = PK;
            //find the record
            AllBookings.ThisBookings.Find(PK);
            //delete the record
            AllBookings.Delete();
            //now find the record
            Boolean Found = AllBookings.ThisBookings.Find(PK);

            //test to see that it exists
            Assert.IsFalse(Found);
        }
Пример #2
0
        public void DeleteMethod()
        {
            //create an instance of a class
            clsBookingCollection AllBooking = new clsBookingCollection();
            //create the item of test data
            clsBooking TestItem = new clsBooking();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.BookingID       = 1;
            TestItem.CustomerID      = 2;
            TestItem.StaffID         = 2;
            TestItem.FlightID        = 2;
            TestItem.BookingName     = "Tom";
            TestItem.BookingDate     = DateTime.Now.Date;
            TestItem.BookingValidity = 30;
            //set thisBooking to the test data
            AllBooking.ThisBooking = TestItem;
            //add the record
            PrimaryKey = AllBooking.Add();
            //set the primary key of the test data
            TestItem.BookingID = PrimaryKey;
            //find the record
            AllBooking.ThisBooking.Find(PrimaryKey);
            //delete this record
            AllBooking.Delete();
            //now find the record
            Boolean Found = AllBooking.ThisBooking.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
    void DeleteBooking()
    {
        //function to delete the selected record

        //create a new instance of the Booking book
        clsBookingCollection BookingBook = new clsBookingCollection();

        //find the record to delete
        BookingBook.ThisBooking.Find(BookingID);
        //delete the record
        BookingBook.Delete();
    }
    void Delete()
    {
        ////function to delete the selected record


        //create a new instance of the Customer collection
        clsBookingCollection BookingList = new clsBookingCollection(User.Identity.Name);

        //find the record to delete
        BookingList.ThisBookings.Find(bookRef);
        //delete the record
        BookingList.Delete();
    }
Пример #5
0
        private void DeleteRecord()
        {
            string username = Session["user"].ToString();
            //new instance
            clsBookingCollection Record = new clsBookingCollection(username);

            //get the number of the booking to be deleted from the session object
            BookingID = Convert.ToInt32(Session["BookingID"]);
            //find the record
            Record.ThisBooking.Find(BookingID);
            //delete the record
            Record.Delete();
        }