Example #1
0
        //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());
            }
        }
Example #2
0
        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é");
        }
Example #3
0
        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");
        }