Ejemplo n.º 1
0
        public ActionResult BasicInformation()
        {
            if (Session["UserId"] != null)
            {
                int        UserId    = Convert.ToInt32(Session["UserId"].ToString());
                UserDetail Userdata  = UserService.Get(UserId);
                DateTime?  dts       = Userdata.DOB;
                string     formatted = String.Format("{0:dd/MM/yyyy}", dts);
                ProfileBasicInformation BasicProfile = new ProfileBasicInformation()
                {
                    FirstName = Userdata.FirstName,
                    LastName  = Userdata.LastName,


                    DOB        = Userdata.DOB,
                    Salutation = SaluationService.GetSaluations(),
                    //States = StatecitydistrictService.GetAllStates(),
                    SalutationId   = Userdata.SalutationId,
                    GenderId       = Convert.ToInt32(Userdata.GenderId),
                    ProfilePicture = Userdata.ProfilePicture
                };
                return(View(BasicProfile));
            }
            return(RedirectToAction("Login", "Account"));
        }
Ejemplo n.º 2
0
        public ActionResult UserRegistration(RegistrationStep2ViewModel RegisterDTO, HttpPostedFileBase ProfilePicture)
        {
            try
            {
                string email = RegisterDTO.Email;
                var    user  = new ApplicationUser {
                    UserName = email, Email = email
                };
                var result = UserManager.Create(user, RegisterDTO.Password);
                if (result.Succeeded)
                {
                    var UserId = UserManager.FindByEmail(email);
                    Session["AspnetUserId"] = UserId.Id;
                    var fileName = Path.GetFileName(ProfilePicture.FileName);
                    var path     = Path.Combine(Server.MapPath("~/UserProfilePictures/" + fileName));
                    // model.ImageServerPath = path;
                    ProfilePicture.SaveAs(path);
                    var        FilePath    = "/UserProfilePictures/" + fileName;
                    UserDetail userDetails = new UserDetail();
                    TryUpdateModel(userDetails);
                    userDetails.AspnetUsersId = UserId.Id;
                    //error is supressed here , need to log this error.
                    userDetails.LivesInCityId         = 1;
                    userDetails.HomeCityId            = 1;
                    userDetails.ProfilePicture        = FilePath;
                    userDetails.UserStatus            = 0;
                    userDetails.DOB                   = DateTime.Parse(RegisterDTO.DateofBirth, new CultureInfo("en-CA"));
                    userDetails.ProfileInfoPercentage = (int)CustomStatus.ProfileInfoPercentage.BasicAndPersonal;
                    TempData["UserId"]                = UserService.Create(userDetails).Id;
                    Session["UserId"]                 = TempData["UserId"].ToString();
                    return(RedirectToAction("AlumniStep3"));
                }



                RegistrationStep2ViewModel UserDTO = new RegistrationStep2ViewModel()
                {
                    Email      = Session["EmailId"].ToString(),
                    Salutation = SaluationService.GetSaluations(),
                    //States = StatecitydistrictService.GetAllStates()
                };

                return(View(UserDTO));
            }
            catch (SystemException ex)
            {
                return(RedirectToAction("Register"));
            }
        }
Ejemplo n.º 3
0
        public ActionResult BasicInformation(ProfileBasicInformation RegisterDTO, HttpPostedFileBase ProfilePicture)
        {
            if (Session["UserId"] != null)
            {
                int UserId = Convert.ToInt32(Session["UserId"].ToString());

                var FilePath = "";
                if (ProfilePicture != null)
                {
                    var fileName = Path.GetFileName(ProfilePicture.FileName);
                    var path     = Path.Combine(Server.MapPath("~/UserProfilePictures/" + fileName));
                    // model.ImageServerPath = path;
                    ProfilePicture.SaveAs(path);
                    FilePath = "../UserProfilePictures/" + fileName;
                }

                UserDetail UpdateUserData = new UserDetail()
                {
                    FirstName      = RegisterDTO.FirstName,
                    LastName       = RegisterDTO.LastName,
                    SalutationId   = RegisterDTO.SalutationId,
                    GenderId       = RegisterDTO.GenderId,
                    DOB            = DateTime.Parse(RegisterDTO.DateofBirth, new CultureInfo("en-CA")),
                    ProfilePicture = FilePath
                };
                UserService.UpdateBasicInformation(UserId, UpdateUserData);
                TempData["Message"] = "Details updated successfully";
                return(RedirectToAction("BasicInformation", "AlumniProfileUpdate", new { area = "" }));
            }
            UserDetail Userdata = UserService.Get(Convert.ToInt32(Session["UserId"]));
            ProfileBasicInformation BasicProfile = new ProfileBasicInformation()
            {
                FirstName  = Userdata.FirstName,
                LastName   = Userdata.LastName,
                DOB        = Userdata.DOB,
                Salutation = SaluationService.GetSaluations(),
                //States = StatecitydistrictService.GetAllStates(),
                SalutationId   = Userdata.SalutationId,
                GenderId       = Convert.ToInt32(Userdata.GenderId),
                ProfilePicture = Userdata.ProfilePicture,
            };

            return(RedirectToAction("Login", "Account"));
        }
