protected void btnrefuse_Click(object sender, EventArgs e)
 {
     try
     {
         // Ajouté à table accordé
         CongéesRefusé ca = new CongéesRefusé();
         ca.IdCongée   = int.Parse(labelId.Text);
         ca.IdEmploye  = int.Parse(Label2.Text);
         ca.Motif      = lblMotif.Text;
         ca.DateCongé  = Convert.ToDateTime(labelDB.Text).Date;
         ca.NombreJour = a;
         db.CongéesRefusé.InsertOnSubmit(ca);
         db.SubmitChanges();
         // Supprimé  le
         var v = (from x in db.DemandeCongé
                  where x.IdCongée == int.Parse(labelId.Text)
                  select x).FirstOrDefault();
         DemandeCongé d = v;
         db.DemandeCongé.DeleteOnSubmit(d);
         db.SubmitChanges();
     }
     catch (Exception)
     {
         Response.Redirect("PageError_admi.aspx");
     }
     finally
     {
         Response.Redirect("LesDemandesCongé.aspx");
     }
 }
        public void charg()
        {
            var v = (from x in db.DemandeCongé
                     where x.IdCongée == int.Parse(Session["IdCongé"].ToString())
                     select x).FirstOrDefault();
            DemandeCongé d = v;

            lblMotif.Text = d.Motif;
            lblDF.Text    = d.DateFin.ToShortDateString();

            labelDB.Text = d.DateDebut.ToShortDateString();
            TimeSpan Diff = d.DateFin - d.DateDebut;

            a           = ((int)Diff.TotalDays);
            label1.Text = a.ToString() + " Jours";
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                TextBox      Db = (TextBox)GridView1.FooterRow.FindControl("txtDb");
                TextBox      DF = (TextBox)GridView1.FooterRow.FindControl("txtDF");
                DropDownList DP = (DropDownList)GridView1.FooterRow.FindControl("DropDownList1");
                DemandeCongé D  = new DemandeCongé();
                D.DateDebut = Convert.ToDateTime(Db.Text.Trim()).Date;
                D.DateFin   = Convert.ToDateTime(DF.Text.Trim()).Date;
                D.Motif     = DP.Text.Trim();

                D.IdEmploye = Convert.ToInt32(Session["Login"].ToString());
                db.DemandeCongé.InsertOnSubmit(D);
                db.SubmitChanges();
                charg();
            }
            catch (Exception)
            {
                Response.Redirect("PageError.aspx");
            }
        }