Beispiel #1
0
        private void LoadCustomers(string searchKeyword = null)
        {
            var customers = _customerBUS.GetAllCustomers();

            if (customers != null)
            {
                if (!string.IsNullOrWhiteSpace(searchKeyword))
                {
                    customers             = customers.Where(c => c.Name.Contains(searchKeyword) || c.Code.Contains(searchKeyword) || c.City.Contains(searchKeyword)).ToList();
                    lblCustomerCount.Text = string.Format("{0} Customers found matching to your search {1}", customers.Count(), searchKeyword);

                    if (customers.Count() > 0)
                    {
                        lblCustomerCount.ForeColor = Color.Black;
                    }
                    else
                    {
                        lblCustomerCount.ForeColor = Color.Red;
                    }
                }
                else
                {
                    lblCustomerCount.Text = string.Format("Total Customers: {0}", customers.Count());
                    if (customers.Count() < 1)
                    {
                        lblCustomerCount.ForeColor = Color.Red;
                    }
                }
                dgvCustomersList.DataSource = customers;
                dgvCustomersList.Columns.Add(CreateDetailLinkColumn());
            }
            else
            {
                lblCustomerCount.ForeColor = Color.Red;
                lblCustomerCount.Text      = "No Customer Found";
            }
        }