Esempio n. 1
0
    protected void btn_ajouter_Click(object sender, EventArgs e)
    {
        T_FeuilleDeTemps fdt = new T_FeuilleDeTemps();


        fdt.idCategorie = int.Parse(ddl_Categorie.SelectedValue);



        fdt.idEmp = int.Parse(Session["idEmp"].ToString());



        DateTime date;

        date = DateTime.Parse(Request.QueryString["date"]);
        //date = getFirstDayOfWeek(Calendar1.SelectedDate);

        fdt.semaine = date;


        if (tb_dimanche.Text != "")
        {
            fdt.dimanche = float.Parse(tb_dimanche.Text);
        }
        else
        {
            fdt.dimanche = null;
        }
        string lun = tb_lundi.Text;

        if (lun != "")
        {
            fdt.lundi = float.Parse(lun);
        }
        else
        {
            fdt.lundi = null;
        }
        string mar = tb_mardi.Text;

        if (mar != "")
        {
            fdt.mardi = float.Parse(mar);
        }
        else
        {
            fdt.mardi = null;
        }
        string mer = tb_mercredi.Text;

        if (mer != "")
        {
            fdt.mercredi = float.Parse(mer);
        }
        else
        {
            fdt.mercredi = null;
        }
        string jeu = tb_jeudi.Text;

        if (jeu != "")
        {
            fdt.jeudi = float.Parse(jeu);
        }
        else
        {
            fdt.jeudi = null;
        }
        string ven = tb_vendredi.Text;

        if (ven != "")
        {
            fdt.vendredi = float.Parse(ven);
        }
        else
        {
            fdt.vendredi = null;
        }
        string sam = tb_samedi.Text;

        if (sam != "")
        {
            fdt.samedi = float.Parse(sam);
        }
        else
        {
            fdt.samedi = null;
        }
        //-----------COM
        if (tb_dimancheCommentaire.Text != "")
        {
            fdt.commentaireDimanche = tb_dimancheCommentaire.Text;
        }
        else
        {
            fdt.commentaireDimanche = null;
        }
        if (tb_lundiCommentaire.Text != "")
        {
            fdt.commentaireLundi = tb_lundiCommentaire.Text;
        }
        else
        {
            fdt.commentaireLundi = null;
        }
        if (tb_mardiCommentaire.Text != "")
        {
            fdt.commentaireMardi = tb_mardiCommentaire.Text;
        }
        else
        {
            fdt.commentaireMardi = null;
        }
        if (tb_mercrediCommentaire.Text != "")
        {
            fdt.commentaireMercredi = tb_mercrediCommentaire.Text;
        }
        else
        {
            fdt.commentaireMercredi = null;
        }
        if (tb_jeudiCommentaire.Text != "")
        {
            fdt.commentaireJeudi = tb_jeudiCommentaire.Text;
        }
        else
        {
            fdt.commentaireJeudi = null;
        }
        if (tb_vendrediCommentaire.Text != "")
        {
            fdt.commentaireVendredi = tb_vendrediCommentaire.Text;
        }
        else
        {
            fdt.commentaireVendredi = null;
        }
        if (tb_samediCommentaire.Text != "")
        {
            fdt.commentaireSamedi = tb_samediCommentaire.Text;
        }
        else
        {
            fdt.commentaireSamedi = null;
        }

        fdt.approbation = false;

        //Modif
        if (idFdt != -1)
        {
            fdt.idFeuilleDeTemps = idFdt;
            BD_CoEco.UpdateFeuilleDeTemps(fdt);
        }
        //Ajout
        else
        {
            BD_CoEco.CreateNewFeuilleDeTemps(fdt);
        }

        Response.Redirect("FeuilleDeTemps.aspx");
    }