Exemplo n.º 1
0
        /// <summary>
        /// The update students table with updated profile data from register model.
        /// </summary>
        /// <param name="profile">
        /// The model.
        /// </param>
        /// <param name="isStudent">
        /// The is student.
        /// </param>
        private void UpdateStudentsTableWithUpdatedProfileDataFromRegisterModel(CustomProfile profile, Student isStudent)
        {
            isStudent.LastName = profile.LastName;
            isStudent.FirstMidName = profile.FirstMidName;
            isStudent.StreetAddress = profile.StreetAddress;
            isStudent.City = profile.City;
            isStudent.State = profile.State;
            isStudent.ZipCode = profile.ZipCode;
            isStudent.Phone = profile.Phone;
            isStudent.DateOfBirth = profile.DateOfBirth;
            isStudent.ParishAffiliation = profile.ParishAffiliation;
            isStudent.MinistryInvolvement = profile.MinistryInvolvement;
            MembershipUser u = Membership.GetUser(User.Identity.Name);

            // needed to get email for isStudent.Email = u.Email;
            if (u != null)
            {
                isStudent.Email = u.Email;
            }

            db.SaveChanges();
        }
Exemplo n.º 2
0
        /// <summary>
        /// The set default state of user.
        /// </summary>
        /// <param name="model">
        /// The model.
        /// </param>
        /// <param name="profile">
        /// The profile.
        /// </param>
        private static void SetDefaultStateOfUser(RegisterModel model, CustomProfile profile)
        {
            profile.IsTeacher = "no";
            profile.FilledStudentInfo = "no";
            profile.Save();
            Roles.AddUserToRole(model.UserName, "Default");

            // Adds student to the "Default" role so we can force them to become a "Student" role.
        }
Exemplo n.º 3
0
 /// <summary>
 /// The create student table data with new profile data and assign student role.
 /// </summary>
 /// <param name="profile">
 /// The model.
 /// </param>
 /// <param name="user">
 /// The user.
 ///  </param>
 private void CreateStudentTableDataWithNewProfileDataAndAssignStudentRole(CustomProfile profile,
                                                                           MembershipUser user)
 {
     var newStudent = new Student
         {
             LastName = profile.LastName,
             FirstMidName = profile.FirstMidName,
             Email = user.Email,
             UserName = profile.UserName,
             EnrollmentDate = DateTime.Now,
             StreetAddress = profile.StreetAddress,
             City = profile.City,
             State = profile.State,
             ZipCode = profile.ZipCode,
             Phone = profile.Phone,
             DateOfBirth = profile.DateOfBirth,
             ParishAffiliation = profile.ParishAffiliation,
             MinistryInvolvement = profile.MinistryInvolvement
         };
     db.Students.Add(newStudent);
     db.SaveChanges();
     if (!User.IsInRole("Student"))
     {
         Roles.AddUserToRole(profile.UserName, "Student");
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// The save new profile.
 /// </summary>
 /// <param name="model">
 /// The model.
 /// </param>
 /// <param name="profile">
 /// The profile.
 /// </param>
 private static void SaveNewProfile(RegisterModel model, CustomProfile profile)
 {
     profile.LastName = model.LastName;
     profile.FirstMidName = model.FirstMidName;
     profile.StreetAddress = model.StreetAddress;
     profile.City = model.City;
     profile.State = model.State;
     profile.ZipCode = model.ZipCode;
     profile.Phone = model.Phone;
     profile.DateOfBirth = model.DateOfBirth;
     profile.ParishAffiliation = model.ParishAffiliation;
     profile.MinistryInvolvement = model.MinistryInvolvement;
     profile.Save();
 }