Example #1
0
    private void loadListeFactures()
    {
        tab_data.Rows.Clear();
        List <T_FactureGaz> listFac = CoBD.GetListFacGaz();
        //Titres du tableau
        TableHeaderRow  thr      = new TableHeaderRow();
        TableHeaderCell thc_Date = new TableHeaderCell();

        thc_Date.Text = "Date";
        thr.Cells.Add(thc_Date);
        TableHeaderCell thc_autonomie = new TableHeaderCell();

        thc_autonomie.Text = "L / 100";
        thr.Cells.Add(thc_autonomie);
        TableHeaderCell thc_supprimer = new TableHeaderCell();

        thc_supprimer.Text = "Supprimer";
        thr.Cells.Add(thc_supprimer);
        tab_data.Rows.Add(thr);

        foreach (T_FactureGaz t_Facture in listFac)
        {
            TableRow  tr      = new TableRow();
            TableCell tc_date = new TableCell();
            tc_date.Text = string.Format("{0:d}", t_Facture.ddate);
            tr.Cells.Add(tc_date);
            TableCell tc_autonomie = new TableCell();
            tc_autonomie.Text = string.Format("{0:0.00}", Utilitaires.GetAutonomie((float)t_Facture.nbKilo, (float)t_Facture.litre));
            tr.Cells.Add(tc_autonomie);
            TableCell  tc_supprimer = new TableCell();
            LinkButton btn_supp     = new LinkButton();
            btn_supp.ID       = "btn_supp-" + t_Facture.idFac;
            btn_supp.CssClass = "far fa-times-circle";
            btn_supp.Click   += btnSupp_OnClick;
            tc_supprimer.Controls.Add(btn_supp);
            tr.Cells.Add(tc_supprimer);
            tab_data.Rows.Add(tr);
        }
    }