public static string GetNameDisciplineBySeanceID(long id) { SportAssoEntities db = new SportAssoEntities(); long dis_id = db.section.Find(id).discipline_id; return(db.discipline.Find(dis_id).label); }
public static string FindFullTitleById(long section_id) { SportAssoEntities db = new SportAssoEntities(); section s = db.section.Find(section_id); discipline d = db.discipline.Find(s.discipline_id); return(d.label + " - " + s.label); }
public static string FindDisciplineNameById(long?id) { if (id.HasValue) { SportAssoEntities db = new SportAssoEntities(); return(db.discipline.Find(id).label); } return("empty"); }
public static string FindUserFullNameById(long?id) { if (id.HasValue) { SportAssoEntities db = new SportAssoEntities(); utilisateur u = db.utilisateur.Find(id); return(u.prenom + ' ' + u.nom); } return("non affecté"); }
public static bool isInscrit(long seance_id, string login) { if (login != null) { SportAssoEntities db = new SportAssoEntities(); long user_id = FindUserByLogin(login).utilisateur_id; return(db.participe.Any(u => u.utilisateur_id == user_id && u.seance_id == seance_id)); } return(false); }
public static bool IsComplet(long seance_id) { long N_participant = GetNumberOfParticipantByID(seance_id); SportAssoEntities db = new SportAssoEntities(); long max = db.seance.Find(seance_id).places_max; if (N_participant < max) { return(false); } return(true); }
public static long GetNumberOfParticipantByID(long seance_id) { SportAssoEntities db = new SportAssoEntities(); var participations = from p in db.participe where p.seance_id == seance_id select p; long cpt = 0; foreach (participe p in participations) { cpt++; } return(cpt); }
public static utilisateur FindUserByLogin(string login) { SportAssoEntities db = new SportAssoEntities(); foreach (utilisateur u in db.utilisateur) { if (u.login == login) { return(u); } } return(new utilisateur()); }
public static long GetIdByUserName(string login) { SportAssoEntities db = new SportAssoEntities(); foreach (utilisateur u in db.utilisateur) { if (u.login == login) { return(u.utilisateur_id); } } return(0); }
public static string GetSeancesInfo(long id) { string res = ""; SportAssoEntities db = new SportAssoEntities(); seance s = db.seance.Find(id); section sec = db.section.Find(s.section_id); discipline d = db.discipline.Find(sec.discipline_id); res = d.label + " - " + sec.label + " : " + s.jour_de_la_semaine + " de " + HourFormator("" + s.heure_debut) + " à " + HourFormator("" + s.heure_fin); return(res); }
public ActionResult Inscription(long id) { SportAssoEntities db = new SportAssoEntities(); ViewBag.seance_id = id; seance s = db.seance.Find(id); section sec = db.section.Find(s.section_id); discipline d = db.discipline.Find(sec.discipline_id); ViewBag.utilisateur_id = GetUserIdByLogin(User.Identity.GetUserName()); ViewBag.a_payer = false; ViewData["titre"] = "Inscription à la section " + sec.label + " de la discipline " + d.label; ViewData["texte"] = "Comfirmez votre inscription à la séance du " + s.jour_de_la_semaine + " de " + HourFormator("" + s.heure_debut) + " à " + HourFormator("" + s.heure_fin); return(View()); }
public static string GetNameSectionByID(long id) { SportAssoEntities db = new SportAssoEntities(); return(db.section.Find(id).label); }