public void Search(Customer item) { try { getBusiness = new CustomerBusinessLayer(); List <Customer> _searchData = new List <Customer>(); _searchData = getBusiness.Search(item); List <Customer> passData = new List <Customer>(); List <Customer> activeData = new List <Customer>(); foreach (var data in _searchData) { if (data.PassPaymentDate > DateTime.Now) { activeData.Add(data); } if (data.PassPaymentDate < DateTime.Now) { passData.Add(data); } } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }