public async void SortClosingDownCommandExecute() { await ClosePopup(); var tempRecords = _dealList.OrderByDescending(c => c.estimatedClosingDate).ToList();//Descending order DealList.Clear(); foreach (var item in tempRecords) { DealList.Add(item); } IsStopVisible = false; var dealClosingDown = DealList.FirstOrDefault(); MessagingCenter.Send <object, DealsMainModel>(this, "DealsSortClosingDown", dealClosingDown); }
public async void SortDueDateUpCommandExecute() { await ClosePopup(); var tempRecords = _dealList.OrderBy(c => c.decisionDueDate).ToList();//ascending order DealList.Clear(); foreach (var item in tempRecords) { DealList.Add(item); } _isStopVisible = false; var dealDueUp = DealList.FirstOrDefault(); MessagingCenter.Send <object, DealsMainModel>(this, "DealsSortDueUp", dealDueUp); }
public async void SortClearCommandExecute() { await ClosePopup(); var tempRecords = _dealList.OrderBy(c => c.dealId).ToList(); DealList.Clear(); foreach (var item in tempRecords) { DealList.Add(item); } IsStopVisible = false; var dealClear = DealList.FirstOrDefault(); MessagingCenter.Send <object, DealsMainModel>(this, "DealsSortClear", dealClear); }
//public void GetFilterByData() //{ // DealsFilterByItems.Clear(); // //DealList = new ObservableCollection<DealsMainModel>(AllDealListItems); // var statusList = this.StagesList.Select(w => w.stagelabel_10); // StatusPickerList = new ObservableCollection<string>(statusList.Distinct().ToList()); // if (StatusPickerList != null && StatusPickerList.Count > 0) // { // foreach (var item in StatusPickerList) // { // DealsFilterByItems.Add(new DealsSortByModel { name = item, Radiobtnimg = Constants.CheckboxUnselectImg }); // } // } //} private async void ApplayFilterCommandExcecute() { try { FilteredList.Clear(); IsLoadingInfiniteEnabled = true; var IsAnyItemSelected = DealsFilterByItems.Where(x => x.Radiobtnimg == Constants.CheckboxImg).ToList(); if (IsAnyItemSelected.Count > 0 && IsAnyItemSelected != null) { ObservableCollection <DealsMainModel> filterData = new ObservableCollection <DealsMainModel>(); foreach (var item in IsAnyItemSelected) { var data = this.AllDealListItems.Where(w => (w.status.Equals(item.name))).ToList(); filterData = new ObservableCollection <DealsMainModel>(data); foreach (var item1 in filterData) { FilteredList.Add(item1); } filterData.Clear(); } if (FilteredList.Count > 0) { await ClosePopup(); IsListDataAvailable = true; IsDataNotAvailable = false; IsFilterOn = true; DealList.Clear(); DealList = new ObservableCollection <DealsMainModel>(FilteredList.ToList()); var firstMessage = DealList.FirstOrDefault(); MessagingCenter.Send <object, DealsMainModel>(this, "DealsFilterApplied", firstMessage); } else { await ClosePopup(); IsListDataAvailable = false; IsDataNotAvailable = true; IsFilterOn = true; DealList = new ObservableCollection <DealsMainModel>(FilteredList.ToList()); } } else { //If no filter option is selcted clear the filter % await ClosePopup(); if (AllDealListItems.Count > 0) { IsListDataAvailable = false; IsDataNotAvailable = false; IsFilterOn = false; DealList = new ObservableCollection <DealsMainModel>(AllDealListItems); } //await ShowAlert("Alert", "Please select filter option"); } //string status = StatusPicked; //if (!string.IsNullOrEmpty(status)) //{ // var data = this.DealList.Where(w => (w.status.Equals(StatusPicked))).ToList(); // FilteredList = new ObservableCollection<DealsMainModel>(data); // if (FilteredList.Count > 0) // { // IsListDataAvailable = true; // IsDataNotAvailable = false; // DealList.Clear(); // DealList = new ObservableCollection<DealsMainModel>(FilteredList.ToList()); // } // else // { // IsListDataAvailable = false; // IsDataNotAvailable = true; // DealList = new ObservableCollection<DealsMainModel>(AllItems); // } //} //else //{ // await ShowAlert("Alert", "Please select filter option"); //} } catch (Exception ex) { await ClosePopup(); Console.Write(ex.Message); ShowExceptionAlert(ex); } }