public List <CustomerDataObject> RetrieveFromList(List <CustomerDataObject> CustomerList, Retrieve_message Criteria) { try { Criteria = ValidateSearchCriteria(Criteria); List <CustomerDataObject> FilteredList; FilteredList = CustomerList.FindAll(delegate(CustomerDataObject Obj) { return(Obj.CustomerName.Contains(Criteria.Searchvalue) || Obj.Emailid == Criteria.Searchvalue || Obj.Gender.Contains(Criteria.Searchvalue)); }); if (Criteria.End_index > FilteredList.Count) { Criteria.End_index = FilteredList.Count; } FilteredList = FilteredList.GetRange((Criteria.Start_index - 1), Criteria.End_index - Criteria.Start_index + 1); switch (Criteria.Sortparam) { case "Name": FilteredList = FilteredList.OrderBy(cc => cc.CustomerName).ToList <CustomerDataObject>(); break; case "Gender": FilteredList = FilteredList.OrderBy(cc => cc.Gender).ToList <CustomerDataObject>(); break; case "Emailid": FilteredList = FilteredList.OrderBy(cc => cc.Emailid).ToList <CustomerDataObject>(); break; } return(FilteredList); } catch { throw; } }
/// <summary> /// constructor takes server in args /// </summary> /// <param name="Server"></param> public VMBuilding(Network Server) { _Server = Server; _Server.GETUReturn += new EventHandler <serverReturnEventArgs>(r_GETU); _Server.CRDKReturn += new EventHandler <serverReturnEventArgs>(r_CRDK); var url = "cards.json"; this.Collection = new ObservableCollection <Card>(FilteredList.GetRange(0, (int)index_size)); offset = index_size; this.selectedCard = this.Collection.First(); }
/// <summary> /// display more cards /// </summary> public void loadMore() { var number = (int)index_size > FilteredList.Count - (int)offset ? FilteredList.Count - (int)offset : (int)index_size; ObservableCollection <Model.Card> tmp = new ObservableCollection <Card>(FilteredList.GetRange((int)offset, number)); Application.Current.Dispatcher.Invoke(new Action(delegate() { foreach (Model.Card c in tmp) { this.Collection.Add(c); } }), null); offset = offset + (uint)number; }