コード例 #1
0
ファイル: Default.aspx.cs プロジェクト: anthrax3/ranktrend
    protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
    {
        Database db = Global.GetDbConnection();

        // Set user's approval to false so that it is "pending"
        MembershipUser membershipUser = Membership.GetUser(CreateUserWizard1.UserName);

        membershipUser.IsApproved = false;
        Membership.UpdateUser(membershipUser);

        // Save user's extended information to the database
        var userInformation = new UserInformation();

        userInformation.UserId    = membershipUser.ProviderUserKey;
        userInformation.FirstName = ((TextBox)CreateUserWizardStep3.ContentTemplateContainer.FindControl("FirstName")).Text;
        userInformation.LastName  = ((TextBox)CreateUserWizardStep3.ContentTemplateContainer.FindControl("LastName")).Text;
        userInformation.LeadKey   = getLeadKey();
        db.ORManager.Save(userInformation);

        // Save user's agreement to the TOS
        LegalNoticeVersion termsOfService = db.GetLatestLegalNoticeVersion(GlobalSettings.SignUpTermsOfService);
        var tosAgreement = new LegalNoticeAgreement(termsOfService, membershipUser, true);

        db.SaveLegalNoticeAgreement(tosAgreement);

        // Update the user for the promotion participant if the user participated in a promotion
        int?signupPromoParticipantId = getSignupPromotionParticipantId();

        if (signupPromoParticipantId != null)
        {
            var promoParticipant = db.ORManager.Get <PromotionParticipant>(signupPromoParticipantId);

            // Make sure that the promotion participant isn't already assigned to another user
            if (promoParticipant.UserId == null)
            {
                promoParticipant.UserId = (Guid?)membershipUser.ProviderUserKey;
                db.ORManager.SaveOrUpdate(promoParticipant);
            }

            // Delete the promotion cookie
            HttpCookie cookie = Request.Cookies[COOKIE_PROMO_PARTICIPANT];
            if (cookie != null)
            {
                cookie.Expires = DateTime.Now.AddYears(-1);
                Response.SetCookie(cookie);
            }
        }

        // Save Verify User Email to email queue
        EmailTemplate emailTemplate = db.GetEmailTemplate(GlobalSettings.VerifyUserEmail);
        var           emailMessage  = new EmailMessage(emailTemplate);

        emailMessage.From = GlobalSettings.AdministrativeEmail;
        emailMessage.ApplyToUser(membershipUser, userInformation);
        db.SaveEmail(emailMessage);

        ThreadPool.QueueUserWorkItem(forceEmailEngineRun, membershipUser);

        Response.Redirect("Sign-Up-Complete.aspx");
    }
コード例 #2
0
    private void setAgreement(bool agree)
    {
        Database           db          = Global.GetDbConnection();
        LegalNoticeVersion legalNotice = db.GetLatestLegalNoticeVersion((int)GlobalSettings.TrayApplicationLicenseAgreement);
        var agreement = new LegalNoticeAgreement(legalNotice, Membership.GetUser(), agree);

        db.SaveLegalNoticeAgreement(agreement);
    }
コード例 #3
0
ファイル: Default.aspx.cs プロジェクト: anthrax3/ranktrend
    private void saveTosAgreement()
    {
        Database       db             = Global.GetDbConnection();
        MembershipUser membershipUser = Membership.GetUser();

        // Save user's agreement to the TOS
        LegalNoticeVersion termsOfService = db.GetLatestLegalNoticeVersion(GlobalSettings.SignUpTermsOfService);
        var tosAgreement = new LegalNoticeAgreement(termsOfService, membershipUser, true);

        db.SaveLegalNoticeAgreement(tosAgreement);
    }
コード例 #4
0
ファイル: Database.cs プロジェクト: anthrax3/ranktrend
        public void SaveLegalNoticeAgreement(LegalNoticeAgreement agreement)
        {
            SqlCommand cmd;

            cmd = _dbConn.GetStoredProcedureCommand("Legal_SaveNoticeAgreement");
            cmd.Parameters.AddWithValue("@NoticeVersionId", agreement.LegalNoticeVersionId);
            cmd.Parameters.AddWithValue("@UserId", agreement.UserId);
            cmd.Parameters.AddWithValue("@Agree", agreement.Agree);

            _dbConn.ExecuteNonQuery(cmd);
        }
コード例 #5
0
ファイル: Database.cs プロジェクト: anthrax3/ranktrend
        public bool HasAgreedToNotice(int legalNoticeVersionId, object userId)
        {
            SqlCommand           cmd;
            DataSet              ds;
            LegalNoticeAgreement agreement;

            cmd = _dbConn.GetStoredProcedureCommand("Legal_GetNoticeAgreement");
            cmd.Parameters.AddWithValue("@NoticeVersionId", legalNoticeVersionId);
            cmd.Parameters.AddWithValue("@UserId", userId);

            ds = _dbConn.GetDataSet(cmd);

            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
            {
                return(false);
            }
            else
            {
                agreement = new LegalNoticeAgreement();
                DataMapper.PopulateObject(agreement, ds, null, null);
                return(agreement.Agree);
            }
        }