Ejemplo n.º 4
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            //var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();

            //if (loginInfo == null)
            //{
            //    return RedirectToAction("Login");
            //}

            //if (loginInfo.Login.LoginProvider == "Facebook")
            //{
            //    var identity = AuthenticationManager.GetExternalIdentity(DefaultAuthenticationTypes.ExternalCookie);
            //    var access_token = identity.FindFirstValue("FacebookAccessToken");
            //    var fb = new FacebookClient(access_token);
            //    dynamic myInfo = fb.Get("/me?fields=email"); // specify the email field
            //    loginInfo.Email = myInfo.email;
            //}


            var user = new ApplicationUser {
                UserName = model.Email, Email = model.Email
            };
            var CheckEmailId = UserManager.FindByEmail(model.Email);

            if (CheckEmailId != null)
            {
                TempData["ErrorMessage"] = "Email already exists Please click To login ..";
                return(RedirectToAction("Register"));
            }
            RegistrationStep2ViewModel UserDTO = new RegistrationStep2ViewModel()
            {
                Salutation = SaluationService.GetSaluations(),
                //States = StatecitydistrictService.GetAllStates(),
                Email = model.Email
            };

            //TempData["EmailId"] = model.Email;
            Session["EmailId"] = model.Email;
            return(RedirectToAction("UserRegistration"));
        }
Ejemplo n.º 5
0
        public ActionResult UserRegistration()
        {
            try
            {
                if (Session["ExternalLogin"] != null)
                {
                    var user = new ApplicationUser {
                        UserName = Session["EmailId"].ToString(), Email = Session["EmailId"].ToString()
                    };
                    var CheckEmailId = UserManager.FindByEmail(Session["EmailId"].ToString());
                    if (CheckEmailId != null)
                    {
                        int?       ProfileStatus = UserService.GetUserProfileStatusonUserId(Session["EmailId"].ToString());
                        var        userid        = UserManager.FindByEmail(Session["EmailId"].ToString());
                        UserDetail detailsusers  = UserService.GetUser(userid.Id);
                        int?       userStatus    = 0;
                        if (detailsusers != null)
                        {
                            userStatus        = UserService.GetUser(userid.Id).UserStatus;
                            Session["UserId"] = detailsusers.Id;
                        }

                        if (userStatus != 1)
                        {
                            Session["AspnetUserId"] = userid.Id;
                            Session["UserId"]       = detailsusers.Id;
                            if (detailsusers != null)
                            {
                                Session["UserId"] = detailsusers.Id;
                            }
                            else
                            {
                            }
                            if (ProfileStatus == 2)
                            {
                                return(RedirectToAction("Step3Registration"));
                            }
                            else if (ProfileStatus == 3)
                            {
                                return(RedirectToAction("ContactInformation"));
                            }
                            else if (ProfileStatus == 4)
                            {
                                return(RedirectToAction("ProfessionalDetails"));
                            }
                            else if (ProfileStatus == 5)
                            {
                                return(RedirectToAction("ProfileCompleted", "Home"));
                            }
                        }
                        else
                        {
                            return(RedirectToAction("Index", "WhiteBoard", new { Area = "Alumini" }));
                        }
                    }
                }
                RegistrationStep2ViewModel UserDTO = new RegistrationStep2ViewModel()
                {
                    Salutation = SaluationService.GetSaluations(),
                    //States = StatecitydistrictService.GetAllStates(),
                    Email = Session["EmailId"].ToString()
                };

                return(View(UserDTO));
            }
            catch (SystemException ex)
            {
                return(RedirectToAction("Register"));
            }
        }