Esempio 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);
        }
Esempio n. 2
0
        public async Task <ActionResult> ChangeSetWithoutFilter(int floor, int ceil, int max, int change)
        {
            ActionResult  actionResult = null;
            Json311       dataHandler  = null;
            HomeViewModel model        = new HomeViewModel()
            {
                rowHandler = new RowHandler()
                {
                    Curr_min = floor,
                    Curr_max = ceil,
                    total    = max
                }
            };

            try
            {
                dataHandler = new Json311();
                if (change > 0)
                {
                    model.rowHandler.UpdateValuesUp();
                }
                else
                {
                    model.rowHandler.UpdateValuesDown();
                }
                model.JsonData     = dataHandler.GetFullDataset(model.rowHandler.Curr_min, model.rowHandler.Curr_max);
                model.CurrentFloor = model.rowHandler.Curr_min;
                model.CurrentCeil  = model.rowHandler.Curr_max;
                model.CurrentMax   = max;
                model.ChangeDown   = -500;
                model.ChangeUp     = 500;
                model.ActiveSearch = false;
                actionResult       = View("Index", model);
            }
            catch (Exception ex)
            {
                actionResult = Json(new { Reroute = false, error = $"Error retrieving new DataSet: {ex.GetType()}" });
            }
            return(await Task.FromResult(actionResult));
        }
Esempio n. 3
0
        public async Task <ActionResult> Index(HomeViewModel model)
        {
            Json311      json         = new Json311();
            ActionResult actionResult = null;

            if (model.StartDate.HasValue)
            {
                model.rowHandler = new RowHandler()
                {
                    Curr_min = model.CurrentFloor,
                    Curr_max = model.CurrentCeil,
                    total    = model.CurrentMax
                };
                try
                {
                    DateTime?start, end;
                    start = model.StartDate;
                    if (model.EndDate.HasValue)
                    {
                        end = model.EndDate.Value;
                    }
                    else
                    {
                        end = DateTime.Now;
                    }
                    int offset = 0;
                    if (model.NextSet)
                    {
                        offset = model.CurrentCeil;
                    }
                    else if (model.PreviousSet)
                    {
                        if ((offset - 500) < 0)
                        {
                            offset = 0;
                        }
                        else
                        {
                            offset -= 500;
                        }
                    }
                    if (offset > model.CurrentMax)
                    {
                        offset = 0;
                    }

                    model.JsonData     = json.GetDateFilteredList(500, offset, start.Value, end.Value);
                    model.CurrentFloor = offset;
                    model.StartDate    = start;
                    model.EndDate      = end;
                    model.CurrentCeil  = model.CurrentFloor + model.JsonData.Count();
                    model.CurrentMax   = json.GetCount(start.Value, end.Value);

                    actionResult = View(model);
                }
                catch (Exception ex)
                {
                }
            }
            else
            {
                model.JsonData     = json.GetFullDataset(0, 500);
                model.CurrentFloor = 0;
                model.CurrentCeil  = model.JsonData.Count();
                model.CurrentMax   = json.GetCount();
                model.ChangeUp     = 500;
                model.ChangeDown   = -500;
                model.ActiveSearch = false;
                actionResult       = View(model);
            }

            return(await Task.FromResult(actionResult));
        }