Esempio n. 1
0
        public void DataMaintenance(Reservation aReservation, DB.DBOperation operation)
        {
            int index = 0;

            //perform a given database operation to the dataset in meory;
            reservationDB.DataSetChange(aReservation, operation);
            //perform operations on the collection
            switch (operation)
            {
            case DB.DBOperation.Add:
                //*** Add the Guest to the Collection
                reservations.Add(aReservation);
                break;

            case DB.DBOperation.Edit:
                index = FindIndex(aReservation);
                reservations[index] = aReservation;      // replace Guest at this index with the updated Guest
                break;

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