public ActionResult ModifierDiplome(DiplomeNote diplome)
        {
            string cne = Session["cne"].ToString();

            if (ModelState.IsValid)
            {
                var x = db.Diplomes.Where(c => c.Cne == cne).SingleOrDefault();
                x.Type           = diplome.Type;
                x.Etablissement  = diplome.Etablissement;
                x.VilleObtention = diplome.VilleObtention;
                x.NoteDiplome    = diplome.NoteDiplome;
                x.Specialite     = diplome.Specialite;
                db.SaveChanges();

                var y = db.AnneeUniversitaires.Where(a => a.Cne == cne).SingleOrDefault();
                y.Semestre1   = diplome.Semestre1;
                y.Semestre2   = diplome.Semestre2;
                y.Semestre3   = diplome.Semestre3;
                y.Semestre4   = diplome.Semestre4;
                y.Semestre5   = diplome.Semestre5;
                y.Semestre6   = diplome.Semestre6;
                y.Redoublant1 = diplome.Redoublant1;
                y.Redoublant2 = diplome.Redoublant2;
                y.Redoublant3 = diplome.Redoublant3;
                y.AnneUni1    = diplome.AnneUni1;
                y.AnneUni2    = diplome.AnneUni2;
                y.AnneUni3    = diplome.AnneUni3;

                db.SaveChanges();
                TempData["message"] = "Diplome Modified succefully";
                return(RedirectToAction("Index"));
            }
            return(View(diplome));
        }
