public static ForgotPasswordInfo ForgotPassword(string email)
        {
            User           users = UserAuthentication.GetUserByEmailId(email);
            ForgotPassword forgotPassword;

            ForgotPasswordInfo forgotPasswordInfo = new ForgotPasswordInfo();

            if (users == null)
            {
                forgotPasswordInfo.Success  = false;
                forgotPasswordInfo.ErrorMsg = "Email address entered by you is not registered with us. Please enter the valid email address which you use for login.";
                return(forgotPasswordInfo);
            }

            UserAuthentication.SaveForgotPassword(users);
            forgotPassword                      = UserAuthentication.GetForgotPasswordByUserID(users.UserId);
            forgotPasswordInfo.Success          = true;
            forgotPasswordInfo.ForgotPasswordId = forgotPassword.ForgotPasswordId;

            StringBuilder emailBody = new StringBuilder(ConstructMail.GetMailBody(Constant.FORGOT_PASSWORD));

            emailBody = emailBody.Replace(Constant.CONST_USERNAME, users.FirstName).Replace(Constant.CONST_FORGOTLINK, forgotPassword.ForgotPasswordId.ToString());
            emailBody = emailBody.Replace(Constant.CONST_FIRSTNAME, users.FirstName);
            emailBody = emailBody.Replace(Constant.CONST_LASTNAME, users.LastName);
            if (!SendMail.Sendmail(email, Constant.CONST_RESETPASSWORD_SUBJECT, emailBody.ToString()))
            {
                forgotPasswordInfo.Success  = false;
                forgotPasswordInfo.ErrorMsg = "Error occurred while sending email. Please try again.";
                return(forgotPasswordInfo);
            }

            return(forgotPasswordInfo);
        }
        public static LoginResult SignupUserWithLinkedIn(string FirstName, string MiddleName, string LastName, string EmailAddress, int accountRefId)
        {
            LoginResult loginResult = new LoginResult();

            loginResult.Success = false;
            try
            {
                User users = UserAuthentication.GetUserByEmailId(EmailAddress);
                if (users == null)
                {
                    User user = new User();
                    user.FirstName  = FirstName.Trim();
                    user.MiddleName = MiddleName.Trim();
                    user.LastName   = LastName.Trim();
                    user.Email      = EmailAddress.Trim();
                    string Password = (Guid.NewGuid().ToString()).Substring(0, 8);
                    user.Password = EncryptionHelper.Encryptdata(Password);
                    //user.StateId = 1;
                    user.SecQuestionId = 1;
                    user.AccountRefId  = accountRefId;
                    user.CreatedDate   = DateTime.Now;
                    user.IsActive      = true;
                    user.UserType      = (int)UserTypeEnum.ADMIN;

                    Repository <User> userRep = new Repository <User>();
                    userRep.Add(user);
                    userRep.Save();

                    users = UserAuthentication.GetUserByEmailId(EmailAddress);
                    SessionWrapper.LoggedUser = users;
                    loginResult.Success       = true;
                }
                else
                {
                    if (users.AccountRefId == accountRefId)
                    {
                        SessionWrapper.LoggedUser = users;
                        loginResult.Success       = true;
                    }
                }
            }
            catch { }

            return(loginResult);
        }