Exemplo n.º 1
0
        public void DataMaintenance(Booking myBooking, DB.DBOperation operation)
        {
            int index = 0;

            //perform a given database operation to the dataset in meory;
            BookingDB.DataSetChange(myBooking, operation);
            //perform operations on the collection
            switch (operation)
            {
            case DB.DBOperation.Add:
                //*** Add the Booking to the Collection
                Bookings.Add(myBooking);
                break;

            case DB.DBOperation.Edit:
                index           = FindIndex(myBooking);
                Bookings[index] = myBooking;      // replace Booking at this index with the updated Booking
                break;

            case DB.DBOperation.Delete:
                index = FindIndex(myBooking);  // find the index of the specific Booking in collection
                Bookings.RemoveAt(index);      // remove that Booking form the collection
                break;
            }
        }