private void ShowClients(bool genre) { if (fpnClients.Controls.Count > 0) { fpnClients.Controls.Clear(); } List <Client> c; if (genre == true) { c = new ClientBLL().RetrieveByGenre(1); } else { c = new ClientBLL().RetrieveByGenre(2); } ClientsPanel[] clients = new ClientsPanel[c.Count]; for (int i = 0; i < clients.Length; i++) { clients[i] = new ClientsPanel(table.Size.Width, table.Size.Height) { ID = c[i].ID, FirstName = c[i].FirstName, LastName = c[i].LastName, UserName = c[i].UserName, Password = c[i].Password, Gender = c[i].Gender.Name, Birthday = c[i].Birthday.ToString("dd-MM-yyyy") }; fpnClients.Controls.Add(clients[i]); } }
private void ShowClients(string filter) { if (fpnClients.Controls.Count > 0) { fpnClients.Controls.Clear(); } var all = new ClientBLL().RetrieveALL(); List <Client> c = new List <Client>(); foreach (var item in all) { if (System.Text.RegularExpressions.Regex.IsMatch(item.UserName, filter)) { c.Add(item); } } all = c; ClientsPanel[] clients = new ClientsPanel[c.Count]; for (int i = 0; i < clients.Length; i++) { clients[i] = new ClientsPanel(table.Size.Width, table.Size.Height) { ID = all[i].ID, FirstName = all[i].FirstName, LastName = all[i].LastName, UserName = all[i].UserName, Password = all[i].Password, Gender = all[i].Gender.Name, Birthday = all[i].Birthday.ToString("dd-MM-yyyy") }; fpnClients.Controls.Add(clients[i]); } }