private void FinishSearch() { if (String.IsNullOrEmpty(ClientNumber) == false) { HistoryModels = new BindableCollection <HistoryModel>(HistoryModels.ToList().Where(x => x.Client.PhoneNumber.Contains(ClientNumber))); } if (String.IsNullOrEmpty(ClientName) == false) { HistoryModels = new BindableCollection <HistoryModel>(HistoryModels.ToList().Where(x => x.Client.Name.Contains(ClientName))); } if (String.IsNullOrEmpty(ClientSurname) == false) { HistoryModels = new BindableCollection <HistoryModel>(HistoryModels.ToList().Where(x => x.Client.Surname.Contains(ClientSurname))); } if (String.IsNullOrEmpty(ProductFactoryNumber) == false) { HistoryModels = new BindableCollection <HistoryModel>(HistoryModels.ToList().Where(x => x.FactoryNumber.Contains(ProductFactoryNumber))); } if (String.IsNullOrEmpty(ProductName) == false) { HistoryModels = new BindableCollection <HistoryModel>(HistoryModels.ToList().Where(x => x.Name.Contains(ProductName))); } if (String.IsNullOrEmpty(ProductSet) == false) { HistoryModels = new BindableCollection <HistoryModel>(HistoryModels.ToList().Where(x => x.Set.Contains(ProductSet))); } isOpenPopup = false; EmptySearchParameters(); if (HistoryModels.Count == 0) { RefreshView(); MessageBox.Show("Жодного результату за вашим пошуком"); } }
private void CountSums() { SumOfEarnings = 0; SumOfNetPrices = 0; SumOfSellPrices = 0; HistoryModels.ToList().ForEach(x => SumOfSellPrices += x.ProductSellPrice * x.ProductQuantity); HistoryModels.ToList().ForEach(x => SumOfNetPrices += x.ProductNetPrice * x.ProductQuantity); SumOfEarnings = SumOfSellPrices - SumOfNetPrices; }