public ActionResult Register(MembreModel mm) { mm.Pays += 1; if (ModelState.IsValid) { if (uow.CreateUser(mm)) { SessionUtils.IsLogged = true; SessionUtils.ConnectedUser = mm; //return RedirectToAction("Index", "Home", new { area = "Membre" }); return(RedirectToAction("Index", "Home")); } else { ViewBag.Error = "Erreur Login/Password"; return(View("Register")); } } else { ViewBag.Error = "Erreur Login/Password"; return(View("Register")); } }
private void SupprimerMembre(object obj) { MembreModel m = obj as MembreModel; MembreService.SupprimerMembre(club, m); membres.Remove(m); }
/// <summary> /// Retourne les cotisation que le membre doit payer à son inscription /// </summary> public static double CalculCotisation(MembreModel m) { double cotisation = 0; if (EstMajeur(m)) { if (m.Ville != "Paris") { cotisation = 280; } else { cotisation = 200; } } else { if (m.Ville != "Paris") { cotisation = 180; } else { cotisation = 130; } } if (m.Competition) { cotisation += 20; } return(cotisation); }
public ActionResult Login(LoginModel lm) { UnitOfWork uow = new UnitOfWork(ConfigurationManager.ConnectionStrings["Cnstr"].ConnectionString); if (ModelState.IsValid) { MembreModel mm = uow.MembreAuth(lm); if (mm == null) { ViewBag.Error = "Erreur de Login ou Password"; return(View()); } else { SessionUtils.IsLogged = true; SessionUtils.ConnectedUser = mm; return(RedirectToAction("Index", "Home", new { area = "Membre" })); } } else { ViewBag.Error = "Erreur de Login ou Password"; return(View()); } }
public AjouterMembreModelView(ClubModel club) { Membre = new MembreModel(); this.club = club; AjouterMembreCommand = new SimpleCommand(AjouterMembre); }
public ModifierMembreModelView(ClubModel club, MembreModel membre) { this.club = club; M = membre; ModifierMembreCommand = new SimpleCommand(ModifierMembre); }
public ActionResult EditPhoto(MembreModel mm, HttpPostedFileBase FilePhoto) { // 1. Check the image size > 0 and < 200Mb if (FilePhoto.ContentLength > 0 && FilePhoto.ContentLength < 20000) { //2. Check the image type string extension = Path.GetExtension(FilePhoto.FileName); if (validImageType.Contains(extension)) { //3. Check if the destination folder exist //C:\WorkSpace_Thao\HomeshareASP\HomeshareASP\images\Membres\{IdMembre} string destFolder = Path.Combine(Server.MapPath("~/images/Membres"), SessionUtils.ConnectedMembre.IdMembre.ToString()); if (!Directory.Exists(destFolder)) { Directory.CreateDirectory(destFolder); } //4. Upload the image FilePhoto.SaveAs(Path.Combine(destFolder, FilePhoto.FileName)); //5. Update the Photo of the Connected Membre SessionUtils.ConnectedMembre.Photo = FilePhoto.FileName; // 6. Save in the DB uow.EditMembreProfilePhoto(SessionUtils.ConnectedMembre); return(RedirectToAction("Index", "Home")); } } return(View(SessionUtils.ConnectedMembre)); }
//version foreach /*List<PaysEntity> ListePaysFromDB = _paysRepo.Get(); * List<PaysModel> ListePaysForCtrl = new List<PaysModel>(); * * foreach (PaysEntity pe in ListePaysFromDB) * { * PaysModel pm = new PaysModel(); * pm.IdPays = pe.IdPays; * pm.NomPays = pe.Libelle; * ListePaysForCtrl.Add(pm); * } * return ListePaysForCtrl;*/ // ajouter un bien public bool AddBien(AjoutBienModel abm) { MembreModel owner = (MembreModel)HttpContext.Current.Session["ConnectedUser"]; AjoutBienEntity abe = new AjoutBienEntity(); //mapping partie Bien abe.Titre = abm.Titre; abe.DescCourte = abm.DescCourte; abe.DescLong = abm.DescLong; abe.Numero = abm.Numero; abe.Rue = abm.Rue; abe.CodePostal = abm.CodePostal; abe.Ville = abm.Ville; abe.Pays = abm.Pays; abe.NombrePerson = abm.NombrePerson; abe.NbrSBD = abm.NbrSBD; abe.NbrWC = abm.NbrWC; abe.IdMembre = owner.IdMembre; if (abm.Latitude is null) { abe.Latitude = "000000000"; } else { abe.Latitude = abm.Latitude; } if (abm.Longitude is null) { abe.Longitude = "000000000"; } else { abe.Longitude = abm.Longitude; } if (abm.Photo is null) { abe.Photo = "pas de photo disponible"; } else { abe.Photo = abm.Photo; } //je traiterai les options plus tard /*//mapping partie OptionBien * abe.ListeOption = new List<OptionEntity>(); * foreach (OptionModel item in abm.ListeIdOption) * { * OptionEntity option = new OptionEntity(); * option.IdOption = item.IdOption; * option.Libelle = item.Libelle; * abe.ListeOption.Add(option); * }*/ return(_ajoutBienRepo.Insert(abe)); }
/// <summary> /// Ajoute un membre au club /// </summary> public static void AjouterMembre(ClubModel club, MembreModel m) { double montantcotisation = CalculCotisation(m); CotisationModel c = new CotisationModel(montantcotisation); PaiementModel p = new PaiementModel(montantcotisation, m, c); PaiementService.AjouterPaiement(club, p); club.Membres.Add(m); }
//afficher biens du membre public ActionResult MesBiens(MembreModel user) { DataContext ctx = new DataContext(ConfigurationManager.ConnectionStrings["Cnstr"].ConnectionString); user.IdMembre = SessionUtils.ConnectedUser.IdMembre; List <BienModel> listeBM = ctx.GetBiensOfMember(user); return(View(listeBM)); }
public bool EditMembreProfilePhoto(MembreModel mm) { // Mapping MembreEntity me = new MembreEntity(); me.IdMembre = mm.IdMembre; me.Photo = mm.Photo; return(((MembreRepository)_membreRepo).UpdateProfilePhoto(me)); }
/// <summary> /// Retourne la valeur total des paiement en attente du membre /// </summary> public static double PaiementTotal(ClubModel club,MembreModel m) { double somme = 0; foreach(PaiementModel p in PaiementMembre(club,m)) { somme += p.Montant; } return somme; }
/// <summary> /// Retourne true si le membre est disponible pour l'evenement (ne participe pas déja à un evenement sur la meme période ) /// </summary> public static bool EstDisponible(ClubModel club, MembreModel m, EvenementsModel e) { bool Dispo = true; List <EvenementsModel> events = EvenementsAuquelIlParticipe(club, m); foreach (EvenementsModel evenement in events) { Dispo = Dispo && (!EvenementsService.Chevauchement(evenement, e)); } return(Dispo); }
/// <summary> /// Retourne true si le membre est à jour dans ses cotisations /// </summary> public static bool CotisationAJour(ClubModel club, MembreModel m) { foreach (PaiementModel p in PaiementService.PaiementMembre(club, m)) { if (p.Nature is CotisationModel) { return(false); } } return(true); }
/// <summary> /// Retourn true si le membre est majeur /// </summary> public static bool EstMajeur(MembreModel m) { int age = DateTime.Now.Year - m.DateDeNaissance.Year; DateTime dateanniversaire = new DateTime(DateTime.Now.Year, m.DateDeNaissance.Month, m.DateDeNaissance.Day);; if (dateanniversaire > DateTime.Now) { age--; } return(age >= 18); }
/// <summary> /// Ajoute un participant au stage /// </summary> public static void AjouterParticipant(ClubModel club, StageModel s, MembreModel m) { if (m != null) { if (!s.Participants.Contains(m)) { PaiementModel p = new PaiementModel(s.CoutDuStage, m, s); PaiementService.AjouterPaiement(club, p); } } }
/// <summary> /// Met à jour le membre /// </summary> public static void ModifierMembre(ClubModel club, MembreModel m) { foreach (MembreModel membre in club.Membres) { if (membre.IdMembre == m.IdMembre) { club.Membres.Remove(membre); club.Membres.Add(m); break; } } }
public bool CreateMembre(MembreModel um) { MembreEntity membreEntity = new MembreEntity() { Name = um.Name, FirstName = um.FirstName, Email = um.Email, Password = um.Password }; return(_membreRepo.Insert(membreEntity)); }
/// <summary> /// Supprime un membre d'une equipe /// </summary> public static void SupprimerJoueurEquipe(ClubModel club, MembreModel m) { if (m is CompetiteurModel) { CompetiteurModel c = m as CompetiteurModel; EquipeModel equipe = MembreService.EquipeDuJoueur(club, c); equipe.ListeDeJoueur.Remove(c); c.Equipe = null; MembreService.ModifierMembre(club, c); EquipeService.ModifierEquipe(club, equipe); } }
public bool SaveSignUp(MembreModel mm) { MembreEntity me = new MembreEntity(); me.Nom = mm.Nom; me.Prenom = mm.Prenom; me.Email = mm.Email; me.Pays = mm.Pays; me.Telephone = mm.Telephone; me.Login = mm.Login; me.Password = mm.Password; return(_membreRepo.Insert(me)); }
//update info public bool UpdateMemberInfo(MembreModel mm) { MembreEntity membreEntity = new MembreEntity() { Prenom = mm.Prenom, Nom = mm.Nom, Email = mm.Email, Pays = mm.Pays, Telephone = mm.Telephone, Login = mm.Login, }; return(_membreRepo.Update(membreEntity)); }
public bool CreateMember(MembreModel mm) { MembreEntity me = new MembreEntity() { Nom = mm.Nom, Prenom = mm.Prenom, Login = mm.Login, Password = mm.Password, Email = mm.Email, Telephone = mm.Telephone, Pays = mm.Pays, }; return(_membreRepo.Insert(me)); }
public bool UpdateMembre(MembreInfosModel mim) { // transmettre l'id du membre connecté MembreModel membreToUpdate = (MembreModel)HttpContext.Current.Session["ConnectedUser"]; MembreEntity me = new MembreEntity(); if (mim.Nom == null) { me.Nom = membreToUpdate.Nom; } else { me.Nom = mim.Nom; } if (mim.Prenom == null) { me.Prenom = membreToUpdate.Prenom; } else { me.Prenom = mim.Prenom; } if (mim.Email == null) { me.Email = membreToUpdate.Email; } else { me.Email = mim.Email; } if (mim.Telephone == null) { me.Telephone = membreToUpdate.Telephone; } else { me.Telephone = mim.Telephone; } me.Pays = mim.Pays; me.IdMembre = membreToUpdate.IdMembre; return(_membreRepo.Update(me)); }
public ActionResult Connection(LoginModel lm) { UnitOfWork ctx = new UnitOfWork(ConfigurationManager.ConnectionStrings["Cnstr"].ConnectionString); if (ModelState.IsValid) { MembreModel pf = ctx.UserAuth(lm); if (pf == null) { //if (lm.Login != "Kelly" && lm.Password != "dev") //{ //ViewBag.Error = "Erreur Login/Password"; return(View()); //} } else { SessionUtils.IsLogged = true; SessionUtils.ConnectedUser = pf; return(RedirectToAction("Index", "Home", new { area = "Membre" })); } } else { //ViewBag.Error = "Erreur Login/Password"; return(View()); } #region AncientLogin // if (lm.Login != "pandi" && lm.Password != "panda") // { // ViewBag.Error = "Erreur Login/Password"; // return View(); // } // else // { // SessionUtils.IsLogged = true; // return RedirectToAction("Index", "Home", new { area = "Membre" }); // } //} //else //{ // return View(); #endregion }
/// <summary> /// Retourne la liste des paiements en attente du membre /// </summary> public static List<PaiementModel> PaiementMembre(ClubModel club,MembreModel m) { List<PaiementModel> paiementdumembre = new List<PaiementModel> { }; if (m!=null) { foreach (PaiementModel p in club.Paiements) // On parcours l'ensmeble des paiments en attente du club { if (p.Payeur.IdMembre == m.IdMembre) // Si le paiement concerne le membre { paiementdumembre.Add(p); } } } return paiementdumembre; }
public ActionResult NewMembre(MembreModel membre) { UnitOfWork ctx = new UnitOfWork(ConfigurationManager.ConnectionStrings["Cnstr"].ConnectionString); if (ctx.SaveSignUp(membre)) { ViewBag.SuccessMessage = " Inscription réussie"; //return RedirectToAction("Connection", "Home"); return(View()); } else { ViewBag.ErrorMessage = "inscription non valide "; //return RedirectToAction("NewMembre", "Home"); return(View()); } }
public ActionResult Signup(MembreModel um) { if (ModelState.IsValid) { if (uow.CreateMembre(um)) { return(RedirectToAction("SignupSuccess", "Account", new { area = "" })); } else { return(RedirectToAction("SignupFail", "Account", new { area = "" })); } } else { return(RedirectToAction("SignupError", "Account", new { area = "" })); } }
/// <summary> /// Retourne true si le membre a postuler pour le stage mais n'a pas encore payer /// </summary> public static bool VeutParticiper(ClubModel club, StageModel s, MembreModel m) { if (m != null) { List <PaiementModel> ListePaiementsEnAttenteDuMembre = PaiementService.PaiementMembre(club, m); foreach (PaiementModel p in ListePaiementsEnAttenteDuMembre) // On regarde si le membre à postuler pour le stage et doit le payer { if (p.Nature is StageModel) { StageModel stage = p.Nature as StageModel; if (stage.Id == s.Id) { return(true); } } } return(false); } return(false); }
public ActionResult Register(MembreModel um) { if (ModelState.IsValid) { if (dtx.CreateMembre(um)) { SessionUtils.IsLogged = true; SessionUtils.ConnectedUser = um; return(RedirectToAction("Donjons", "Home")); } else { ViewBag.Error = "Erreur Login/Password"; return(View(um)); } } else { return(View(um)); } }
public ActionResult Register(MembreModel mm) { if (ModelState.IsValid) { UnitOfWork uow = new UnitOfWork(ConfigurationManager.ConnectionStrings["Cnstr"].ConnectionString); if (uow.CreateMember(mm)) { return(RedirectToAction("Index", "Home")); } else { return(RedirectToAction("Register", "Account")); } } else { ViewBag.Error = "Erreur Login/Password"; return(View()); } }