public ActionResult EmailChange(string OldEmail, string NewEmail) { if (User.Identity.IsAuthenticated) // if (User.Identity.Name == "admin") { if (OldEmail != null && OldEmail != "" && NewEmail != null && NewEmail != "") { jntuh_registration registrationEmail = db.jntuh_registration.Where(f => f.Email == OldEmail).FirstOrDefault(); jntuh_ffc_auditor auditoremail = db.jntuh_ffc_auditor.Where(f => f.auditorEmail1 == OldEmail).FirstOrDefault(); if (registrationEmail != null && auditoremail != null) { registrationEmail.Email = NewEmail; registrationEmail.UpdateOn = DateTime.Now; registrationEmail.Updatedby = 1; db.Entry(registrationEmail).State = EntityState.Modified; db.SaveChanges(); auditoremail.auditorEmail1 = NewEmail; auditoremail.updatedOn = DateTime.Now; auditoremail.updatedBy = 1; db.Entry(auditoremail).State = EntityState.Modified; db.SaveChanges(); TempData["Success"] = "Email Address Updated Successfully."; return(RedirectToAction("EmailChange", "Home")); //return View(); } else { TempData["Error"] = "Current Email Address Does not Exist"; return(View()); } } return(View()); } else { FormsAuthentication.SignOut(); return(RedirectToAction("Login", "Admin")); } }
public ActionResult Edit([Bind(Include = "ID,Name,Cell,Email,Father_name,Mother_name,Adress,Course_id,Batch_id,Result")] tblStudent_info tblStudent_info) { if (ModelState.IsValid) { db.Entry(tblStudent_info).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Batch_id = new SelectList(db.tblBatches, "ID", "Name", tblStudent_info.Batch_id); ViewBag.Course_id = new SelectList(db.tblCourses, "ID", "Name", tblStudent_info.Course_id); return(View(tblStudent_info)); }
public ActionResult PrincipalNomineeDataEntry(List <ScmUploadedData> scmdata, HttpPostedFileBase SCMHardcopy, string Remarks) { List <ScmUploadedData> scmcheckeddata = scmdata.ToList(); int collegeId = 0; int SCMId = 0; if (scmcheckeddata.Count() != 0 && User.Identity.Name != null && SCMHardcopy != null) { collegeId = scmcheckeddata[0].CollegeId; var emailId = db.jntuh_registration.Where(e => e.Email == User.Identity.Name).Select(e => e.Email).FirstOrDefault(); int userId = db.jntuh_ffc_auditor.Where(e => e.isActive == true && e.auditorEmail1 == emailId && e.auditorDepartmentID == 60).Select(e => e.id).FirstOrDefault(); if (userId != 0) { var fileName = string.Empty; var filepath = string.Empty; var collegescmrequests = new jntuh_scmproceedingsrequests(); const string scmnotificationpath = "~/Content/Upload/SCMPROCEEDINGSREQUEST/UploadSCMHardCopy"; if (SCMHardcopy != null) { if (!Directory.Exists(Server.MapPath(scmnotificationpath))) { Directory.CreateDirectory(Server.MapPath(scmnotificationpath)); } var ext = Path.GetExtension(SCMHardcopy.FileName); if (ext != null) { var scmfileName = scmcheckeddata[0].CollegeId + "_" + "UploadSCMHardCopyForPrincipal" + "_" + DateTime.Now.ToString("yyyMMddHHmmss"); SCMHardcopy.SaveAs(string.Format("{0}/{1}{2}", Server.MapPath(scmnotificationpath), scmfileName, ext)); fileName = scmfileName + ext; } } foreach (var item in scmcheckeddata) { if (item != null) { jntuh_auditors_dataentry dataentry = new jntuh_auditors_dataentry(); dataentry.CollegeId = item.CollegeId; dataentry.SpecializationId = 0; dataentry.DepartmentId = 0; dataentry.DegreeId = 0; dataentry.DesignationId = 0; dataentry.RegistrationNo = item.RegistrationNumber; dataentry.AuditorId = userId; dataentry.IsSelected = item.Checked; dataentry.IsActive = true; dataentry.NomineeRemarks = Remarks; dataentry.CreatedBy = userId; dataentry.CreatedOn = DateTime.Now; dataentry.SCMhardcopy = fileName; dataentry.ScmProceedingId = item.SCMId; SCMId = item.SCMId; db.jntuh_auditors_dataentry.Add(dataentry); } } TempData["Success"] = "Information Saved Successfully"; db.SaveChanges(); var AuditorAssignedData = db.jntuh_auditor_assigned.Where(e => e.AuditorId == userId && e.ScmId == SCMId).Select(e => e).FirstOrDefault(); if (AuditorAssignedData != null) { AuditorAssignedData.RequestSubmittedDate = DateTime.Now; AuditorAssignedData.UpdatedBy = userId; AuditorAssignedData.UpdatedOn = DateTime.Now; db.Entry(AuditorAssignedData).State = EntityState.Modified; db.SaveChanges(); } // return RedirectToAction("PrincipalNomineeDataEntry", "User", new { collegeId = collegeId }); return(RedirectToAction("ApprovedFacultyBasedOnNominee", "Admin", new { SCMId = SCMId })); } } return(View()); }