コード例 #1
0
ファイル: GuestController.cs プロジェクト: huntingphi/REHOMAS
        public void DataMaintenance(Guest aGuest, DB.DBOperation operation)
        {
            int index = 0;

            //perform a given database operation to the dataset in meory;
            hotelDB.DataSetChange(aGuest, operation);
            //perform operations on the collection
            switch (operation)
            {
            case DB.DBOperation.Add:
                //*** Add the guest to the Collection
                guests.Add(aGuest);
                break;

            case DB.DBOperation.Edit:
                index         = FindIndex(aGuest);
                guests[index] = aGuest;      // replace guest at this index with the updated guest
                break;

            case DB.DBOperation.Delete:
                index = FindIndex(aGuest);   // find the index of the specific guest in collection
                guests.RemoveAt(index);      // remove that guest form the collection
                break;
            }
        }
コード例 #2
0
        public void DataMaintenance(Booking aBooking, DB.DBOperation operation)
        {
            int index = 0;

            //perform a given database operation to the dataset in meory;
            hotelDB.DataSetChange(aBooking, operation);
            //perform operations on the collection
            switch (operation)
            {
            case DB.DBOperation.Add:
                //*** Add the booking to the Collection
                bookings.Add(aBooking);
                break;

            case DB.DBOperation.Edit:
                index           = FindIndex(aBooking);
                bookings[index] = aBooking;      // replace booking at this index with the updated booking
                break;

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