Exemplo n.º 1
0
// Method for creating user profile at signup.

    public void SignUpUser(string email, string firstName, string lastName)
    {
        if (_userName == "maestro")
        {
            Roles.AddUserToRole(_userName, "Managers");
        }

        using (CreditMaestroEntities myEnt = new CreditMaestroEntities())
        {
            var newEntry = new ProfileProperty();
            newEntry.EMail     = email;
            newEntry.UserId    = _userId;
            newEntry.UserName  = _userName;
            newEntry.FirstName = firstName;
            newEntry.LastName  = lastName;

            newEntry.BookActivated = true;
            Roles.AddUserToRole(_userName, "BookValidatedUsers");


            myEnt.AddToProfileProperties(newEntry);
            myEnt.SaveChanges();

            EmailUsersClass sndEmail = new EmailUsersClass("veswap");
            string          body     = sndEmail.PopulateBody(firstName, "Thanks for signing up! Your account is active. Please " +
                                                             "feel free to contact us at [email protected] with any questions or concerns. Thanks again!");

            sndEmail.SendHtmlFormattedEmail(email, "New message from creditscoremaestro.com customer care.", body);
        }
    }
Exemplo n.º 2
0
    protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
    {
        TextBox firstName              = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("FirstName");
        TextBox lastName               = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("LastName");
        Label   firstNameValid         = (Label)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("FirstNameValid");
        TextBox userName               = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName");
        TextBox eMail                  = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Email");
        Label   emailValidBox          = (Label)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("EmailValidBox");
        RegularExpressionValidator reg = (RegularExpressionValidator)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("RegEx");

        reg.Validate();
        bool myBool = true;

        emailValidBox.CssClass = "validbox";

        if (reg.IsValid == false & myBool == true & eMail.Text != "")
        {
            myBool   = false;
            e.Cancel = true;
            emailValidBox.CssClass = "validboxviz";
        }

        using (CreditMaestroEntities ent = new CreditMaestroEntities())
        {
            var checkEmail = ent.aspnet_Membership.Where(u => u.Email.Equals(eMail.Text)).SingleOrDefault();
            if (checkEmail != null)
            {
                myBool   = false;
                e.Cancel = true;
                DuplicateEmailPanel.Visible = true;
            }
        }
    }
Exemplo n.º 3
0
// Constructor and properties.

    public UserClass(string userName)
    {
        _userName = userName;

        using (CreditMaestroEntities ent = new CreditMaestroEntities())
        {
            var getId = (from tbl in ent.aspnet_Users
                         where tbl.UserName == userName
                         select tbl.UserId).SingleOrDefault();

            var getEmail = (from tbl in ent.aspnet_Membership
                            where tbl.UserId == getId
                            select tbl.Email).SingleOrDefault();

            _userId = getId;
            _email  = getEmail;

            var getProfile = (from tbl in ent.ProfileProperties
                              where tbl.UserId == _userId
                              select tbl).SingleOrDefault();

            if (getProfile != null)
            {
                _firstName = getProfile.FirstName;
            }
        }
    }