private int listeHeure(int p_idEmp)
    {
        int nbHeure = 0;
        List <T_FeuilleDeTemps> hrs = BD_CoEco.GetListeFeuilleDeTemps();

        foreach (T_FeuilleDeTemps fdt in hrs)
        {
            if (fdt.idEmp == p_idEmp)
            {
                if (fdt.idCategorie == 5 || fdt.idCategorie == 6 || fdt.idCategorie == 7 || fdt.idCategorie == 8 || fdt.idCategorie == 9)
                {
                    nbHeure += (int)Utilitaires.GetHeureFDT(fdt.idFeuilleDeTemps);
                }
            }
        }
        return(nbHeure);
    }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["fonction"] == null)
        {
            Response.Redirect("index.aspx");
        }

        HeaderTableau();
        idEmp = int.Parse(Session["idEmp"].ToString());
        T_Employe emp      = BD_CoEco.GetEmpByID(idEmp);
        float     nbHeures = 0;

        float maladie   = 0;
        float feries    = 0;
        float vacances  = 0;
        float hrsAcc    = 0;
        float personnel = 0;

        List <T_FeuilleDeTemps> hrs = BD_CoEco.GetListeFeuilleDeTemps();

        foreach (T_FeuilleDeTemps fdt in hrs)
        {
            if (fdt.idEmp == idEmp)
            {
                if (fdt.idCategorie == 6)
                {
                    maladie += Utilitaires.GetHeureFDT(fdt.idFeuilleDeTemps);
                }
                else if (fdt.idCategorie == 5)
                {
                    feries += Utilitaires.GetHeureFDT(fdt.idFeuilleDeTemps);
                }
                else if (fdt.idCategorie == 9)
                {
                    vacances += Utilitaires.GetHeureFDT(fdt.idFeuilleDeTemps);
                }
                else if (fdt.idCategorie == 8)
                {
                    hrsAcc += Utilitaires.GetHeureFDT(fdt.idFeuilleDeTemps);
                }
                else if (fdt.idCategorie == 7)
                {
                    personnel += Utilitaires.GetHeureFDT(fdt.idFeuilleDeTemps);
                }
            }
        }

        if (emp.congesFeries != null)
        {
            ShowEmp(feries, (float)emp.congesFeries, "Heures congées fériés");
            nbHeures += (float)emp.congesFeries;
        }
        else
        {
            ShowEmp(feries, 0, "Heures congées fériés");
        }
        if (emp.congesMaladie != null)
        {
            ShowEmp(maladie, (float)emp.congesMaladie, "Heures congées maladie");
            nbHeures += (float)emp.congesMaladie;
        }
        else
        {
            ShowEmp(maladie, 0, "Heures congées maladie");
        }
        if (emp.congesPersonnels != null)
        {
            ShowEmp(personnel, (float)emp.congesPersonnels, "Heures congées Personnels");
            nbHeures += (float)emp.congesPersonnels;
        }
        else
        {
            ShowEmp(personnel, 0, "Heures congées Personnels");
        }
        if (emp.heuresAccumuleesOuSansSolde != null)
        {
            ShowEmp(hrsAcc, (float)emp.heuresAccumuleesOuSansSolde, "Heures accumulées ou sans solde");
            nbHeures += (float)emp.heuresAccumuleesOuSansSolde;
        }
        else
        {
            ShowEmp(hrsAcc, 0, "Heures accumulées ou sans solde");
        }
        if (emp.vacances != null)
        {
            ShowEmp(vacances, (float)emp.vacances, "Heures vacances");
            nbHeures += (float)emp.vacances;
        }
        else
        {
            ShowEmp(vacances, 0, "Heures vacances");
        }

        TableRow  tr          = new TableRow();
        TableCell tc_nomConge = new TableCell();

        tc_nomConge.Text = "<strong>Total</strong>";

        TableCell tc_HrsPrises = new TableCell();
        float     HrsAuTotal   = (maladie + feries + vacances + hrsAcc + personnel);

        tc_HrsPrises.Text = "<strong>" + HrsAuTotal.ToString() + "</strong>";


        TableCell tc_HrsTotal = new TableCell();

        tc_HrsTotal.Text = "<strong>" + nbHeures.ToString() + "</strong>";

        TableCell tc_HrsRestantes = new TableCell();

        tc_HrsRestantes.Text = "<strong>" + (nbHeures - HrsAuTotal).ToString() + "</strong>";

        tr.Cells.Add(tc_nomConge);
        tr.Cells.Add(tc_HrsPrises);
        tr.Cells.Add(tc_HrsTotal);
        tr.Cells.Add(tc_HrsRestantes);
        Tableau_BanqueDheures.Rows.Add(tr);
    }
    private void load()
    {
        panel_Contenu.Controls.Clear();

        List <T_Projet> lstPro = BD_CoEco.GetListeProjet();

        foreach (T_Projet projet in lstPro)
        {
            int nbCatCount = 0;
            if (BD_CoEco.GetFDTByProject(projet.idProjet).Count != 0)
            {
                Panel pnl_projet = new Panel();
                panel_Contenu.Controls.Add(pnl_projet);

                Label lbl_projet = new Label();
                lbl_projet.Text = "<h3>" + projet.nom + "</h3>";
                pnl_projet.Controls.Add(lbl_projet);

                List <T_CategoriePro> lstCat = BD_CoEco.GetListeCategorie(projet);
                foreach (T_CategoriePro categorie in lstCat)
                {
                    Panel pnl_categorie = new Panel();
                    pnl_projet.Controls.Add(pnl_categorie);

                    Label lbl_categorie = new Label();
                    lbl_categorie.Text = "<h5>" + categorie.descript + "</h5>";
                    pnl_categorie.Controls.Add(lbl_categorie);

                    Table tb = new Table();
                    tb.CssClass = "table";
                    TableHeaderRow  thr     = new TableHeaderRow();
                    TableHeaderCell thc_emp = new TableHeaderCell();
                    thc_emp.Width = new Unit("33%");
                    thc_emp.Text  = "Employé";
                    thr.Cells.Add(thc_emp);
                    TableHeaderCell thc_heures = new TableHeaderCell();
                    thc_heures.Text  = "Heures";
                    thc_heures.Width = new Unit("33%");
                    thr.Cells.Add(thc_heures);
                    TableHeaderCell thc_app = new TableHeaderCell();
                    thc_app.Text = "Approuver";
                    thr.Cells.Add(thc_app);
                    thc_app.Width = new Unit("33%");
                    tb.Rows.Add(thr);
                    pnl_categorie.Controls.Add(tb);

                    List <T_FeuilleDeTemps> lstFdt = BD_CoEco.GetFDTByProject(projet.idProjet);

                    int   fdtCount  = 0;
                    float heuresTot = 0;
                    foreach (T_FeuilleDeTemps feuilleDeTemps in lstFdt)
                    {
                        int annee   = int.Parse(tbx_Semaine.Text.Split('-')[0]);
                        int semaine = int.Parse(tbx_Semaine.Text.Split('-')[1].Remove(0, 1));
                        if (feuilleDeTemps.idCategorie == categorie.idCategorie && semaine == Utilitaires.GetWeek((DateTime)feuilleDeTemps.semaine) && annee == feuilleDeTemps.semaine.Value.Year)
                        {
                            fdtCount++;
                            nbCatCount++;
                            Panel panel_fdt = new Panel();
                            pnl_categorie.Controls.Add(panel_fdt);

                            T_Employe emp = BD_CoEco.GetEmpByID(feuilleDeTemps.idEmp);

                            Table tab = new Table();
                            tab.CssClass = "table";
                            TableRow tr = new TableRow();

                            //Partie pour les noms
                            TableCell tc_nom = new TableCell();
                            tc_nom.Width = new Unit("33%");
                            HyperLink hl = new HyperLink();
                            hl.Text        = emp.prenom + " " + emp.nom;
                            hl.NavigateUrl = "FDT_ConsultationAdm.aspx?idFDT=" + feuilleDeTemps.idFeuilleDeTemps.ToString();
                            tc_nom.Controls.Add(hl);
                            tr.Cells.Add(tc_nom);



                            TableCell tc_FDT = new TableCell();
                            tc_FDT.Width = new Unit("33%");
                            tc_FDT.Text  = Utilitaires.GetHeureFDT(feuilleDeTemps.idFeuilleDeTemps).ToString();
                            tr.Cells.Add(tc_FDT);

                            heuresTot += Utilitaires.GetHeureFDT(feuilleDeTemps.idFeuilleDeTemps);

                            TableCell tc_app = new TableCell();
                            tc_app.Width = new Unit("33%");
                            CheckBox cbx_app = new CheckBox();
                            cbx_app.AutoPostBack    = true;
                            cbx_app.ID              = "cbx_App-" + feuilleDeTemps.idFeuilleDeTemps;
                            cbx_app.Checked         = (bool)feuilleDeTemps.approbation;
                            cbx_app.CheckedChanged += cbx_pressed;
                            tc_app.Controls.Add(cbx_app);
                            tr.Cells.Add(tc_app);


                            tab.Rows.Add(tr);
                            panel_fdt.Controls.Add(tab);
                        }
                    }

                    if (fdtCount == 0)
                    {
                        pnl_projet.Controls.Remove(pnl_categorie);
                    }
                    else
                    {
                        //Ajouter total
                        Table tb_footer = new Table();
                        tb_footer.CssClass = "table";
                        TableFooterRow tfr      = new TableFooterRow();
                        TableCell      tc_titre = new TableCell();
                        tc_titre.Width = new Unit("33%");
                        tc_titre.Text  = "<strong>Total</strong>";
                        tfr.Cells.Add(tc_titre);
                        TableCell tc_total = new TableCell();
                        tc_total.Width      = new Unit("33%");
                        tc_total.ColumnSpan = 2;
                        tc_total.Text       = "<strong>" + heuresTot.ToString() + "</strong>";
                        tfr.Cells.Add(tc_total);
                        TableCell tc_vide = new TableCell();
                        tc_vide.Width = new Unit("33%");
                        tc_vide.Text  = "";
                        tfr.Cells.Add(tc_vide);
                        tb_footer.Rows.Add(tfr);
                        pnl_categorie.Controls.Add(tb_footer);
                    }
                }
                if (nbCatCount == 0)
                {
                    panel_Contenu.Controls.Remove(pnl_projet);
                }
            }
        }
    }