Exemplo n.º 1
0
    /// <summary>
    /// Méthode permettant d'obtenir les catégories pour un projet en particulié
    /// </summary>
    /// <param name="p_projet">Projet dont on veut savoir les catégories</param>
    /// <returns>La liste des catégories associés au projet</returns>
    public static List <T_CategoriePro> GetListeCategorie(T_Projet p_projet = null)
    {
        CoEco_BDDataContext    BD             = new CoEco_BDDataContext();
        Table <T_CategoriePro> tableCategorie = BD.T_CategoriePro;
        List <T_CategoriePro>  listeCategorie = tableCategorie.ToList();
        List <T_CategoriePro>  rtnLst         = new List <T_CategoriePro>();

        if (p_projet != null)
        {
            foreach (T_CategoriePro cat in listeCategorie)
            {
                if (cat.idProjet == p_projet.idProjet)
                {
                    rtnLst.Add(cat);
                }
            }
        }
        else
        {
            rtnLst = listeCategorie;
        }

        BD.Dispose();
        return(rtnLst);
    }
Exemplo n.º 2
0
    /// <summary>
    /// Méthode permettant obtenir la liste des nouveaux projets.
    /// </summary>
    /// <param name="p_Inactif">Si ce flag est mit à True, retourne seulement les projets actifs</param>
    /// <returns></returns>
    public static List <T_Projet> GetListeNewProjet()
    {
        DateTime today = DateTime.Now;

        CoEco_BDDataContext BD          = new CoEco_BDDataContext();
        Table <T_Projet>    tableProjet = BD.T_Projet;

        List <T_Projet> listeProjet = tableProjet.ToList();
        List <T_Projet> rtnList     = listeProjet;

        rtnList = new List <T_Projet>();

        foreach (T_Projet pro in listeProjet)
        {
            if (pro.idStatus == 1)
            {
                if (pro.dateDebut >= today.AddDays(-30))
                {
                    rtnList.Add(pro);
                }
            }
        }
        BD.Dispose();
        return(rtnList);
    }
Exemplo n.º 3
0
    /// <summary>
    /// Méthode obtenant tous les employés
    /// </summary>
    /// <param name="p_Actifs">Si ce flag est actif, retourne seulement les employés actifs</param>
    /// <returns></returns>
    public static List <T_Employe> GetListeEmploye(bool p_Actifs = false)
    {
        CoEco_BDDataContext BD       = new CoEco_BDDataContext();
        Table <T_Employe>   tableEmp = BD.T_Employe;
        List <T_Employe>    listeEmp = tableEmp.ToList();
        List <T_Employe>    rtnList  = listeEmp;
        //Enlever les admins
        List <T_Employe> listeFiltre = new List <T_Employe>();

        for (int i = 0; i < listeEmp.Count; i++)
        {
            if (listeEmp[i].idFonction != 3)
            {
                listeFiltre.Add(listeEmp[i]);
            }
        }
        listeEmp = listeFiltre;

        if (p_Actifs)
        {
            rtnList = new List <T_Employe>();
            foreach (T_Employe emp in listeEmp)
            {
                if (emp.idStatus == 1)
                {
                    rtnList.Add(emp);
                }
            }
        }
        BD.Dispose();

        return(rtnList);
    }
Exemplo n.º 4
0
    protected void btn_apply_Click(object sender, EventArgs e)
    {
        //connexion à la BD
        CoEco_BDDataContext    BD       = new CoEco_BDDataContext();
        Table <T_CategoriePro> tableEmp = BD.T_CategoriePro;

        T_CategoriePro newCat = new T_CategoriePro();

        newCat.descript = tbx_cat.Text;

        if (ddl_statut.SelectedValue == "Actif")
        {
            newCat.idStatusCat = 1;
        }
        else
        {
            newCat.idStatusCat = 2;
        }

        newCat.idProjet = int.Parse(ddl_projet.SelectedValue);

        BD_CoEco.CreateNewCategorie(newCat);

        tbx_cat.Visible    = false;
        btn_addCat.Enabled = true;
        loadCat();
    }