public ActionResult RefuseEvent(int id) { List <EventPicture> pics = sep.GetMany(x => x.eventid == id).ToList(); foreach (var item in pics) { // if (System.IO.File.Exists(Request.MapPath(@"../Content/eventpics/" + item.picName))) // { System.IO.File.Delete(Request.MapPath(@"/Content/eventpics/" + item.picName)); //} sep.Delete(item); sep.Commit(); } IServiceMS spsms = new ServiceMS(); IServiceUserEvent spue = new serviceUserEvent(); string mails = spue.GetMany(x => x.participation == true).SelectMany(x => x.User.mail.Split(',')).ToString(); if (mails != null) { spsms.sendMail(mails, "l'évenement " + spe.GetById(id).EventTitle + "a été supprimer", "l'annonce de cet evenement a été suprrimer verifier avec les organizateurs de cet evenement"); } spe.refuseEvent(id); return(RedirectToAction("EventNotApproved")); }
//this methode will recover the credentials i won't give the user an information if the credentials are correct public ActionResult recoverPassword(string credentials) { IServiceMS sms = new ServiceMS(); User _user = spu.Get(x => x.phone == credentials || x.mail == credentials); if (_user != null) { const string chars = "0123456789"; Random rand = new Random(); string key = new string(Enumerable.Repeat(chars, 6).Select(s => s[rand.Next(10)]).ToArray()); var cookie = new HttpCookie("cookie"); cookie["key"] = key; Response.Cookies.Add(cookie); sms.sendSMS(key, _user.phone); // task.Wait(); ViewBag.userid = _user.id; return(View()); } else { return(View()); } }
public void refuseEvent(int eventid) { Event eve = this.GetById(eventid); IserviceUser spu = new serviceUser(); User creator = spu.GetById((long)eve.creatorid); IServiceMS sms = new ServiceMS(); this.Delete(eve); this.Commit(); sms.sendSMS("votre annonce :" + eve.EventTitle + " n'a pas été approuvé", creator.phone); sms.sendMail(creator.mail, "annonce réfusé", "votre annonce :" + eve.EventTitle + " n'a pas été approuvé"); }
public void acceptEvent(int eventid, int idadmin) { IserviceUser spu = new serviceUser(); Event eve = this.GetById(eventid); User creator = spu.GetById((long)eve.creatorid); eve.adminid = idadmin; this.Update(eve); this.Commit(); IServiceMS sms = new ServiceMS(); sms.sendSMS("votre annonce :" + eve.EventTitle + " a été approuver", spu.GetById((long)eve.creatorid).phone); sms.sendMail(eve.creator.mail, "annonce accepté", "votre annonce :" + eve.EventTitle + "a été approuvé vous pouvez la consulter sur notre siteweb"); }
public ActionResult Signup(User _user, string pw) { IServiceMS sms = new ServiceMS(); if (spu.Get(x => x.username == _user.username) != null) { ViewBag.error = "username exists"; ModelState.AddModelError("register", "username exists"); } if (spu.Get(x => x.mail == _user.mail) != null) { ViewBag.error = "mail exists"; ModelState.AddModelError("register", "mail exists"); } if (spu.Get(x => x.phone == _user.phone) != null) { ViewBag.error = "phone number exists"; ModelState.AddModelError("register", "phone number exists"); } if (pw != _user.password) { ModelState.AddModelError("register", "passwords doesn't match"); } if (ModelState.IsValid) { const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; Random rand = new Random(); _user.activated = new string(Enumerable.Repeat(chars, 36).Select(s => s[rand.Next(36)]).ToArray()); //hash the password SHA256 hash = new SHA256CryptoServiceProvider(); Byte[] originalBytes = ASCIIEncoding.Default.GetBytes(_user.password); Byte[] encodedBytes = hash.ComputeHash(originalBytes); _user.password = BitConverter.ToString(encodedBytes); /*******/ spu.register_user(_user); sms.sendMail(_user.mail, "verify your mail", "http://localhost:8080/User/verifymail/?id=" + _user.id + "&key=" + _user.activated); return(RedirectToAction("index")); } else { ModelState.Remove("password"); return(View("login")); } }
public ActionResult Newsletter(string obj, string body) { IServiceMS sms = new ServiceMS(); IserviceNL spnl = new serviceNL(); try { string mails = spnl.GetAll().SelectMany(a => a.mailsubs.Split(',')).ToString(); sms.sendMail(mails, obj, body); } catch (Exception) { return(RedirectToAction("index")); } return(RedirectToAction("Index")); }
public ActionResult AcceptAnnonce(int id) { Admin _admin = spa.Get(x => x.mailAdmin == User.Identity.Name); spe.acceptEvent(id, _admin.idAdmin); Logs log = new Logs(); log.adminid = _admin.idAdmin; log.eventid = id; log.date = DateTime.Now; spl.Add(log); spl.Commit(); IServiceMS spsms = new ServiceMS(); IServiceUserEvent spue = new serviceUserEvent(); string mails = spue.GetMany(x => x.participation == true).SelectMany(x => x.User.mail.Split(',')).ToString(); if (mails != null) { spsms.sendMail(mails, "l'évenement " + spe.GetById(id).EventTitle + "a été modifier consulter le lien ci dessous pour voir les changements", "localhost:8080/Event/Details/" + id); } return(RedirectToAction("EventNotApproved")); }