public async Task <ActionResult> SelectTrialStudentsByBranchId(SortingEnum sort, int id) { var students = await _studentService.GetTrialStudentsByBranchIdAsync(id, sort); ViewBag.BranchId = id; return(PartialView("_TrialStudents", students)); }
private void ProductListByCategory(int categoryID, SortingEnum DropDown = 0) { Products = ProductRepository.ListByCategory(categoryID); if (DropDown == SortingEnum.MostSold) { Products = (Products.OrderByDescending(x => x.QuantitySold)).ToList(); } else if (DropDown == SortingEnum.HigherPrize) { Products = (Products.OrderByDescending(x => x.Prize)).ToList(); } else if (DropDown == SortingEnum.LowerPrize) { Products = (Products.OrderBy(x => x.Prize)).ToList(); } else if (DropDown == SortingEnum.Last) { Products = (Products.OrderByDescending(x => x.ProductID)).ToList(); } foreach (var item in Products) { item.DiscountAmount = string.Format("{0:0.##}", (item.Prize - ((item.Prize * item.Discount) / 100))); if (item.Description.Length > 77) { item.Description = item.Description.Substring(0, 77); } } }
//private EnumTyp _activeType_enum; public OptionsBuild(EnumTyp typ, SortingEnum sorting, int drawingSize_W, int drawingSize_H) { _activeType = (int)typ; _activeSort = (int)sorting; _drawingSize_H = drawingSize_H; _drawingSize_W = drawingSize_W; }
public async Task <ActionResult> Index(SortingEnum sortState = SortingEnum.LastNameAsc) { StudentViewModel st = SortStudents.Sort(await _studentService.GetAllStudentsByArchive(), sortState); st.branches = await _branchService.GetAllBranch(); return(View(st)); }
public async Task <ActionResult> SelectStudyingStudents(SortingEnum sortState = SortingEnum.LastNameAsc) { var students = await _studentService.SelectStudyingStudentsAsync(sortState); ViewData["Branches"] = await _branchService.GetAllBranch(); return(View(students)); }
public List <Libro> GetLibros(int page, string filter, bool?asc, SortingEnum customFilter, string customFilterValue) { page = page < 1 ? 1 : page; filter ??= "Nombre"; asc = !asc.HasValue; return((List <Libro>)LibroRepository.GetLibros(page, 5, filter, asc.Value, customFilter, customFilterValue)); }
public async Task <IActionResult> List(string value, SortingEnum sortState = SortingEnum.LastNameAsc) { ViewBag.value = value; var students = await _studentService.SearchAsync(value, sortState); return(View(students)); }
public IActionResult Detail(int productID, int familyID, SortingEnum DropDownID = 0) { try { ProductDetailViewModel = new ProductDetailViewModel(productID, familyID, 0, DropDownID); ProductDetailViewModel.Products = ProductDetailViewModel.Products.Where(x => x.DepartmentID == CuponSession.GetDepartmentID(HttpContext.Session)).ToList(); } catch (Exception ex) { ViewData["ErrorMessage"] = ex.Message; } return(View(ProductDetailViewModel)); }
public IEnumerable <Libro> GetLibros(int page, int pageSize, string currentFilter, bool ascOrder, SortingEnum customFilter, string customFilterValue) { IQueryable <Libro> libros = LibroContext.Libro.AsQueryable(); if (currentFilter != null) { libros = QueryHelper.GetQuery(libros, currentFilter, customFilter, customFilterValue, ascOrder); } return(libros.GetPaged <Libro>(page, pageSize).Results.ToList()); }
internal Structs.FollowUpReturn[] FollowUp(SortingEnum sorting) { ArrayList toReturn = new ArrayList(); DatabaseDataset.ClubsRow[] clubs = (DatabaseDataset.ClubsRow[]) database.Clubs.Select("", "Name"); foreach (DatabaseDataset.ClubsRow club in clubs) { toReturn.AddRange(checkClub(club)); } return((Structs.FollowUpReturn[])toReturn.ToArray(typeof(Structs.FollowUpReturn))); }
internal Structs.FollowUpReturn[] FollowUp(SortingEnum sorting) { ArrayList toReturn = new ArrayList(); DatabaseDataset.ClubsRow[] clubs = (DatabaseDataset.ClubsRow[]) database.Clubs.Select("", "Name"); foreach (DatabaseDataset.ClubsRow club in clubs) { toReturn.AddRange(checkClub(club)); } return (Structs.FollowUpReturn[])toReturn.ToArray(typeof(Structs.FollowUpReturn)); }
public List <TShirt> Sort(SortingEnum sortingMethod, List <TShirt> tshirts) { switch ((int)sortingMethod) { case 1: var tshirtsArr = tshirts.ToArray(); QuickSort.QuickSortMain(tshirtsArr, 0, tshirtsArr.Length - 1, true, "price"); var sorted = tshirtsArr.ToList(); return(sorted); case 2: tshirtsArr = tshirts.ToArray(); QuickSort.QuickSortMain(tshirtsArr, 0, tshirtsArr.Length - 1, false, "price"); sorted = tshirtsArr.ToList(); return(sorted); case 3: return(BubbleSort.Ascending(tshirts)); case 4: return(BubbleSort.Descending(tshirts)); case 5: tshirtsArr = tshirts.ToArray(); QuickSort.QuickSortMain(tshirtsArr, 0, tshirtsArr.Length - 1, true, "size"); sorted = tshirtsArr.ToList(); return(sorted); case 6: tshirtsArr = tshirts.ToArray(); QuickSort.QuickSortMain(tshirtsArr, 0, tshirtsArr.Length - 1, false, "size"); sorted = tshirtsArr.ToList(); return(sorted); case 7: return(BucketSort.BucketFabricSort(tshirts, true)); case 8: return(BucketSort.BucketFabricSort(tshirts, false)); case 9: return(BubbleSort.AllAsc(tshirts)); case 10: return(BubbleSort.AllDesc(tshirts)); default: return(tshirts); } }
public async Task <StudentViewModel> SearchAsync( string value, SortingEnum sortState = SortingEnum.LastNameAsc) { var students = await _unitOfWork.Student.GetAllAsync(); if (!string.IsNullOrWhiteSpace(value)) { students = students.Where(x => (x.Name?.ToUpper() ?? string.Empty).Contains(value.ToUpper()) || (x.PhoneNumber?.ToUpper() ?? string.Empty).Contains(value.ToUpper()) || (x.LastName?.ToUpper() ?? string.Empty).Contains(value.ToUpper()) || (x.ParentLastName?.ToUpper() ?? string.Empty).Contains(value.ToUpper())).ToList(); return(SortStudents.Sort(students, sortState)); } return(new StudentViewModel() { Student = new List <Student>() }); }
internal async Task <StudentViewModel> SelectTrialStudentsAsync(SortingEnum sortState = SortingEnum.LastNameAsc) { var students = await _unitOfWork.Student.SelectTrialStudentsAsync(); return(SortStudents.Sort(students, sortState)); }
public async Task <StudentViewModel> GetTrialStudentsByBranchIdAsync(int BranchId, SortingEnum sortState) { var groups = await _unitOfWork.Groups.GetIncludeStudentsByBranchIdAsync(BranchId); var students = new List <Student>(); foreach (var g in groups) { students.AddRange(g.Students); } students = students.Where(x => x.Status == StudentStatusEnum.trial).ToList(); return(SortStudents.Sort(students, sortState)); }
public PagingMailInboxView GetUserMails(int userID, int page, SortingEnum sorting, FilterEnum filter, string filterPhrase) { filterPhrase ??= ""; bool firstPage = (page == 1); var userMails = _context.UserMails .Include(x => x.Mail) .ThenInclude(x => x.Sender) .Where(x => x.UserID == userID).AsQueryable(); switch (filter) { case FilterEnum.FilterTopic: userMails = userMails.Where(x => x.Mail.Topic.StartsWith(filterPhrase)).AsQueryable(); break; case FilterEnum.FilterSenderName: userMails = userMails.Where(x => x.Mail.Sender.FirstName.StartsWith(filterPhrase)).AsQueryable(); break; case FilterEnum.FilterSenderSurname: userMails = userMails.Where(x => x.Mail.Sender.LastName.StartsWith(filterPhrase)).AsQueryable(); break; } switch (sorting) { case SortingEnum.ByDateFromNewest: userMails = userMails.OrderByDescending(x => x.Mail.Date); break; case SortingEnum.ByDateFromOldest: userMails = userMails.OrderBy(x => x.Mail.Date); break; case SortingEnum.BySenderAZ: userMails = userMails.OrderBy(x => x.Mail.Sender.FirstName).ThenBy(x => x.Mail.Sender.LastName).ThenByDescending(x => x.Mail.Date); break; case SortingEnum.BySenderZA: userMails = userMails.OrderByDescending(x => x.Mail.Sender.FirstName).ThenByDescending(x => x.Mail.Sender.LastName).ThenByDescending(x => x.Mail.Date); break; case SortingEnum.ByTopicAZ: userMails = userMails.OrderBy(x => x.Mail.Topic).ThenByDescending(x => x.Mail.Date); break; case SortingEnum.ByTopicZA: userMails = userMails.OrderByDescending(x => x.Mail.Topic).ThenByDescending(x => x.Mail.Date); break; } bool lastPage = (userMails.Count() <= 5 * page); userMails = userMails.Skip((page - 1) * 5).Take(5); List <MailInboxView> mails = new List <MailInboxView>(); foreach (var um in userMails) { MailInboxView miv = new MailInboxView { MailID = um.MailID, Read = um.Read, Sender = new UserGlobalView { Name = um.Mail.Sender.FirstName, Surname = um.Mail.Sender.LastName, Address = um.Mail.Sender.Email }, Topic = um.Mail.Topic, Date = um.Mail.Date, }; mails.Add(miv); } return(new PagingMailInboxView { Mails = mails, FirstPage = firstPage, LastPage = lastPage }); }
public static StudentViewModel Sort(List <Student> students, SortingEnum sortState) { var model = new StudentViewModel { LastNameSortState = sortState == SortingEnum.LastNameAsc ? SortingEnum.LastNameDesc : SortingEnum.LastNameAsc, CreatedDateSortState = sortState == SortingEnum.CreatedDateAsc ? SortingEnum.CreatedDateDesc : SortingEnum.CreatedDateAsc, DateOfBirthdaySortState = sortState == SortingEnum.DateOfBirthdayAsc ? SortingEnum.DateOfBirthdayDesc : SortingEnum.DateOfBirthdayAsc, ParentLastNameSortState = sortState == SortingEnum.ParentLastNameAsc ? SortingEnum.ParentLastNameDesc : SortingEnum.ParentLastNameAsc, PhoneNumberSortState = sortState == SortingEnum.PhoneNumberAsc ? SortingEnum.PhoneNumberDesc : SortingEnum.PhoneNumberAsc, StatusSortState = sortState == SortingEnum.StatusAsc ? SortingEnum.StatusDesc : SortingEnum.StatusAsc, GroupSortState = sortState == SortingEnum.GroupAsc ? SortingEnum.GroupDesc : SortingEnum.GroupAsc, TrialDateSortState = sortState == SortingEnum.TrialDateAsc ? SortingEnum.TrialDateDesc : SortingEnum.TrialDateAsc, LevelSortState = sortState == SortingEnum.LevelAsc ? SortingEnum.LevelDesc : SortingEnum.LevelAsc, CommentSortState = sortState == SortingEnum.CommentAsc ? SortingEnum.CommentDesc : SortingEnum.CommentAsc, ChangeStatusSortState = sortState == SortingEnum.ChangeStatusAsc ? SortingEnum.ChangeStatusDesc : SortingEnum.ChangeStatusAsc }; switch (sortState) { case SortingEnum.LastNameAsc: students = students.OrderBy(s => s.LastName ?? s.Name ?? s.FatherName).ToList(); break; case SortingEnum.LastNameDesc: students = students.OrderByDescending(s => s.LastName ?? s.Name ?? s.FatherName).ToList(); break; case SortingEnum.CreatedDateAsc: students = students.OrderBy(s => s.CreatedDate).ToList(); break; case SortingEnum.CreatedDateDesc: students = students.OrderByDescending(s => s.CreatedDate).ToList(); break; case SortingEnum.DateOfBirthdayAsc: students = students.OrderBy(s => s.DateOfBirthday).ToList(); break; case SortingEnum.DateOfBirthdayDesc: students = students.OrderByDescending(s => s.DateOfBirthday).ToList(); break; case SortingEnum.ParentLastNameAsc: students = students.OrderBy(s => s.ParentLastName).ToList(); break; case SortingEnum.ParentLastNameDesc: students = students.OrderByDescending(s => s.ParentLastName).ToList(); break; case SortingEnum.PhoneNumberAsc: students = students.OrderBy(s => s.PhoneNumber).ToList(); break; case SortingEnum.PhoneNumberDesc: students = students.OrderByDescending(s => s.PhoneNumber).ToList(); break; case SortingEnum.StatusAsc: students = students.OrderBy(s => s.Status).ToList(); break; case SortingEnum.StatusDesc: students = students.OrderByDescending(s => s.Status).ToList(); break; case SortingEnum.GroupAsc: students = students.OrderBy(s => s.Group).ToList(); break; case SortingEnum.GroupDesc: students = students.OrderByDescending(s => s.Group).ToList(); break; case SortingEnum.TrialDateAsc: students = students.OrderBy(s => s.TrialDate).ToList(); break; case SortingEnum.TrialDateDesc: students = students.OrderByDescending(s => s.TrialDate).ToList(); break; case SortingEnum.LevelAsc: students = students.OrderBy(s => s.Level).ToList(); break; case SortingEnum.LevelDesc: students = students.OrderByDescending(s => s.Level).ToList(); break; case SortingEnum.CommentAsc: students = students.OrderBy(s => s.Comments).ToList(); break; case SortingEnum.CommentDesc: students = students.OrderByDescending(s => s.Comments).ToList(); break; case SortingEnum.ChangeStatusAsc: students = students.OrderBy(s => s.ChangeStatusDate).ToList(); break; case SortingEnum.ChangeStatusDesc: students = students.OrderByDescending(s => s.ChangeStatusDate).ToList(); break; } model.Student = students; return(model); }
/// <summary> /// Add parammeters to be ignored for sorting /// </summary> /// <param name="paramValue"></param> /// <returns></returns> public Sorter IgnoreSortFor(SortingEnum paramValue) { ignoreSortFor.Add(paramValue); return this; }
public ObservableCollection <User> FilteredAndSortedUsers(string filterQuery, SortingEnum sortingEnum) { IEnumerable <User> users = GetAllUsers(); if (!string.IsNullOrEmpty(filterQuery)) { users = users.Where(x => x.Name.ToLower().Contains(filterQuery) || x.Surname.ToLower().Contains(filterQuery) || x.ChineseSign.ToLower().GetDescription().Contains(filterQuery) || x.SunSign.GetDescription().ToLower().Contains(filterQuery) || x.Email.ToLower().Contains(filterQuery)); } switch (sortingEnum) { case SortingEnum.Name: users = users.OrderBy(u => u.Name); break; case SortingEnum.Surname: users = users.OrderBy(u => u.Surname); break; case SortingEnum.Email: users = users.OrderBy(u => u.Email); break; case SortingEnum.SunSign: users = users.OrderBy(u => u.SunSign); break; case SortingEnum.ChineseSign: users = users.OrderBy(u => u.ChineseSign); break; default: break; } return(new ObservableCollection <User>(users)); }
public async Task <ActionResult> SelectLeadStudents(SortingEnum sortState = SortingEnum.LastNameAsc) { var students = await _studentService.SelectLeadStudentsAsync(sortState); return(View(students)); }
public ProductDetailViewModel(int productID = 0, int familyID = 0, int categoryID = 0, SortingEnum DropDown = 0) { if (productID > 0) { ProductRead(productID); } if (categoryID > 0) { ProductListByCategory(categoryID, DropDown); } else { ProductList(DropDown); } CategoryList(); FamilyRead(familyID); FamilyList(); }
public OrderBy AddOrder(string order, SortingEnum sortingEnum) { return(new OrderBy(sqlRawBuilder, order, sortingEnum)); }
public OrderBy(SqlRawBuilder sqlRawBuilder, string[] orders, SortingEnum sortingEnum = SortingEnum.Asc) { this.sqlRawBuilder = sqlRawBuilder; this.orders = orders; this.sqlRawBuilder.GetSQL += " ORDER BY " + string.Join(", ", orders) + (sortingEnum == SortingEnum.Desc ? " DESC" : ""); }
public OrderBy(SqlRawBuilder sqlRawBuilder, string order, SortingEnum sortingEnum = SortingEnum.Asc) { this.sqlRawBuilder = sqlRawBuilder; this.order = order; this.sqlRawBuilder.GetSQL += " ORDER BY " + order + (sortingEnum == SortingEnum.Desc ? " DESC" : ""); }
public IActionResult GetMails(int page, SortingEnum sorting, FilterEnum filter, string filterPhrase) { int userID = int.Parse(User.Claims.First(x => x.Type == ClaimTypes.NameIdentifier).Value); return(new JsonResult(_mailService.GetUserMails(userID, page, sorting, filter, filterPhrase))); }
protected virtual string CreateSortLink(SortingEnum orderBy, string title, bool isCurrentPage = false) { var liBulder = new TagBuilder("li"); liBulder.Attributes.Add("id", orderBy.ToString().ToLower()); if (isCurrentPage) liBulder.AddCssClass("active"); var builder = new TagBuilder("a"); builder.SetInnerText(orderBy.ToString()); var actionLink = urlBuilder((int)orderBy); builder.MergeAttribute("href", string.Format("{0}{1}", isHashTag ? "#" : string.Empty, actionLink)); builder.MergeAttribute("title", title); liBulder.InnerHtml = builder.ToString(TagRenderMode.Normal); return liBulder.ToString(TagRenderMode.Normal); }
public DescriptionValueBinder(SortingEnum value, string description) { Value = value; Description = description; }
public FoodPropsComparer(SortingEnum sortparam) { Sortparam = sortparam; }
public static IQueryable <Libro> GetQuery(IQueryable <Libro> libros, string currentFilter, SortingEnum customFilter, string customFilterValue, bool ascOrder) { PropertyInfo prop = typeof(Libro).GetProperty(currentFilter); if (customFilter == SortingEnum.None) { if (ascOrder) { libros = libros.OrderBy(t => EF.Property <string>(t, currentFilter)); } else { libros = libros.OrderByDescending(t => EF.Property <string>(t, currentFilter)); } } else { switch (customFilter) { case SortingEnum.Contains: libros = libros.Where(t => EF.Property <string>(t, currentFilter).ToString().Contains(customFilterValue)); break; case SortingEnum.NotContains: libros = libros.Where(t => !EF.Property <string>(t, currentFilter).ToString().Contains(customFilterValue)); break; case SortingEnum.Equals: libros = libros.Where(t => EF.Property <string>(t, currentFilter).ToString() == customFilterValue); break; case SortingEnum.NotEqual: libros = libros.Where(t => EF.Property <string>(t, currentFilter).ToString() != customFilterValue); break; case SortingEnum.StartsWith: libros = libros.Where(t => EF.Property <string>(t, currentFilter).ToString().StartsWith(customFilterValue)); break; case SortingEnum.EndsWith: libros = libros.Where(t => EF.Property <string>(t, currentFilter).ToString().EndsWith(customFilterValue)); break; } } return(libros); }