private void add_new_checked_out_status(int ItemID, string IP_Address)
        {
            Checked_Out_Item newItem  = new Checked_Out_Item(ItemID, IP_Address);
            bool             reserved = false;

            while (!reserved)
            {
                try
                {
                    itemsByCheckoutTime[newItem.Check_Out_Time] = newItem;
                    reserved = true;
                }
                catch
                {
                    newItem.Renew();
                }
            }
            itemsByItemid[ItemID] = newItem;
        }
        /// <summary> Attempts to check out an item (if it was marked for checking out and single use)
        /// to a particular user.  If the user already has that item, it is renewed.  If the item is
        /// checked out to a different user, then the user fails to check it out </summary>
        /// <param name="ItemID"> Primary key to the digital resource which to check out</param>
        /// <param name="IP_Address"> IP Address to which to check this item </param>
        /// <returns> TRUE if successful, otherwise FALSE </returns>
        public bool Check_Out(int ItemID, string IP_Address)
        {
            // First, always update the checkout list
            Update_Check_Out_List();

            if (itemsByItemid.ContainsKey(ItemID))
            {
                Checked_Out_Item newItem = itemsByItemid[ItemID];

                if (newItem.IP_Address == IP_Address)
                {
                    if (itemsByCheckoutTime.ContainsKey(newItem.Check_Out_Time))
                    {
                        itemsByCheckoutTime.Remove(newItem.Check_Out_Time);
                    }
                    newItem.Renew();
                    bool reserved = false;
                    while (!reserved)
                    {
                        try
                        {
                            itemsByCheckoutTime[newItem.Check_Out_Time] = newItem;
                            reserved = true;
                        }
                        catch
                        {
                            newItem.Renew();
                        }
                    }
                    return(true);
                }

                return(false);
            }

            add_new_checked_out_status(ItemID, IP_Address);
            return(true);
        }
 private void remove_item(Checked_Out_Item deleteItem)
 {
     itemsByCheckoutTime.Remove(deleteItem.Check_Out_Time);
     itemsByItemid.Remove(deleteItem.ItemID);
 }
 private void add_new_checked_out_status(int ItemID, string IP_Address)
 {
     Checked_Out_Item newItem = new Checked_Out_Item(ItemID, IP_Address);
     bool reserved = false;
     while (!reserved)
     {
         try
         {
             itemsByCheckoutTime[newItem.Check_Out_Time] = newItem;
             reserved = true;
         }
         catch
         {
             newItem.Renew();
         }
     }
     itemsByItemid[ItemID] = newItem;
 }
 private void remove_item(Checked_Out_Item deleteItem)
 {
     itemsByCheckoutTime.Remove(deleteItem.Check_Out_Time);
     itemsByItemid.Remove(deleteItem.ItemID);
 }