/// <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); }
public static List <T_Employe> GetEmpByProject(T_Projet p_projet) { CoEco_BDDataContext bd = new CoEco_BDDataContext(); Table <T_EmployeProjet> tableEmpPro = bd.T_EmployeProjet; List <T_EmployeProjet> listEmpPro = tableEmpPro.ToList(); //Tous les liens entre employés et projets List <T_EmployeProjet> resultRech = new List <T_EmployeProjet>(); //Liste de retour foreach (T_EmployeProjet employeProjet in listEmpPro) { if (employeProjet.idPro == p_projet.idProjet) //S'il est dans la liste { resultRech.Add(employeProjet); } } List <T_Employe> listEmp = GetListeEmploye(true); List <T_Employe> rtnList = new List <T_Employe>(); foreach (T_EmployeProjet employeProjet in resultRech) { foreach (T_Employe employe in listEmp) { if (employeProjet.idEmp == employe.idEmploye) { rtnList.Add(employe); } } } bd.Dispose(); return(rtnList); }
protected void btn_apply_Click(object sender, EventArgs e) { T_Projet monProjet = new T_Projet(); monProjet.idProjet = int.Parse(Request.QueryString["id"]); monProjet.nom = tbx_nom.Text; if (tbx_projet.Text != "") { monProjet.descript = tbx_projet.Text; } if (tbx_heure.Text != "") { monProjet.heureAlloue = float.Parse(tbx_heure.Text); } monProjet.idStatus = int.Parse(ddl_statut.SelectedValue); if (ddl_responsable.SelectedValue != "-1") { monProjet.responsable = int.Parse(ddl_responsable.SelectedValue); } if (dateDebut.Text != "") { monProjet.dateDebut = DateTime.Parse(dateDebut.Text.ToString()); } if (dateFin.Text != "") { monProjet.dateFin = DateTime.Parse(dateFin.Text.ToString()); } BD_CoEco.UpdateProjet(monProjet); ajouterEmpLie(); Response.Redirect("Projet.aspx"); }
private void loadCheckBoxList() { T_Projet proActu = BD_CoEco.GetProByID(int.Parse(ddl_Projets.SelectedValue)); cbl_Employe.Items.Clear(); List <T_Employe> listEmp = BD_CoEco.GetEmpByProject(proActu); listEmp = listEmp.OrderBy(o => o.prenom).ThenBy(o => o.nom).ToList(); foreach (T_Employe employe in listEmp) { cbl_Employe.Items.Add(new ListItem(employe.prenom + " " + employe.nom, employe.idEmploye.ToString())); } }
public static float banqueHeuresProj(T_Projet proj) { float banqueHeure = 0; List <T_CategoriePro> listCat = GetListeCategorie(proj); List <T_FeuilleDeTemps> listeFdt = GetListeFeuilleDeTemps(); foreach (T_FeuilleDeTemps fdt in listeFdt) { foreach (T_CategoriePro cat in listCat) { if (cat.idCategorie == fdt.idCategorie) { if (fdt.dimanche != null) { banqueHeure += (float)fdt.dimanche; } if (fdt.lundi != null) { banqueHeure += (float)fdt.lundi; } if (fdt.mardi != null) { banqueHeure += (float)fdt.mardi; } if (fdt.mercredi != null) { banqueHeure += (float)fdt.mercredi; } if (fdt.jeudi != null) { banqueHeure += (float)fdt.jeudi; } if (fdt.vendredi != null) { banqueHeure += (float)fdt.vendredi; } if (fdt.samedi != null) { banqueHeure += (float)fdt.samedi; } } } } return(banqueHeure); }
public static void UpdateProjet(T_Projet p_projet) { CoEco_BDDataContext BD = new CoEco_BDDataContext(); T_Projet newProjet = BD.T_Projet.Single(p => p.idProjet == p_projet.idProjet); newProjet.nom = p_projet.nom; newProjet.idStatus = p_projet.idStatus; newProjet.heureAlloue = p_projet.heureAlloue; newProjet.responsable = p_projet.responsable; newProjet.descript = p_projet.descript; newProjet.dateDebut = p_projet.dateDebut; newProjet.dateFin = p_projet.dateFin; BD.SubmitChanges(); BD.Dispose(); }
public static void CreateNewProjet(T_Projet p_projet) { CoEco_BDDataContext BD = new CoEco_BDDataContext(); int?maxID = 0; BD.PS_GetMaxIdProjet(ref maxID); maxID++; if (maxID == null) { maxID = 1; } p_projet.idProjet = (int)maxID; BD.T_Projet.InsertOnSubmit(p_projet); BD.SubmitChanges(); BD.Dispose(); }
protected void btn_addProject_Click(object sender, EventArgs e) { T_Projet monProjet = new T_Projet(); List <T_Employe> listeEmpAuProjet = new List <T_Employe>(); monProjet.nom = tbx_nom.Text; if (tbx_projet.Text != "") { monProjet.descript = tbx_projet.Text; } monProjet.responsable = int.Parse(ddl_responsable.SelectedValue); if (tbx_heure.Text != "") { monProjet.heureAlloue = int.Parse(tbx_heure.Text); } if (dateDebut.Text != "") { monProjet.dateDebut = DateTime.Parse(dateDebut.Text.ToString()); } if (dateFin.Text != "") { monProjet.dateFin = DateTime.Parse(dateFin.Text.ToString()); } monProjet.idStatus = int.Parse(ddl_statut.SelectedValue); BD_CoEco.CreateNewProjet(monProjet); for (int i = 0; i < lst_employeAjouter.Items.Count; i++) { T_Employe emp = BD_CoEco.GetEmpByID(int.Parse(lst_employeAjouter.Items[i].Value)); listeEmpAuProjet.Add(emp); } for (int i = 0; i < listeEmpAuProjet.Count; i++) { T_EmployeProjet empPro = new T_EmployeProjet(); empPro.idEmp = listeEmpAuProjet[i].idEmploye; empPro.idPro = (int)BD_CoEco.getNewIdProject() - 1; BD_CoEco.CreateNewEmpAtProject(empPro); } Response.Redirect("Projet.aspx"); }
private void showResult(int id_Pro) { T_Projet projet = BD_CoEco.GetProByID(id_Pro); TableRow tr = new TableRow(); TableCell cNom = new TableCell(); //cNom.Text = projet.nom; HyperLink hl = new HyperLink(); hl.Text = projet.nom; hl.NavigateUrl = "AjouterProjet.aspx?id=" + projet.idProjet.ToString(); cNom.Controls.Add(hl); TableCell cChef = new TableCell(); if (projet.responsable == null || projet.responsable == 0) { cChef.Text = " - "; } else { if (projet.responsable != -1) { T_Employe responsable = BD_CoEco.GetEmpByID((int)projet.responsable); cChef.Text = responsable.prenom + " " + responsable.nom; } else { cChef.Text = "-"; } } //tc4.Text = listeStatProjet[p_projet.idStatus - 1].descript; TableCell cStatut = new TableCell(); cStatut.Text = BD_CoEco.GetListeStatusProjet()[projet.idStatus - 1].descript; tr.Cells.Add(cNom); tr.Cells.Add(cChef); tr.Cells.Add(cStatut); Tableau_Projets.Rows.Add(tr); }
public static List <T_FeuilleDeTemps> GetFDTByProject(int idPro) { CoEco_BDDataContext bd = new CoEco_BDDataContext(); T_Projet projet = bd.T_Projet.Single(f => f.idProjet == idPro); List <T_CategoriePro> lstCategories = GetListeCategorie(projet); List <T_FeuilleDeTemps> lstFDT = GetListeFeuilleDeTemps(); List <T_FeuilleDeTemps> rtnList = new List <T_FeuilleDeTemps>(); foreach (T_CategoriePro cat in lstCategories) { foreach (T_FeuilleDeTemps fdt in lstFDT) { if (fdt.idCategorie == cat.idCategorie) { rtnList.Add(fdt); } } } return(rtnList); }
private void ajouterEmpLie() { List <T_Employe> listeEmpAuProjet = new List <T_Employe>(); T_Projet monProjet = new T_Projet(); monProjet.idProjet = int.Parse(Request.QueryString["id"]); List <T_Employe> listEmpPro = BD_CoEco.GetEmpByProject(monProjet); List <int> listId = new List <int>(); foreach (T_Employe EmpPro in listEmpPro) { listId.Add(EmpPro.idEmploye); } for (int i = 0; i < lst_employeAjouter2.Items.Count; i++) { if (listId.Count > i) { if (listId[i] != int.Parse(lst_employeAjouter2.Items[i].Value)) { T_Employe emp = BD_CoEco.GetEmpByID(int.Parse(lst_employeAjouter2.Items[i].Value)); listeEmpAuProjet.Add(emp); } } else { T_Employe emp = BD_CoEco.GetEmpByID(int.Parse(lst_employeAjouter2.Items[i].Value)); listeEmpAuProjet.Add(emp); } } for (int i = 0; i < listeEmpAuProjet.Count; i++) { T_EmployeProjet empPro = new T_EmployeProjet(); empPro.idEmp = listeEmpAuProjet[i].idEmploye; empPro.idPro = monProjet.idProjet; BD_CoEco.CreateNewEmpAtProject(empPro); } }