public async Task OnGetAsync(string searchString) { AllTickets = await TicketService.GetPaginatedResult(CurrentPage, PageSize); if (!String.IsNullOrEmpty(searchString)) { AllTickets = AllTickets.Where(s => s.Title.Contains(searchString)).ToList(); TicketCount = TicketService.getActiveTicketsCount(); FinishedCount = TicketService.getFinishedTicketsCount(); Count = await TicketService.GetCount(); } else { FinishedCount = TicketService.getFinishedTicketsCount(); TicketCount = TicketService.getActiveTicketsCount(); Count = await TicketService.GetCount(); } }
/// <summary> /// Updates the active tickets. /// </summary> private void UpdateActiveTickets() { activeTickets = new ObservableCollection <ITicket>(); IEnumerable <ITicket> selection; if (specialTicketStrings.Count <= 0) { selection = AllTickets; } else { selection = AllTickets.Where(t => specialTicketStrings.TrueForAll(s => !t.Code.Contains(s))); } foreach (ITicket ticket in selection) { activeTickets.Add(ticket); } }
public ActionResult GetAllTickets(string sortOrder, string currentFilter, string searchString, int?page) { ViewBag.CurrentSort = sortOrder; List <Ticket> AllTickets; if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; switch (sortOrder) { case "OrderByAscending": AllTickets = AdminBusinessLayer.GetAllTickets().OrderBy(a => a.Title).ToList(); break; case "OrderByDescending": AllTickets = AdminBusinessLayer.GetAllTickets().OrderByDescending(a => a.Title).ToList(); break; default: AllTickets = AdminBusinessLayer.GetAllTickets().ToList(); break; } if (!String.IsNullOrEmpty(searchString)) { AllTickets = AllTickets.Where(s => s.Title.Contains(searchString) || s.Description.Contains(searchString)).ToList(); } int pageSize = 5; int pageNumber = (page ?? 1); return(View(AllTickets.ToPagedList(pageNumber, pageSize))); }
public ActionResult GetAllTicketAssignToDeveloper(string sortOrder, string currentFilter, string searchString, int?page) { List <Ticket> AllTickets; ViewBag.CurrentSort = sortOrder; if (searchString != null) { page = 1; } else { searchString = currentFilter; } switch (sortOrder) { case "OrderByAscending": AllTickets = DeveloperBusinessLayer.ticketsAssignToDeveloper(User.Identity.GetUserId()).OrderBy(a => a.Title).ToList(); break; case "OrderByDescending": AllTickets = DeveloperBusinessLayer.ticketsAssignToDeveloper(User.Identity.GetUserId()).OrderByDescending(d => d.Title).ToList(); break; default: AllTickets = DeveloperBusinessLayer.ticketsAssignToDeveloper(User.Identity.GetUserId()); break; } if (!string.IsNullOrEmpty(searchString)) { AllTickets = AllTickets.Where(s => s.Title.Contains(searchString) || s.Description.Contains(searchString)).ToList(); } int pageSize = 5; int pageNumber = (page ?? 1); return(View(AllTickets.ToPagedList(pageNumber, pageSize))); }