public void ReloadPanel() { pnl_patents.Controls.Clear(); var patents = PatentController.getAll(); // .OrderBy(t => t.id).Reverse() if (btn_orderby_depositDate.Checked) { patents = patents.OrderBy(p => p.deposit_date); // trier par date de dépôt } if (btn_orderby_molecule.Checked) { patents = patents.OrderBy(p => p.molecule_id); // trier par molécule } if (btn_orderby_company.Checked) { patents = patents.OrderBy(p => p.company_id); // trier par entreprise } foreach (var p in patents) { pnl_patents.Controls.Add(new uc_PatentModel { id = p.id, number = p.number, molecule_id = p.molecule_id, company_id = p.company_id, deposit_date = p.deposit_date, duration = p.duration, country = p.country }); } }
private void btn_search_Click(object sender, EventArgs e) { if (tbox_search.Text != "Rechercher...") { pnl_patents.Controls.Clear(); var patents = PatentController.getAll(); patents = patents.Where(m => m.number.Contains(tbox_search.Text) || m.country.Contains(tbox_search.Text)); foreach (var p in patents) { pnl_patents.Controls.Add(new uc_PatentModel { id = p.id, number = p.number, molecule_id = p.molecule_id, company_id = p.company_id, deposit_date = p.deposit_date, duration = p.duration, country = p.country }); } } else { ReloadPanel(); } }
private void cbox_patents_Click(object sender, EventArgs e) { cbox_patents.Items.Clear(); var patents = PatentController.getAll(); foreach (var patent in patents) { cbox_patents.Items.Add(patent.number); } }