Exemple #1
0
        /// <summary>
        /// This method is used to select and bind junk item data to the form control. If there
        /// are no records, the panel indicating that there are no records is shown. Otherwise,
        /// the records are bound to the Repeater control to display the data.
        /// </summary>
        private void DisplayJunkData()
        {
            // Define the SelectNoteDataSet method input parameters
            bool isRemove    = true; // Set to false for note records, true for junk records marked as isRemove.
            int  lenTextAbbr = 25;   // The number of characters of note text to return as abbreviated text.
            bool isSortDesc  = true; // Set to true for returned records in descending order, false for ascending.

            try
            {
                // Obtain the DataSet and place into a DataTable ...
                DataTable junkTable = _sqlNoteData.SelectNoteDataSet(isRemove, lenTextAbbr, isSortDesc).Tables[0];

                // Count the number of returned records ...
                int intRecordCount = junkTable.Rows.Count;

                if (intRecordCount == 0)
                {
                    // Show the Update Panel ...
                    UpdatePanelDataAbsent.Visible = true;

                    // Assign the message ...
                    lblDataAbsent.Text = "There is no junk. :-)";

                    // Disable the Restore button ...
                    btnRestore.Enabled = false;
                }
                else
                {
                    // Hide the Update Panel ...
                    UpdatePanelDataAbsent.Visible = false;

                    // Assign records found data table to the form control ...
                    RepeaterItemDetail.DataSource = junkTable;
                    // Bind the data to the form control ...
                    RepeaterItemDetail.DataBind();

                    // Enable the Restore button ...
                    btnRestore.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                // Handle the exception ...
                HandleAppError(ex);
            }
        }
Exemple #2
0
        /// <summary>
        /// This method is used to select and bind data about notes that are marked
        /// as junk to the form control. If there are no records, an update panel is
        /// shown to reflect that. Otherwise, the data is bound to a repeater control
        /// to display the data.
        /// </summary>
        private void DisplayNoteData()
        {
            // Define the SelectNoteDataSet method input parameters
            bool isRemove    = false; // Set to false for note records, true for junk records marked as isRemove.
            int  lenTextAbbr = 25;    // The number of characters of note text to return as abbreviated text.
            bool isSortDesc  = true;  // Set to true for returned records in descending order, false for ascending.

            try
            {
                // Obtain the DataSet and place into a DataTable ...
                DataTable noteTable = _sqlNoteData.SelectNoteDataSet(isRemove, lenTextAbbr, isSortDesc).Tables[0];

                // Count the number of returned records ...
                int intRecordCount = noteTable.Rows.Count;

                // Update the hidden page field with the number of records ...
                hidRecords.Value = intRecordCount.ToString();

                if (intRecordCount == 0)
                {
                    // Show the Update Panel ...
                    UpdatePanelDataAbsent.Visible = true;

                    // Assign the message ...
                    lblDataAbsent.Text = "Click the '" + btnCreate.Text + "' button to begin writing your note. :-)";
                }
                else
                {
                    // Hide the Update Panel ...
                    UpdatePanelDataAbsent.Visible = false;

                    // Assign records found data table to the form control ...
                    RepeaterItemDetail.DataSource = noteTable;
                    // Bind the data to the form control ...
                    RepeaterItemDetail.DataBind();
                }
            }
            catch (Exception ex)
            {
                // Handle the exception ...
                HandleAppError(ex);
            }
        }