Exemple #2
0
 public ActionResult Step3()
 {
     if (HttpContext.Session.GetString("cne") != null)
     {
         Candidat candidat = _db.Candidats.Find(HttpContext.Session.GetString("cne"));
         if (candidat.Verified == 1)
         {
             return(RedirectToAction("Index", "Home"));
         }
         var         diplome = _db.Diplomes.Find(HttpContext.Session.GetString("cne"));
         var         anne    = _db.AnneeUniversitaires.Find(HttpContext.Session.GetString("cne"));
         DiplomeNote dipNote = new DiplomeNote()
         {
             Type           = diplome.Type,
             Etablissement  = diplome.Etablissement,
             VilleObtention = diplome.VilleObtention,
             NoteDiplome    = diplome.NoteDiplome,
             Specialite     = diplome.Specialite,
             Semestre1      = anne.Semestre1,
             Semestre2      = anne.Semestre2,
             Semestre3      = anne.Semestre3,
             Semestre4      = anne.Semestre4,
             Semestre5      = anne.Semestre5,
             Semestre6      = anne.Semestre6,
             Redoublant1    = anne.Redoublant1,
             Redoublant2    = anne.Redoublant2,
             Redoublant3    = anne.Redoublant3,
             AnneUni1       = anne.AnneUni1,
             AnneUni2       = anne.AnneUni2,
             AnneUni3       = anne.AnneUni3
         };
         int steps = (int)HttpContext.Session.GetInt32("steps");
         if (steps != 3)
         {
             return(RedirectToAction("Step1"));
         }
         ViewBag.niveau = HttpContext.Session.GetInt32("niveau").ToString();
         return(View(dipNote));
     }
     return(RedirectToAction("Login", "Auth"));
 }
        public ActionResult ModifierDiplome()
        {
            if (Session["cne"] == null)
            {
                return(RedirectToAction("Login", "Auth"));
            }
            var candidat = db.Candidats.Find(Session["cne"]);

            if (candidat.Verified == 0)
            {
                return(RedirectToAction("Step1", "Auth"));
            }
            var         diplome = db.Diplomes.Find(Session["cne"]);
            var         anne    = db.AnneeUniversitaires.Find(Session["cne"]);
            DiplomeNote dipNote = new DiplomeNote()
            {
                Type           = diplome.Type,
                Etablissement  = diplome.Etablissement,
                VilleObtention = diplome.VilleObtention,
                NoteDiplome    = diplome.NoteDiplome,
                Specialite     = diplome.Specialite,
                Semestre1      = anne.Semestre1,
                Semestre2      = anne.Semestre2,
                Semestre3      = anne.Semestre3,
                Semestre4      = anne.Semestre4,
                Semestre5      = anne.Semestre5,
                Semestre6      = anne.Semestre6,
                Redoublant1    = anne.Redoublant1,
                Redoublant2    = anne.Redoublant2,
                Redoublant3    = anne.Redoublant3,
                AnneUni1       = anne.AnneUni1,
                AnneUni2       = anne.AnneUni2,
                AnneUni3       = anne.AnneUni3
            };

            return(View(dipNote));
        }
        public ActionResult Step3(DiplomeNote diplome)
        {
            string cne = Session["cne"].ToString();

            if (ModelState.IsValid)
            {
                var x = db.Diplomes.Where(c => c.Cne == cne).SingleOrDefault();
                x.Type           = diplome.Type;
                x.Etablissement  = diplome.Etablissement;
                x.VilleObtention = diplome.VilleObtention;
                x.NoteDiplome    = diplome.NoteDiplome;
                x.Specialite     = diplome.Specialite;
                db.SaveChanges();

                var y = db.AnneeUniversitaires.Where(a => a.Cne == cne).SingleOrDefault();
                y.Semestre1   = diplome.Semestre1;
                y.Semestre2   = diplome.Semestre2;
                y.Semestre3   = diplome.Semestre3;
                y.Semestre4   = diplome.Semestre4;
                y.Semestre5   = diplome.Semestre5;
                y.Semestre6   = diplome.Semestre6;
                y.Redoublant1 = diplome.Redoublant1;
                y.Redoublant2 = diplome.Redoublant2;
                y.Redoublant3 = diplome.Redoublant3;
                y.AnneUni1    = diplome.AnneUni1;
                y.AnneUni2    = diplome.AnneUni2;
                y.AnneUni3    = diplome.AnneUni3;

                db.SaveChanges();
                Candidat candidat = db.Candidats.Find(Session["cne"]);
                candidat.Verified = 1;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(diplome));
        }
        public ActionResult Step3()
        {
            if (Session["cne"] != null)
            {
                Candidat candidat = db.Candidats.Find(Session["cne"]);
                if (candidat.Verified == 1)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                var         diplome = db.Diplomes.Find(Session["cne"]);
                var         anne    = db.AnneeUniversitaires.Find(Session["cne"]);
                DiplomeNote dipNote = new DiplomeNote()
                {
                    Type           = diplome.Type,
                    Etablissement  = diplome.Etablissement,
                    VilleObtention = diplome.VilleObtention,
                    NoteDiplome    = diplome.NoteDiplome,
                    Specialite     = diplome.Specialite,
                    Semestre1      = anne.Semestre1,
                    Semestre2      = anne.Semestre2,
                    Semestre3      = anne.Semestre3,
                    Semestre4      = anne.Semestre4,
                    Semestre5      = anne.Semestre5,
                    Semestre6      = anne.Semestre6,
                    Redoublant1    = anne.Redoublant1,
                    Redoublant2    = anne.Redoublant2,
                    Redoublant3    = anne.Redoublant3,
                    AnneUni1       = anne.AnneUni1,
                    AnneUni2       = anne.AnneUni2,
                    AnneUni3       = anne.AnneUni3
                };
                var          fromAddress  = new MailAddress("*****@*****.**", "From ENSAS");
                var          toAddress    = new MailAddress(candidat.Email, "To Name");
                const string fromPassword = "******";
                const string subject      = "Création de compte de postulation au concours ENSAS";
                //string body = "<a href=\"http://localhost:49969/Auth/Verify?cne="+candidat.Cne+" \">Link</a><br /><p> this is the password : "******"</p>";
                string body = "<div class=\"container\"><div class=\"row\"><img src=\"https://lh3.googleusercontent.com/proxy/g_QnANEsQGJPGvR4haGBTi-kr2n32DU-eArBRKuJWtpgPCHQbz-RINzL6FzIc1TQs0a80Vfkaew6umTHHPQgHTE4l_g \" /></div><div class=\"row text-center\"><h2>Vous avez créer un compte dans la platforme d'acces au cycle d'ingénieur a ENSAS </h2></div><div class=\"alert alert-danger\"><strong><span style=\"color:'red'\">Vous trouverez votre mot de pass au dessouss</span></strong><br></div><div class=\"row\"><div class=\"card\" style=\"width: 18rem;\"><div class=\"card-body\"><strong>Nom :</strong><span>" + candidat.Nom + "</span><br /><strong>Prenom : </strong><span>" + candidat.Prenom + "</span><br /><strong>CNE : </strong><span>" + candidat.Cne + "</span><br /><strong>CIN : </strong><span>" + candidat.Cin + "</span><br /><strong>Password : </strong><span>" + candidat.Password + "</span><br /><strong>Filiere Choisie : </strong><span>" + candidat.Filiere.Nom + "</span><br /></div></div></div></div>";


                var smtp = new SmtpClient
                {
                    Host           = "smtp.gmail.com",
                    Port           = 587,
                    EnableSsl      = true,
                    DeliveryMethod = SmtpDeliveryMethod.Network,
                    Credentials    = new NetworkCredential(fromAddress.Address, fromPassword),
                    Timeout        = 60000
                };
                using (var message = new MailMessage(fromAddress, toAddress)
                {
                    Subject = subject,
                    Body = body
                })
                {
                    message.IsBodyHtml = true;
                    smtp.Send(message);
                }
                return(View(dipNote));
            }
            return(RedirectToAction("Login", "Auth"));
        }
