Example #1
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);
            }
        }
Example #2
0
        public DeletedDevicePosition deleteDevice(string dataOwnerID, int ID)
        {
            this.ID          = ID;
            this.dataOwnerID = dataOwnerID;
            getItem();
            int savedPrevID = prevID;

            deleteItem();

            DeletedDevicePosition r = DeletedDevicePosition.middle;
            int savedID             = 0;

            if (nextID != 0)
            {
                this.ID = nextID;
                getItem();
                prevID  = savedPrevID;
                savedID = this.ID;
                putItem();
            }
            else
            {
                r = DeletedDevicePosition.last;
            }
            if (savedPrevID != 0)
            {
                this.ID = savedPrevID;
                getItem();
                nextID = savedID;
                putItem();
            }
            else
            {
                r = DeletedDevicePosition.first;
            }
            return(r);
        }