예제 #1
0
 public ActionResult edit(FullProfile fullprofile)
 {
     using (MsInUsEntities connection = new MsInUsEntities())
     {
         if (Session["UserName"] != null)
         {
             int         id = Convert.ToInt32(Session["UserId"]);
             FullProfile fp = connection.FullProfiles.Where(m => m.Id == id).FirstOrDefault();
             connection.FullProfiles.Remove(fp);
             connection.SaveChanges();
             if (fullprofile.Toefl == false)
             {
                 fullprofile.Ielts = true;
             }
             if (fullprofile.Toefl == null)
             {
                 fullprofile.Toefl = false; fullprofile.Ielts = false;
             }
             fullprofile.personalScore = getscore(fullprofile);
             connection.FullProfiles.Add(fullprofile);
             connection.SaveChanges();
         }
     }
     return(RedirectToAction("MyProfile", "Profiles"));
 }
예제 #2
0
 public ActionResult addUniversities(string university, string course, string status)
 {
     if (!string.IsNullOrEmpty(university))
     {
         int id     = Convert.ToInt32(university);
         int userid = Convert.ToInt32(Session["UserId"]);
         if ((!genConnection.AdmitsRejects.Any(m => (m.UnivId == id && m.CourseName == course && m.StudentId == userid)) && (genConnection.CourseWorks.Any(m => m.Course == course))))
         {
             AdmitsReject adr = new AdmitsReject();
             adr.CourseName  = course;
             adr.UnivId      = id;
             adr.Status      = status;
             adr.StudentId   = userid;
             adr.StudentName = Session["UserName"].ToString();
             adr.UnivName    = genConnection.Universities_list.FirstOrDefault(m => m.UnivId == id).UnivName;
             if (genConnection.CourseWorks.Any(m => m.Course == course))
             {
                 adr.CourseId = genConnection.CourseWorks.FirstOrDefault(m => m.Course == course).CourseId;
             }
             else
             {
                 adr.CourseId = 0;
             }
             genConnection.AdmitsRejects.Add(adr);
             genConnection.SaveChanges();
         }
     }
     return(RedirectToAction("Myprofile"));
 }
예제 #3
0
 public ActionResult add(FullProfile fullprofile)
 {
     using (MsInUsEntities connection = new MsInUsEntities())
     {
         try
         {
             if (Session["UserName"] != null)
             {
                 fullprofile.Id = Convert.ToInt32(Session["UserId"]);
                 if (fullprofile.Toefl == false)
                 {
                     fullprofile.Ielts = true;
                 }
                 else if (fullprofile.Toefl == null)
                 {
                     fullprofile.Toefl = false;
                 }
                 fullprofile.Ielts         = false;
                 fullprofile.personalScore = getscore(fullprofile);
                 connection.FullProfiles.Add(fullprofile);
                 connection.SaveChanges();
                 Session.Remove("AddProfile");
             }
         }
         catch (System.Data.Entity.Validation.DbEntityValidationException e)
         {
             string msg = e.InnerException.Message;
         }
     }
     return(RedirectToAction("Index", "Home"));
 }
예제 #4
0
 public ActionResult changepassword(UserProfile userprofile)
 {
     try
     {
         MsInUsEntities connection = new MsInUsEntities();
         int            id         = Convert.ToInt32(Session["UserId"]);
         UserProfile    usobj      = connection.UserProfiles.SingleOrDefault(m => m.Id == id);
         usobj.Password         = MyEncryption.EncodePasswordToBase64(userprofile.Password);
         usobj.ConfirmPassword  = MyEncryption.EncodePasswordToBase64(userprofile.ConfirmPassword);
         usobj.Email_IdRegister = usobj.Email_Id;
         connection.SaveChanges();
         TempData["ConfirmationMessage"] = "Password Changed Successfully!";
     }
     catch (System.Data.Entity.Validation.DbEntityValidationException e)
     {
         StreamWriter sw = new StreamWriter(@"D:\MasterStudy\MsInUsa\MsInUsa\Log\logs.txt", true);
         foreach (var c in e.EntityValidationErrors)
         {
             foreach (var ex in c.ValidationErrors)
             {
                 sw.WriteLine(ex.ErrorMessage);
             }
         }
         sw.Close();
         return(RedirectToAction("NotFound", "Error"));
     }
     return(RedirectToAction("changepassword", "Account"));
 }
예제 #5
0
 public ActionResult settings(UserProfile userprofile)
 {
     try
     {
         if (userprofile != null)
         {
             string dateobj = userprofile.DOBMonth + "/" + userprofile.DOBday + "/" + userprofile.DOBYear;
             userprofile.DOB = DateTime.Parse(dateobj);
             using (MsInUsEntities connection = new MsInUsEntities())
             {
                 var userprofileobj = connection.UserProfiles.Find(userprofile.Id);
                 userprofileobj.Email_IdRegister = userprofile.Email_Id;
                 userprofileobj.ConfirmPassword  = userprofile.Password;
                 connection.Entry(userprofileobj).CurrentValues.SetValues(userprofile);
                 connection.SaveChanges();
                 return(RedirectToAction("Myprofile", "Profiles"));
             }
         }
     }
     catch (System.Data.Entity.Validation.DbEntityValidationException e)
     {
         StreamWriter sw = new StreamWriter(@"D:\MasterStudy\MsInUsa\MsInUsa\Log\logs.txt", true);
         foreach (var c in e.EntityValidationErrors)
         {
             foreach (var ex in c.ValidationErrors)
             {
                 sw.WriteLine(ex.ErrorMessage);
             }
         }
         sw.Close();
         return(RedirectToAction("NotFound", "Error"));
     }
     return(View());
 }
예제 #6
0
 public ActionResult Register(UserProfile userprofile)
 {
     if (userprofile != null)
     {
         using (MsInUsEntities msInUsConnection = new MsInUsEntities())
         {
             int rowcount = msInUsConnection.UserProfiles.Count();
             userprofile.Password        = MyEncryption.EncodePasswordToBase64(userprofile.Password);
             userprofile.ConfirmPassword = MyEncryption.EncodePasswordToBase64(userprofile.ConfirmPassword);
             userprofile.Email_Id        = userprofile.Email_IdRegister;
             msInUsConnection.UserProfiles.Add(userprofile);
             msInUsConnection.SaveChanges();
             TempData["ConfirmationMessage"] = "Registered Successfully";
             //Session.Add("Registration Message", "Registered Successfully");
             if (rowcount < msInUsConnection.UserProfiles.Count())
             {
                 return(RedirectToAction("LogIn", "Account"));
             }
         }
     }
     return(RedirectToAction("NotFound", "Error"));
 }