Exemple #1
0
 public static FullyObservableCollection <FilterPopupDataModel> SortPopup(FullyObservableCollection <FilterPopupDataModel> coll)
 {
     try
     {
         if (coll?.Count > 0)
         {
             List <FilterPopupDataModel> sorted = coll.OrderBy(x => x.Description).ToList();
             for (int i = 0; i < sorted.Count(); i++)
             {
                 coll.Move(coll.IndexOf(sorted[i]), i);
             }
         }
     }
     catch
     {
     }
     return(coll);
 }
Exemple #2
0
        public static FullyObservableCollection <FilterPopupDataModel> SortSFStagePopup(FullyObservableCollection <FilterPopupDataModel> coll)
        {
            try
            {
                if (coll?.Count > 0)
                {
                    List <FilterPopupDataModel> sorted = coll.OrderBy(x => Convert.ToInt16(x.Description.Remove(x.Description.IndexOf("-")))).ToList();
                    if (sorted == null || sorted.Count == 0)
                    {
                        sorted = coll.OrderBy(x => x.Description).ToList();
                    }

                    for (int i = 0; i < sorted.Count(); i++)
                    {
                        coll.Move(coll.IndexOf(sorted[i]), i);
                    }
                }
            }
            catch
            {
            }
            return(coll);
        }