public ActionResult DeleteConfirmed(int id) { Candidate_tbl candidate_tbl = db.Candidate_tbl.Find(id); db.Candidate_tbl.Remove(candidate_tbl); db.SaveChanges(); return(RedirectToAction("Index")); }
public int AddCandidate(Candidate_tbl candidate) { db = new CollegeERPDBEntities(); db.Candidate_tbl.Add(candidate); db.SaveChanges(); return candidate.ID; }
public ActionResult Edit([Bind(Include = "candidate_id,candidate_name,candidate_password,candidate_email,candidate_contact,candidate_institution")] Candidate_tbl candidate_tbl) { if (ModelState.IsValid) { db.Entry(candidate_tbl).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(candidate_tbl)); }
protected void btnRegister_Click(object sender, EventArgs e) { MembershipCreateStatus createStatus; string message = string.Empty; Candidate_tbl candidate = new Candidate_tbl { Name = Nametxt.Text, Username = Usernametxt.Text, Email = Emailtxt.Text, Password = Passwordtxt.Text, Phone = Phonetxt.Text, Status = 0, AdmissionYear = DateTime.Now.Year.ToString() }; MembershipUser newUser = System.Web.Security.Membership.CreateUser(Usernametxt.Text, Passwordtxt.Text, Emailtxt.Text, null, null, true, out createStatus); switch (createStatus) { case MembershipCreateStatus.Success: message = "The user account was successfully created!"; FormsAuthentication.SetAuthCookie(Usernametxt.Text, true); DatabaseFunctions db = new DatabaseFunctions(); DBFunctions d = new DBFunctions(); int i = db.insertUserOtherInfo(Usernametxt.Text, Phonetxt.Text, newUser.ProviderUserKey.ToString(), 0); int CandidateID = d.AddCandidate(candidate); if (i != -1) { db.InsertMappindIDs(newUser.ProviderUserKey.ToString(), CandidateID); Response.Redirect("ProfilePage.aspx"); } break; case MembershipCreateStatus.DuplicateUserName: message = "There already exists a user with this username."; break; case MembershipCreateStatus.DuplicateEmail: message = "There already exists a user with this email address."; break; case MembershipCreateStatus.InvalidEmail: message = "There email address you provided in invalid."; break; case MembershipCreateStatus.InvalidAnswer: message = "There security answer was invalid."; break; case MembershipCreateStatus.InvalidPassword: message = "The password you provided is invalid. It must be atleast 4 characters long."; break; default: message = "There was an unknown error; the user account was NOT created."; break; } RegistrationLabel.Visible = true; RegistrationLabel.Text = message; }
// GET: /Candidate/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Candidate_tbl candidate_tbl = db.Candidate_tbl.Find(id); if (candidate_tbl == null) { return(HttpNotFound()); } return(View(candidate_tbl)); }
protected void btnlogin_Click(object sender, EventArgs e) { string returnuurl = ""; if (Request.QueryString["Redirecturl"] != null) { returnuurl = Request.QueryString["Redirecturl"]; Message.Visible = true; Message.Text = "Please Login First"; } else { DBFunctions db = new DBFunctions(); Candidate_tbl candidate = db.LoginChek(username.Text, password.Text); if (Membership.ValidateUser(username.Text, password.Text)) { FormsAuthentication.SetAuthCookie(username.Text, true); string UserID = ""; bool LoggedStatus = (System.Web.HttpContext.Current.User != null) && System.Web.HttpContext.Current.User.Identity.IsAuthenticated; MembershipUser mu = Membership.GetUser(username.Text); UserID = mu.ProviderUserKey.ToString(); DatabaseFunctions d = new DatabaseFunctions(); int uid = d.GetCandidateID(UserID); Session["username"] = username.Text; Session["userid"] = uid; Session["Name"] = candidate.Name; Session["Image"] = candidate.Image; Session["Role"] = "Student"; Session["email"] = candidate.Email; Session["candidate"] = candidate; if (returnuurl == "") { Response.Redirect("ProfilePage.aspx"); } else { Response.Redirect(returnuurl); } } else { Message.Text = "Wrong Username or Password"; Message.Visible = true; } } }
public ActionResult Create([Bind(Include = "candidate_id,candidate_name,candidate_password,candidate_email,candidate_contact,candidate_institution")] Candidate_tbl candidate_tbl) { if (ModelState.IsValid) { db.Candidate_tbl.Add(candidate_tbl); db.SaveChanges(); if (Session["admin_name"] != null) { return(RedirectToAction("Index")); } else { return(RedirectToAction("Login")); } } return(View(candidate_tbl)); }
protected void btnRegister_Click(object sender, EventArgs e) { MembershipCreateStatus createStatus; string message = string.Empty; Candidate_tbl candidate = new Candidate_tbl { Name = Nametxt.Text, Username = Usernametxt.Text, Email = Emailtxt.Text, Password = Passwordtxt.Text, Phone = Phonetxt.Text, Status = 0, AdmissionYear = DateTime.Now.Year.ToString() }; MembershipUser newUser = System.Web.Security.Membership.CreateUser(Usernametxt.Text, Passwordtxt.Text, Emailtxt.Text, null, null, true, out createStatus); switch (createStatus) { case MembershipCreateStatus.Success: message = "The user account was successfully created!"; FormsAuthentication.SetAuthCookie(Usernametxt.Text, true); DatabaseFunctions db = new DatabaseFunctions(); DBFunctions d = new DBFunctions(); int i=db.insertUserOtherInfo(Usernametxt.Text, Phonetxt.Text, newUser.ProviderUserKey.ToString(),0); int CandidateID=d.AddCandidate(candidate); if(i!=-1) { db.InsertMappindIDs(newUser.ProviderUserKey.ToString(),CandidateID); Response.Redirect("ProfilePage.aspx"); } break; case MembershipCreateStatus.DuplicateUserName: message = "There already exists a user with this username."; break; case MembershipCreateStatus.DuplicateEmail: message = "There already exists a user with this email address."; break; case MembershipCreateStatus.InvalidEmail: message = "There email address you provided in invalid."; break; case MembershipCreateStatus.InvalidAnswer: message = "There security answer was invalid."; break; case MembershipCreateStatus.InvalidPassword: message = "The password you provided is invalid. It must be atleast 4 characters long."; break; default: message = "There was an unknown error; the user account was NOT created."; break; } RegistrationLabel.Visible = true; RegistrationLabel.Text = message; }
protected void Page_Load(object sender, EventArgs e) { string pagename = Path.GetFileName(Request.PhysicalPath); if (Session["userid"] != null) { int uid = int.Parse(Session["userid"].ToString()); DBFunctions db = new DBFunctions(); Candidate_tbl candidate = db.getuserinfo(uid); namelbl.Text = candidate.Name; imglbl.Text = "<img src='images/" + candidate.Image + "' class='img-circle img-responsive'>"; programmelbl.Text = candidate.Program_tbl.ProgramName; deptlbl.Text = candidate.Program_tbl.Department_tbl.Department; if (candidate.Applications_tbl.FirstOrDefault() != null) { semesterlbl.Text = candidate.StudentInfo_tbl.FirstOrDefault().Semester.ToString(); metriclbl.Text = candidate.AddmissionList_tbl.FirstOrDefault().MetricNo; } else { semesterlbl.Text = "Will be Assign After Admission"; metriclbl.Text = "Will be Assign After Admission"; } Doblbl.Text = candidate.DateofBirth; Genderlbl.Text = candidate.Gender; Addresslbl.Text = candidate.HomeAdress; Emaillbl.Text = candidate.Email; phonenumberlbl.Text = candidate.Phone; statelbl.Text = candidate.States_tbl.State; arealbl.Text = candidate.Areas_tbl.Area; } else { Response.Redirect("Login.aspx?Redirecturl=" + pagename); } }
protected void btnRegister_Click(object sender, EventArgs e) { if (FileUpload.FileName != "") { FileUpload.SaveAs(Server.MapPath(UploadFolderPath + FileUpload.FileName)); } double SecondaryPercentage = 0; double IntermediatePercentage = 0; string message = ""; if ((Convert.ToInt16(SecondaryObtained.Text) <= Convert.ToInt16(TotalSecondary.Text)) && (Convert.ToInt16(ObtainedIntermediate.Text) <= Convert.ToInt16(TotalIntermediate.Text))) { IntermediatePercentage = (Convert.ToDouble(ObtainedIntermediate.Text) / Convert.ToDouble(TotalIntermediate.Text)) * 100; SecondaryPercentage = (Convert.ToDouble(SecondaryObtained.Text) / Convert.ToDouble(TotalSecondary.Text)) * 100; double SecondaryWeightage = 0.45; double IntermediateWeightage = 0.55; double TotalCutOff = (SecondaryWeightage * SecondaryPercentage) + (IntermediateWeightage * IntermediatePercentage); DBFunctions db = new DBFunctions(); Candidate_tbl temp = db.CheckExistingUsers(Usernametxt.Text); if (temp == null) { Candidate_tbl candidate = new Candidate_tbl { Name = Nametxt.Text, Username = Usernametxt.Text, HomeAdress = txtHomeaddress.Text, Stateoforigin = int.Parse(dropdownSto.SelectedValue), LocalGovtArea = int.Parse(dropdownLocalGovtarea.SelectedValue), Email = Emailtxt.Text, DateofBirth = dropdownDay.SelectedItem.Text + "-" + dropdownMonth.SelectedItem.Text + "-" + dropdownyears.SelectedItem.Text, Password = Passwordtxt.Text, Phone = Phonetxt.Text, Image = FileUpload.FileName, Gender = dropdownGender.SelectedValue, ProgrammeID = int.Parse(DropDownprogramme.SelectedValue), CuttoffPoints = TotalCutOff, Status = 0, AdmissionYear = DateTime.Now.Year.ToString() }; //// candidate is being stored in db here. MembershipCreateStatus createStatus = new MembershipCreateStatus(); MembershipUser newUser = System.Web.Security.Membership.CreateUser(Usernametxt.Text, Passwordtxt.Text, Emailtxt.Text, null, null, true, out createStatus); switch (createStatus) { case MembershipCreateStatus.Success: message = "The user account was successfully created!"; FormsAuthentication.SetAuthCookie(Usernametxt.Text, true); break; case MembershipCreateStatus.DuplicateUserName: message = "There already exists a user with this username."; break; case MembershipCreateStatus.DuplicateEmail: message = "There already exists a user with this email address."; break; case MembershipCreateStatus.InvalidEmail: message = "There email address you provided in invalid."; break; case MembershipCreateStatus.InvalidAnswer: message = "There security answer was invalid."; break; case MembershipCreateStatus.InvalidPassword: message = "The password you provided is invalid. It must be seven characters long and have at least one non-alphanumeric character."; break; default: message = "There was an unknown error; the user account was NOT created."; break; } db.AddCandidate(candidate); Response.Redirect("Login.aspx"); } else { LabelEmail.Text = "This email already exists, Please Login."; LabelEmail.Visible = true; } } else { CheckMarksSecondary.Text = "Please enter a valid value"; CheckMarksSecondary.Visible = true; } }
protected void btnlogin_Click(object sender, EventArgs e) { string returnuurl = ""; if (Request.QueryString["Redirecturl"] != null) { returnuurl = Request.QueryString["Redirecturl"]; Message.Visible = true; Message.Text = "Please Login First"; } DBFunctions db = new DBFunctions(); Candidate_tbl candidate = db.LoginChek(username.Text, password.Text); if (Membership.ValidateUser(username.Text, password.Text)) { FormsAuthentication.SetAuthCookie(username.Text, true); string UserID = ""; bool LoggedStatus = (System.Web.HttpContext.Current.User != null) && System.Web.HttpContext.Current.User.Identity.IsAuthenticated; if (System.Web.HttpContext.Current.User != null) { if (LoggedStatus) { if (Membership.GetUser() != null) { UserID = Membership.GetUser().ProviderUserKey.ToString(); Session["username"] = username.Text; Session["userid"] = UserID; Session["Name"] = candidate.Name; Session["Image"] = candidate.Image; Session["Role"] = "Student"; Session["email"] = candidate.Email; Session["candidate"] = candidate; if (returnuurl == "") { Response.Redirect("ProfilePage.aspx"); } else { Response.Redirect(returnuurl); } } } else { } } //if (candidate != null) //{ // if (candidate.Status == 1) // { // Session["username"] = username.Text; // Session["userid"] = UserID; // Session["Metricno"] = candidate.AddmissionList_tbl.FirstOrDefault().MetricNo; // Session["Name"] = candidate.Name; // Session["Image"] = candidate.Image; // Session["Role"] = "Student"; // Session["email"] = candidate.Email; // Session["candidate"] = candidate; // if (returnuurl == "") // Response.Redirect("ProfilePage.aspx"); // else // { // Response.Redirect(returnuurl); // } // } // else // { // Session["username"] = username.Text; // Session["userid"] = UserID; // Session["Role"] = "Student"; // if (returnuurl == "") // Response.Redirect("ProfilePage.aspx"); // else // { // Response.Redirect(returnuurl); // } // } //} } else { Message.Text = "Wrong Username or Password"; Message.Visible = true; } }
protected void btnRegister_Click(object sender, EventArgs e) { if (FileUpload.FileName!="") { FileUpload.SaveAs(Server.MapPath(UploadFolderPath + FileUpload.FileName)); } double SecondaryPercentage = 0; double IntermediatePercentage = 0; string message = ""; if ((Convert.ToInt16(SecondaryObtained.Text) <= Convert.ToInt16(TotalSecondary.Text))&&(Convert.ToInt16(ObtainedIntermediate.Text) <= Convert.ToInt16(TotalIntermediate.Text))) { IntermediatePercentage = (Convert.ToDouble(ObtainedIntermediate.Text) / Convert.ToDouble(TotalIntermediate.Text)) * 100; SecondaryPercentage = (Convert.ToDouble(SecondaryObtained.Text) / Convert.ToDouble(TotalSecondary.Text)) * 100; double SecondaryWeightage = 0.45; double IntermediateWeightage = 0.55; double TotalCutOff = (SecondaryWeightage * SecondaryPercentage) + (IntermediateWeightage * IntermediatePercentage); DBFunctions db = new DBFunctions(); Candidate_tbl temp = db.CheckExistingUsers(Usernametxt.Text); if (temp == null) { Candidate_tbl candidate = new Candidate_tbl { Name = Nametxt.Text, Username = Usernametxt.Text, HomeAdress = txtHomeaddress.Text, Stateoforigin = int.Parse(dropdownSto.SelectedValue), LocalGovtArea = int.Parse(dropdownLocalGovtarea.SelectedValue), Email = Emailtxt.Text, DateofBirth = dropdownDay.SelectedItem.Text + "-" + dropdownMonth.SelectedItem.Text + "-" + dropdownyears.SelectedItem.Text, Password = Passwordtxt.Text, Phone = Phonetxt.Text, Image = FileUpload.FileName, Gender = dropdownGender.SelectedValue, ProgrammeID = int.Parse(DropDownprogramme.SelectedValue), CuttoffPoints = TotalCutOff, Status = 0, AdmissionYear = DateTime.Now.Year.ToString() }; //// candidate is being stored in db here. MembershipCreateStatus createStatus = new MembershipCreateStatus(); MembershipUser newUser = System.Web.Security.Membership.CreateUser(Usernametxt.Text, Passwordtxt.Text, Emailtxt.Text, null, null, true, out createStatus); switch (createStatus) { case MembershipCreateStatus.Success: message = "The user account was successfully created!"; FormsAuthentication.SetAuthCookie(Usernametxt.Text,true); break; case MembershipCreateStatus.DuplicateUserName: message = "There already exists a user with this username."; break; case MembershipCreateStatus.DuplicateEmail: message = "There already exists a user with this email address."; break; case MembershipCreateStatus.InvalidEmail: message = "There email address you provided in invalid."; break; case MembershipCreateStatus.InvalidAnswer: message = "There security answer was invalid."; break; case MembershipCreateStatus.InvalidPassword: message = "The password you provided is invalid. It must be seven characters long and have at least one non-alphanumeric character."; break; default: message = "There was an unknown error; the user account was NOT created."; break; } db.AddCandidate(candidate); Response.Redirect("Login.aspx"); } else { LabelEmail.Text = "This email already exists, Please Login."; LabelEmail.Visible = true; } } else { CheckMarksSecondary.Text = "Please enter a valid value"; CheckMarksSecondary.Visible = true; } }