/// <summary> Constructor for a new instance of the Delete_Item_MySobekViewer class </summary>
        /// <param name="User"> Authenticated user information </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        /// <param name="Current_Item"> Individual digital resource to be deleted by the user </param>
        /// <param name="All_Items_Lookup"> Allows individual items to be retrieved by various methods as <see cref="SobekCM.Library.Application_State.Single_Item"/> objects.</param>
        /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param>
        public Delete_Item_MySobekViewer(User_Object User,
            SobekCM_Navigation_Object Current_Mode, 
			SobekCM_Item Current_Item,
            Item_Lookup_Object All_Items_Lookup,
            Custom_Tracer Tracer)
            : base(User)
        {
            Tracer.Add_Trace("Delete_Item_MySobekViewer.Constructor", "Delete this item");

            // Save mode and set defaults
            currentMode = Current_Mode;
            item = Current_Item;
            errorCode = -1;

            // Second, ensure this is a logged on user and system administrator before continuing
            Tracer.Add_Trace("Delete_Item_MySobekViewer.Constructor", "Validate user permissions" );
            if ((User == null)  || ( !User.LoggedOn ))
            {
                Tracer.Add_Trace("Delete_Item_MySobekViewer.Constructor", "User does not have delete permissions", Custom_Trace_Type_Enum.Error );
                errorCode = 1;
            }
            else
            {
                bool canDelete = false;
                if ((User.Can_Delete_All) || (User.Is_System_Admin))
                {
                    canDelete = true;
                }
                else
                {
                    // In this case, we actually need to build this!
                    try
                    {
            //					SobekCM_Item testItem = SobekCM_Item_Factory.Get_Item(Current_Mode.BibID, Current_Mode.VID, null, Tracer);
                        if (User.Can_Delete_This_Item(item))
                            canDelete = true;
                    }
                    catch
                    {
                        canDelete = false;
                    }
                }

                if (!canDelete)
                {
                    Tracer.Add_Trace("Delete_Item_MySobekViewer.Constructor", "User does not have delete permissions", Custom_Trace_Type_Enum.Error);
                    errorCode = 1;
                }
            }

            // Ensure the item is valid
            if (errorCode == -1)
            {
                Tracer.Add_Trace("Delete_Item_MySobekViewer.Constructor", "Validate item exists");
                if (!All_Items_Lookup.Contains_BibID_VID(Current_Mode.BibID, Current_Mode.VID))
                {
                    Tracer.Add_Trace("Delete_Item_MySobekViewer.Constructor", "Item indicated is not valid", Custom_Trace_Type_Enum.Error);
                    errorCode = 2;
                }
            }

             // If this is a postback, handle any events first
            if ((currentMode.isPostBack) && ( errorCode < 0 ))
            {
                Debug.Assert(User != null, "User != null");

                // Pull the standard values
                string save_value = HttpContext.Current.Request.Form["admin_delete_item"];
                string text_value = HttpContext.Current.Request.Form["admin_delete_confirm"];

                // Better say "DELETE", or just send back to the item
                if (( save_value == null ) || ( save_value.ToUpper() != "DELETE" ) || ( text_value.ToUpper() != "DELETE"))
                {
                    HttpContext.Current.Response.Redirect(Current_Mode.Base_URL + currentMode.BibID + "/" + currentMode.VID, false);
                    HttpContext.Current.ApplicationInstance.CompleteRequest();
                    currentMode.Request_Completed = true;
                }
                else
                {
                    if (currentMode.BibID.ToUpper() == "TEMP000001")
                    {
                        for (int deleteVID = 2124; deleteVID <= 2134; deleteVID++)
                        {
                            currentMode.VID = deleteVID.ToString().PadLeft(5, '0');
                            Delete_Item(User, All_Items_Lookup, Tracer);
                        }
                    }
                    else
                    {
                        Delete_Item(User, All_Items_Lookup, Tracer);
                    }

                }
            }
        }