Exemple #1
0
    protected void btn_connexion_Click(object sender, EventArgs e)
    {
        T_Connexion co = CoBD.GetConnexionByUserName(tbx_username.Text, tbx_password.Text);

        if (co != null)
        {
            ajouterSession(co);
            Response.Redirect("Acceuil.aspx");
        }
    }
Exemple #2
0
 protected void btn_appliquer_Click(object sender, EventArgs e)
 {
     if (tbx_litre.Text != "" && tbx_nbKilo.Text != "" && tbx_cout.Text != "" && tbx_calender.Text != null)
     {
         T_FactureGaz newfac = new T_FactureGaz();
         newfac.nbKilo = float.Parse(tbx_nbKilo.Text);
         newfac.litre  = float.Parse(tbx_litre.Text);
         newfac.cout   = decimal.Parse(tbx_cout.Text);
         newfac.ddate  = DateTime.Parse(tbx_calender.Text);
         newfac.idCo   = int.Parse(Session["idCo"].ToString());
         CoBD.AjouterGaz(newfac);
         Response.Redirect("Acceuil.aspx");
     }
 }
Exemple #3
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);
        }
    }
Exemple #4
0
 private void btnSupp_OnClick(Object sender, EventArgs e)
 {
     CoBD.DeleteFactureById(int.Parse(((LinkButton)sender).ID.Split('-')[1]));
     loadListeFactures();
 }