Ejemplo n.º 1
0
        /// <summary>
        /// fill a list of our custom varible for us to display to the user
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <returns>Returns the data to populate the table</returns>
        private List <Json311> GetData(RowNumbers rows)
        {
            SqlConnect     getConnection = new SqlConnect();
            List <Json311> displayData;
            Json311        retrieve = new Json311();

            rows.total  = getConnection.GetRows();
            displayData = retrieve.GetFullDataset(rows.Curr_min, rows.rowsRemaining);
            return(displayData);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Display_dates(object sender, RoutedEventArgs e)
        {
            DateTime?      start     = Start.SelectedDate;
            DateTime?      end       = Start.SelectedDate;
            RowNumbers     rows      = Application.Current.Resources["RowNumbers"] as RowNumbers;
            SqlConnect     dbconnect = new SqlConnect();
            Json311        get_data  = new Json311();
            List <Json311> show_data = new List <Json311>();

            if (!start.HasValue)
            {
                MessageBox.Show("Select a date on the left");
            }
            else if (start.HasValue && !end.HasValue)
            {
                DateTime new_start = (DateTime)start;
                int      year      = new_start.Year;
                int      month     = new_start.Month;
                int      date      = new_start.Day;
                DateTime date1     = new DateTime(year, month, date, 0, 0, 0);
                DateTime date2     = new DateTime(year, month, date, 23, 59, 59);
                int      num_rows  = dbconnect.GetRows(date1, date2);
                if (num_rows == 0)
                {
                    MessageBox.Show("There are no values for the selected dates");
                }
                else
                {
                    rows.filter_min = 0;
                    if (num_rows > 500)
                    {
                        rows.filter_max = 500;
                    }
                    else
                    {
                        rows.filter_max = num_rows;
                    }
                    rows.filter_total         = num_rows;
                    rows.is_filter            = true;
                    show_data                 = get_data.GetDateFilteredList(0, 0, date1, date2);
                    DBDataBinding.ItemsSource = show_data;
                    this.NavigationService.Refresh();
                }
            }
            Application.Current.Resources["RowNumbers"] = rows;
        }