/// <summary> Constructor for a new instance of the Private_Items_AggregationViewer class </summary>
 /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
 /// <param name="Current_Aggregation"> Current item aggregation object to display </param>
 /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param>
 public Private_Items_AggregationViewer(SobekCM_Navigation_Object Current_Mode, Item_Aggregation Current_Aggregation, Custom_Tracer Tracer)
     : base(Current_Aggregation, Current_Mode)
 {
     privateItems = SobekCM_Database.Tracking_Get_Aggregation_Private_Items(currentCollection.Code, (int) RESULTS_PER_PAGE, currentMode.Page, currentMode.Sort, Tracer);
 }
        /// <summary> Gets the list of all private and dark items linked to an item aggregation  </summary>
        /// <param name="AggregationCode"> Code for the item aggregation of interest </param>
        /// <param name="ResultsPerPage"> Number of results to return per "page" of results </param>
        /// <param name="ResultsPage"> Which page of results to return ( one-based, so the first page is page number of one )</param>
        /// <param name="Sort"> Current sort to use ( 0 = default by search or browse, 1 = title, 10 = date asc, 11 = date desc )</param>
        /// <param name="Tracer"> Tracer object keeps track of all executions that take place while meeting a user's request </param>
        /// <returns> Table with all of the item and item group information </returns>
        /// <remarks> This calls the 'Tracking_Get_Aggregation_Privates' stored procedure.</remarks>
        public static Private_Items_List Tracking_Get_Aggregation_Private_Items(string AggregationCode, int ResultsPerPage, int ResultsPage, int Sort, Custom_Tracer Tracer )
        {
            if (Tracer != null)
                Tracer.Add_Trace("SobekCM_Database.Tracking_Get_Aggregation_Private_Items", "Pulling list of private items for this aggregation");

            // Create the connection
            SqlConnection connect = new SqlConnection(connectionString + "Connection Timeout=45");

            // Create the command
            SqlCommand executeCommand = new SqlCommand("Tracking_Get_Aggregation_Privates", connect)
                                            {CommandTimeout = 45, CommandType = CommandType.StoredProcedure};

            executeCommand.Parameters.AddWithValue("@code", AggregationCode);
            executeCommand.Parameters.AddWithValue("@pagesize", ResultsPerPage);
            executeCommand.Parameters.AddWithValue("@pagenumber", ResultsPage);
            executeCommand.Parameters.AddWithValue("@sort", Sort);
            executeCommand.Parameters.AddWithValue("@minpagelookahead", 1);
            executeCommand.Parameters.AddWithValue("@maxpagelookahead", 1);
            executeCommand.Parameters.AddWithValue("@lookahead_factor", LOOKAHEAD_FACTOR);

            // Add parameters for total items and total titles
            SqlParameter totalItemsParameter = executeCommand.Parameters.AddWithValue("@total_items", 0);
            totalItemsParameter.Direction = ParameterDirection.InputOutput;

            SqlParameter totalTitlesParameter = executeCommand.Parameters.AddWithValue("@total_titles", 0);
            totalTitlesParameter.Direction = ParameterDirection.InputOutput;

            // Create the data reader
            connect.Open();
            Private_Items_List returnArgs;
            using (SqlDataReader reader = executeCommand.ExecuteReader())
            {

                // Create the return argument object
                returnArgs = new Private_Items_List {Title_Results = DataReader_To_Private_Items_List(reader)};

                // Close the reader
                reader.Close();

                // Store the total items/titles
                returnArgs.Total_Items = Convert.ToInt32(totalItemsParameter.Value);
                returnArgs.Total_Titles = Convert.ToInt32(totalTitlesParameter.Value);
            }
            connect.Close();

            if (Tracer != null)
                Tracer.Add_Trace("SobekCM_Database.Tracking_Get_Aggregation_Private_Items", "Done pulling list of private items");

            return returnArgs;
        }