Exemple #6
0
        public ActionResult Step3(DiplomeNote diplome)
        {
            string cne = HttpContext.Session.GetString("cne");

            if (ModelState.IsValid)
            {
                var x = _db.Diplomes.Where(c => c.Cne == cne).SingleOrDefault();
                x.Type           = diplome.Type;
                x.Etablissement  = diplome.Etablissement;
                x.VilleObtention = diplome.VilleObtention;
                x.NoteDiplome    = diplome.NoteDiplome;
                x.Specialite     = diplome.Specialite;
                _db.SaveChanges();

                var y = _db.AnneeUniversitaires.Where(a => a.Cne == cne).SingleOrDefault();
                y.Semestre1   = diplome.Semestre1;
                y.Semestre2   = diplome.Semestre2;
                y.Semestre3   = diplome.Semestre3;
                y.Semestre4   = diplome.Semestre4;
                y.Semestre5   = diplome.Semestre5;
                y.Semestre6   = diplome.Semestre6;
                y.Redoublant1 = diplome.Redoublant1;
                y.Redoublant2 = diplome.Redoublant2;
                y.Redoublant3 = diplome.Redoublant3;
                y.AnneUni1    = diplome.AnneUni1;
                y.AnneUni2    = diplome.AnneUni2;
                y.AnneUni3    = diplome.AnneUni3;

                _db.SaveChanges();
                Candidat candidat = _db.Candidats.Find(HttpContext.Session.GetString("cne"));
                candidat.Verified = 1;
                _db.SaveChanges();
                var          z            = _db.Candidats.Where(c => c.Cne == HttpContext.Session.GetString("cne")).SingleOrDefault();
                var          fromAddress  = new MailAddress("*****@*****.**", "From ENSAS");
                var          toAddress    = new MailAddress(candidat.Email, "To Name");
                const string fromPassword = "******";
                const string subject      = "Création de compte de postulation au concours ENSAS";
                //string body = "<a href=\"http://localhost:49969/Auth/Verify?cne="+candidat.Cne+" \">Link</a><br /><p> this is the password : "******"</p>";
                string body = z.Nom;

                HttpContext.Session.SetInt32("verified", z.Verified);

                var smtp = new SmtpClient
                {
                    Host           = "smtp.gmail.com",
                    Port           = 587,
                    EnableSsl      = true,
                    DeliveryMethod = SmtpDeliveryMethod.Network,
                    Credentials    = new NetworkCredential(fromAddress.Address, fromPassword),
                    Timeout        = 60000
                };
                using (var message = new MailMessage(fromAddress, toAddress)
                {
                    Subject = subject,
                    Body = body
                })
                {
                    try
                    {
                        message.IsBodyHtml = true;
                        smtp.Send(message);
                        return(RedirectToAction("Index", "Home"));
                    }
                    catch
                    {
                        return(RedirectToAction("Index", "Home"));
                    }
                }
            }
            return(View(diplome));
        }