protected void btnComp_Click(object sender, EventArgs e) { int id = int.Parse(Session["idUser"].ToString()); Candidat cd = db.Candidats.SingleOrDefault(x => x.candidatId == id); if (photoUp.PostedFile != null) { string strPath = Path.GetExtension(photoUp.PostedFile.FileName); strPath = strPath.ToLower(); if (strPath != ".jpg" && strPath != ".jpeg" && strPath != ".gif" && strPath != ".png") { ClientScript.RegisterStartupScript(this.GetType(), "ImageAlert", "ImageInvalide()", true); } else { string filup = Path.GetFileName(photoUp.PostedFile.FileName); photoUp.SaveAs(Server.MapPath("/UserImages/") + filup); cd.photo = filup; } } if (cvUP.PostedFile != null) { string strPath2 = Path.GetExtension(cvUP.PostedFile.FileName); if (strPath2 != ".pdf" && strPath2 != ".doc" && strPath2 != ".docx" && strPath2 != ".txt" && strPath2 != ".ppt") { ClientScript.RegisterStartupScript(this.GetType(), "CVAlert", "CVInvalide()", true); } else { string filup = Path.GetFileName(cvUP.PostedFile.FileName); cvUP.SaveAs(Server.MapPath("/CandidatCV/") + filup); cd.cv = "/CandidatCV/" + filup; } } cd.nom = txtNom.Text; cd.prenom = txtPrenom.Text; cd.dateNaissance = DateTime.Parse(txtDate.Text); if (rbHomme.Checked == true) { cd.genre = rbHomme.Value; } else if (rbFemme.Checked == true) { cd.genre = rbFemme.Value; } cd.ville = txtVille.Text; cd.profil = txtProfil.Text; cd.experience = int.Parse(txtExpe.Text); cd.tel = txtPhone.Text; cd.Profession = txtProffesion.Text; cd.NiveauEtude_IdNiveau = int.Parse(dlNiveau.SelectedValue); db.SubmitChanges(); Response.Redirect("~/Home.aspx"); }
public ActionResult Login(Candidat candidat) { GestionConcourDbContext db = new GestionConcourDbContext(); var x = db.Candidats.Where(c => c.Cne == candidat.Cne && c.Cin == candidat.Cin && c.Password == candidat.Password).SingleOrDefault(); if (x == null) { TempData["error"] = "False Credential"; return(Redirect("Login")); } else { Session["cne"] = candidat.Cne; Session["niveau"] = x.Niveau; Session["role"] = "user"; Session["photo"] = candidat.Photo; if (x.Verified == 1) { return(RedirectToAction("Index", "Home")); } else { return(RedirectToAction("Step1", "Auth")); } } }
// Afficher le contenue de la convocation public ActionResult Fiche(string id, string click = "empty") { if (Session["cne"] == null && id == null) { return(RedirectToAction("Login", "Auth")); } var candidat = db.Candidats.Find(Session["cne"]); if (candidat.Verified == 0) { return(RedirectToAction("Step1", "Auth")); } // Pour supprimer le header de la page de la convocation if (click.Equals("imprimer")) { ViewBag.Imprimer = "imprimer"; } if (id == null) { id = Session["cne"].ToString(); } Candidat data = GetCandidat(id); if (data.Diplome.Type == null || data.Diplome.VilleObtention == null) { return(RedirectToAction("Index")); } return(View(data)); }
public ActionResult Index() { if (Session["cne"] == null) { return(RedirectToAction("Login", "Auth")); } var candidat = db.Candidats.Find(Session["cne"]); if (candidat.Verified == 0) { return(RedirectToAction("Step1", "Auth")); } Session["photo"] = candidat.Photo; Session["nom"] = candidat.Nom; Session["prenom"] = candidat.Prenom; Session["niveau"] = candidat.Niveau; string message = checkConformity(); ViewData["error"] = message; string cne = Session["cne"].ToString(); Candidat c1 = db.Candidats.Where(p => p.Cne == cne).SingleOrDefault(); return(View(c1)); }
public IActionResult updateCandidat([FromBody] Candidat candidat) { try{ checkCandidat(candidat); IsqlMethod isql = Factory.Factory.GetSQLInstance("mysql"); isql.UserCanUpdate(candidat.session_id); if (!isql.CandidatAlreadyExist(candidat)) { throw new Exception("Le candidat n'est pas existant dans votre systeme, veuillez le creer"); } int idUser = isql.getIdFromToken(candidat.session_id); int idCandidat = isql.getIdFromCandidateEmail(candidat.emailAdress); isql.updateCandidate(candidat, idUser); isql.typeAction(candidat.action, candidat.independant, DateTime.Now, idCandidat, "UPDATE"); return(new ObjectResult(new State() { code = 4, content = "Le candidat a ete modifie dans votre systeme", success = true })); }catch (Exception exc) { new WsCustomeException(this.GetType().Name, exc.Message); State state = new State() { code = 1, content = exc.Message, success = false }; return(CreatedAtRoute("GetNote", new { error = state }, state)); } }
private void checkCandidat(Candidat candidat) { if (candidat == null) { throw new Exception("Vous devez creer votre candidat convenablement prealablement"); } }
public ActionResult Create(CandidatViewModel CVM, HttpPostedFileBase file) { // TODO: Add insert logic here Candidat c = new Candidat { CIN = CVM.CIN, Email = CVM.Email, Nom = CVM.Nom, Prenom = CVM.Prenom, Password = CVM.Password, Image = file.FileName }; CS.Add(c); CS.Commit(); var fileName = ""; if (file.ContentLength > 0) { var path = Path.Combine(Server.MapPath("~/Content/Upload/"), file.FileName); file.SaveAs(path); } return(RedirectToAction("Index", "Formation", new { id = c.IdCandidat })); }
public ActionResult Login(Candidat candidat) { var x = _db.Candidats.Where(c => c.Cne == candidat.Cne && c.Cin == candidat.Cin && c.Password == candidat.Password).SingleOrDefault(); if (x == null) { TempData["error"] = "False Credential"; return(Redirect("Login")); } else { HttpContext.Session.SetString("nom", x.Nom); HttpContext.Session.SetString("prenom", x.Prenom); HttpContext.Session.SetString("cne", candidat.Cne); HttpContext.Session.SetInt32("niveau", x.Niveau); HttpContext.Session.SetString("role", "user"); HttpContext.Session.SetString("photo", x.Photo); HttpContext.Session.SetInt32("verified", x.Verified); if (x.Verified == 1) { return(RedirectToAction("Index", "Home")); } else { HttpContext.Session.SetInt32("steps", 1); return(RedirectToAction("Step1", "Auth")); } } }
public Entretien(Creneau creneau, Recruteur recruteur, Candidat candidat, Salle salle) { this.Creneau = creneau; this.Recruteur = recruteur; this.Candidat = candidat; this.Salle = salle; }
/// <summary> /// Permet l'ajout d'un candidat dans la base de données. /// </summary> /// <param name="candidat">Candidat à ajouter.</param> /// <returns>L'identifiant du candidat ajouté.</returns> public async Task <int> AddAsync(Candidat candidat) { this.context.Candidats.Add(candidat); await this.context.SaveChangesAsync().ConfigureAwait(false); return(candidat.CandidatId); }
public async Task <IActionResult> logout([FromBody] RefreshToken reft, string id) { Candidat user = (Candidat)await userManager.FindByIdAsync(id); if (user != null) { var savedRefreshToken = user.RefreshTokens.Where(x => x.refresh_token == reft.refresh_token && x.access_token == reft.access_token).FirstOrDefault(); Console.WriteLine(savedRefreshToken == null); Console.WriteLine(reft.access_token); Console.WriteLine(reft.refresh_token); if (savedRefreshToken != null) { _context.Remove(savedRefreshToken); _context.SaveChanges(); return(Ok(new { msg = "success !" })); } else { return(StatusCode(404)); } } else { return(StatusCode(403)); } }
public void InsertCandidat(Candidat c) { if (OpenConnection()) { } MySqlCommand cmd; { ///try cmd = connection.CreateCommand(); cmd.CommandText = "INSERT INTO CANDIDAT (nom, prenom, descri, titre, email, telephone, " + "com_pref, date_modif, pass) VALUES( @nom, @prenom,@descri , @titre, @email, @telephone, " + "(SELECT ID from TYPE_COMMUNICATION WHERE nom = @com_pref), CURDATE(), @pass)"; cmd.Parameters.AddWithValue("@nom", c.data["nom"]); cmd.Parameters.AddWithValue("@prenom", c.data["prenom"]); cmd.Parameters.AddWithValue("@descri", c.data["descri"]); cmd.Parameters.AddWithValue("@pass", c.data["pass"]); cmd.Parameters.AddWithValue("@titre", c.data["titre"]); cmd.Parameters.AddWithValue("@email", c.data["email"]); cmd.Parameters.AddWithValue("@telephone", c.data["telephone"]); cmd.Parameters.AddWithValue("@com_pref", c.data["com_pref"]); cmd.ExecuteNonQuery(); CloseConnection(); } //catch { CloseConnection(); } }
public bool CandidatAlreadyExist(Candidat candidat) { try{ if (candidat == null) { throw new Exception("Vos Parametres ne sont pas conforme"); } if (String.IsNullOrEmpty(candidat.emailAdress)) { throw new Exception("L'adresse email saisit du candidat n'est pas conforme"); } Dictionary <String, Object> param = new Dictionary <String, Object>(); param.Add("@email", candidat.emailAdress); LinkedList <String> result = new LinkedList <String>(); result.AddLast("nb"); ArrayList output = queryExecute("SELECT count(*) as nb from candidate where email=@email", param, result); if (output.Count == 0) { return(false); } Dictionary <String, String> element = (Dictionary <String, String>)output[0]; if (!element.ContainsKey("nb")) { return(false); } if (int.Parse(element["nb"]) == 0) { return(false); } }catch (Exception exc) { throw new SqlCustomException(this.GetType().Name, exc.Message); } return(true); }
public ActionResult Ajouter([Bind(Include = "DtDisponibilite,LbDisponibilite,Remuneration,Mobilite,InfCom," + "TypAction,TypPriorite,TypOrigine,TypStatut," + "MCEntreprise,MCFonctionnel,MCTechnique," + "DtCreation,CreePar,DtModification,ModifiePar")] Candidat candidat, [Bind(Include = "Civilite,Prenom,Nom,TelMobile,email," + "Adresse,AdresseComplement,CodePostal,Ville,Pays")] Humain humain, [Bind(Include = "TypTdb")] Role roleCandidat) { int newHumain = db.Humain.Select(h => h.CdHumain).ToList().Last() + 1; candidat.CdHumain = newHumain; roleCandidat.CdHumain = newHumain; roleCandidat.CdCandidat = db.Candidat.Select(c => c.CdCandidat).ToList().Last() + 1; //role.CdRole = db.Role.Select(r => r.CdRole).ToList().Last() + 1; if (ModelState.IsValid) { db.Humain.Add(humain); db.SaveChanges(); db.Candidat.Add(candidat); db.SaveChanges(); db.Role.Add(roleCandidat); db.SaveChanges(); return(RedirectToAction("fiche", "Candidat", new { id = candidat.CdCandidat })); } return(RedirectToAction("Vue")); }
public void addCandidate(Candidat candidat, int id) { if (candidat == null) { throw new Exception(" Vous devez renseigner les informations du candidat"); } if (id == 0) { throw new Exception("Vous devez avoir un id valide"); } Dictionary <String, Object> dico = new Dictionary <String, Object>(); try{ dico.Add("@nom", candidat.Name); dico.Add("@prenom", candidat.Firstname); dico.Add("@num", candidat.phone); dico.Add("@emailAdress", candidat.emailAdress); dico.Add("@sexe", candidat.sexe); dico.Add("@etat", candidat.action); dico.Add("@annee", candidat.year); dico.Add("@lien", candidat.link); dico.Add("@crcall", candidat.crCall); dico.Add("@ns", candidat.ns); dico.Add("@email", candidat.email); dico.Add("@userId", id); queryExecute("insert into candidate (nom,prenom,phone,email,sexe,actions,annee,lien,crCall,NS,approche_email,fid_user_candidate) values (@nom,@prenom,@num,@emailAdress,@sexe,@etat,@annee,@lien,@crcall,@ns,@email,@userId)", dico, null); }catch (Exception exc) { throw new SqlCustomException(this.GetType().Name, exc.Message); } }
public async Task <IActionResult> PutCandidat(int id, Candidat candidat) { if (id != candidat.IdCandidat) { return(BadRequest()); } _context.Entry(candidat).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CandidatExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Candidat> > PostCandidat(Candidat candidat) { _context.Candidat.Add(candidat); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCandidat", new { id = candidat.IdCandidat }, candidat)); }
public PartialViewResult ConvoqueDossier4eme(string CIN) { Candidat et = db.Candidats.Find(CIN); if (et != null && et.niveau.Equals("4eme")) { if (et.n_dossier.Equals("0")) { Random rnd = new Random(); rnd.Next(1, 100); et.n_dossier = "M" + Convert.ToString(et.CNE) + "end"; db.SaveChanges(); return(PartialView("_ConvoqueDossier", et)); } else { ViewBag.msgE = "Numero de dossier déja attribué " + et.n_dossier; Response.Write("<script>alert(\'Erreur le Candidat déja convoquer CIN non valide !!!!!\');</" + "script>"); return(PartialView("_ConvoqueDossier", et)); } } Response.Write("<script>alert(\'ce candidat n'existe pas en 4 eme annee!!!!!\');</" + "script>"); return(PartialView("_ConvoqueDossierErr", et)); }
public ActionResult voter(int?id) { #pragma warning disable CS0246 // Le nom de type ou d'espace de noms 'ElectionDatabaseEntities' est introuvable (vous manque-t-il une directive using ou une référence d'assembly ?) #pragma warning disable CS0246 // Le nom de type ou d'espace de noms 'ElectionDatabaseEntities' est introuvable (vous manque-t-il une directive using ou une référence d'assembly ?) ElectionDatabaseEntities dbcand = new ElectionDatabaseEntities(); #pragma warning restore CS0246 // Le nom de type ou d'espace de noms 'ElectionDatabaseEntities' est introuvable (vous manque-t-il une directive using ou une référence d'assembly ?) #pragma warning restore CS0246 // Le nom de type ou d'espace de noms 'ElectionDatabaseEntities' est introuvable (vous manque-t-il une directive using ou une référence d'assembly ?) ElectionDatabaseEntities3 db = new ElectionDatabaseEntities3(); // Electeur electeur = db.Electeur.Find(cni); ViewBag.prenom = ""; if (id != null) { Candidat candidat = dbcand.Candidat.Find(id); candidat.voix = candidat.voix + 1; dbcand.Entry(candidat).State = EntityState.Modified; dbcand.SaveChanges(); ViewBag.prenom = this.elect.prenom; return(RedirectToAction("index/")); } else { List <Candidat> cand = dbcand.Candidat.ToList <Candidat>(); //ViewBag.candidats = new Candidat(); //ViewBag.electeur = this.elect; return(View(dbcand.Candidat.ToList())); } }
public ActionResult Authorise(Candidat user) { if (ModelState.IsValid) { using (Projet_ContextBD db = new Projet_ContextBD()) { var userDetail = db.Candidats.Where(x => x.CIN == user.CIN && x.password == user.password).FirstOrDefault(); if ((userDetail == null) && (ModelState.IsValid)) { // user.LoginErrorMsg = "Invalid UserName or Password"; Response.Write("<script>alert(\'données incorrect\');</" + "script>"); return(View("Index", user)); } else { CandidatsController.id = (string)Session["CIN"]; Session["CIN"] = userDetail.CIN; Session["prenom"] = userDetail.prenom; return(RedirectToAction("Edit", new RouteValueDictionary(new { Controller = "Candidats", Action = "Edit", id = Session["CIN"] }))); } } } else { return(View("Index")); } }
public ActionResult updateinfo( String cin, String cne, String prenom, String nom, String ville, String adresse, String numéro, String GSM, String nationalité, String sexe, String email, String date_naiss, String photo) { Candidat candidat = db.Candidats.Find(cin); candidat.CIN = cin; candidat.CNE = cne; candidat.prenom = prenom; candidat.nom = nom; candidat.ville = ville; candidat.addresse = adresse; candidat.tel = numéro; candidat.GSM = GSM; candidat.nationnalite = nationalité; candidat.email = email; candidat.date_naiss = Convert.ToDateTime(date_naiss); candidat.sexe = sexe; string filename = System.IO.Path.GetFileNameWithoutExtension(photo); string extension = System.IO.Path.GetExtension(photo); filename = filename + extension; candidat.photo = filename; db.SaveChanges(); ViewBag.CIN = cin; String msg = "modification des informations personnels avec succés"; return(RedirectToAction("update", new { cin = cin, msg = msg })); }
//#################################################### ACCUEIL ################################################## public IActionResult Accueil() { if (!isCandidat()) { return(RedirectToAction("Login", "Auth")); } string cne = HttpContext.Session.GetString("cne"); int? verified = HttpContext.Session.GetInt32("verified"); if (verified == 0) { return(RedirectToAction("Step1", "Auth")); } Candidat candidat = candidat_service.getTotalCandidat(cne); HttpContext.Session.SetString("photo", candidat.Photo); HttpContext.Session.SetString("prenom", candidat.Prenom); HttpContext.Session.SetString("nom", candidat.Nom); HttpContext.Session.SetInt32("niveau", candidat.Niveau); string message = candidat_service.checkConformity(cne); string errorMessage = candidat_service.checkDiplome(cne); ViewBag.errorMessage = errorMessage; ViewBag.error = message; return(View(candidat)); }
public async Task <ActionResult <IEnumerable <Candidature> > > getAllCandidatures(string id) { Candidat user = (Candidat)await userManager.FindByIdAsync(id); if (user != null) { var candidatures = user.candidatures; // .Include(x => x.offre).Where(e => e.candidat == user); /*.ThenInclude(x => x.Diplome) * .Include(x => x.offre) * .ThenInclude(x => x.Competence) * .Include(x => x.offre) * .ThenInclude(x => x.Langue) * .Include(x => x.offre) * .ThenInclude(x => x.Candidature). * ; ;*/ return(Ok(new { candidatures = candidatures })); } return(NotFound()); /*.Include(x => x.offre) * .ThenInclude(x => x.diplomes) * .Include(x => x.offre) * .ThenInclude(x => x.competences) * .Include(x => x.offre) * .ThenInclude(x => x.langues) * .Include(x => x.offre) * .ThenInclude(x => x.candidatures). * Where(e => e.candidat == user);*/ }
public ActionResult correction2() { var Notes1 = Request["item.Notes.notemath"].ToString().Split(','); var Notes2 = Request["item.Notes.notespec"].ToString().Split(','); var CINS = Request["item.CIN"].ToString().Split(','); String d; for (int i = 0; i < CINS.Length; i++) { d = CINS[i].ToString(); Candidat cand = db.Candidats.Find(d); int idnote = cand.id_note; Notes n = db.Notes.Find(idnote); n.notemath = Double.Parse(Notes1[i]); n.notespec = Double.Parse(Notes2[i]); n.note_concours = (n.notemath + n.notespec) / 2; db.SaveChanges(); } String cin = CINS[0]; Candidat c = db.Candidats.Find(cin); String niveau = c.niveau; String idfil = c.id_fil.ToString(); String msg = "affectation des notes du concours avec succés"; return(RedirectToAction("correction", new { niveau = niveau, idfil = idfil, msg = msg })); }
public async Task <IActionResult> ConfirmInscription([FromBody] Candidat candidat) { var user = await userManager.FindByNameAsync(candidat.UserName); Console.Write(user.Email); if (user != null) { if (user.EmailConfirmed == true) { return(StatusCode(StatusCodes.Status500InternalServerError, new Response { message = "Email dejà confirmé !", status = "401" })); } var result = await userManager.ConfirmEmailAsync(user, candidat.nom); if (result.Succeeded) { return(Ok(new { reponse = "email a été confirmé avec succès ! " })); } else { return(StatusCode(StatusCodes.Status500InternalServerError, new Response { message = "Email not confirmed !", status = "500" })); } } return(StatusCode(StatusCodes.Status404NotFound, new Response { message = "User Not found !" })); }
public ActionResult update2(String cin, String msg) { ViewBag.messageconfirm = msg; Candidat candidat = db.Candidats.Find(Session["CIN"]); int iddip = candidat.id_diplome; Diplome dip = db.Diplomes.Find(iddip); ViewBag.nomdip = dip.nom_diplome; ViewBag.villedip = dip.ville_diplome; ViewBag.etab = dip.etablissement; int idnote = candidat.id_note; Notes n = db.Notes.Find(idnote); ViewBag.s1 = n.s1; ViewBag.s2 = n.s2; ViewBag.s3 = n.s3; ViewBag.s4 = n.s4; ViewBag.s5 = n.s5; ViewBag.s6 = n.s6; ViewBag.CIN = cin; return(View(candidat)); }
public ActionResult update(String cin, String msg) { Candidat candidat = db.Candidats.Find(Session["CIN"]); ViewBag.CIN = cin; ViewBag.messageconfirm = msg; return(View(candidat)); }
public ActionResult fiche2() { String s = CandidatsController.id; Candidat candidat = db.Candidats.Find(s); return(View(candidat)); }
public IActionResult ImprimerConvocation(string cne) { Candidat data = fiche.GetCandidat(cne); ViewBag.Imprimer = "imprimer"; return(new ViewAsPdf("FicheImprime", data)); }
public ActionResult DeleteConfirmed(int id) { Candidat candidat = db.Candidat.Find(id); db.Candidat.Remove(candidat); db.SaveChanges(); return(RedirectToAction("Index")); }