Example #1
0
        public void addDevice(DeviceListItem i)
        {
            OwnerListItem l = deviceOwnerProvider.getOwner(dataOwnerID);

            l.lastDeviceID = deviceProvider.addDevice(dataOwnerID, l.lastDeviceID, i);
            if (l.firstDeviceID == 0)
            {
                l.firstDeviceID = l.lastDeviceID;
            }
            deviceOwnerProvider.updateOwner(dataOwnerID, l);
        }
Example #2
0
        public void deleteDevice(int ID)
        {
            OwnerListItem l = deviceOwnerProvider.getOwner(dataOwnerID);

            if (l.firstDeviceID == ID)
            {
                l.firstDeviceID = deviceProvider.getNextDevice(dataOwnerID, ID);
            }

            if (l.lastDeviceID == ID)
            {
                l.lastDeviceID = deviceProvider.getPrevDevice(dataOwnerID, ID);
            }

            DeletedDevicePosition r = deviceProvider.deleteDevice(dataOwnerID, ID);

            if (r == DeletedDevicePosition.first || r == DeletedDevicePosition.last)
            {
                deviceOwnerProvider.updateOwner(dataOwnerID, l);
            }
        }