Exemplo n.º 1
0
    protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
    {
        Roles.AddUserToRole(CreateUserWizard1.UserName, "Company");
        MembershipUser user = Membership.GetUser(CreateUserWizard1.UserName);// We must provide username, Get User doesnt work right here
        Guid userID = (Guid) user.ProviderUserKey;

        TextBox tbCompany = (TextBox) CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("tbCompany");
        string company = tbCompany.Text;
        string cuser = company + " Manager";
        System.Decimal DealRate = 20;

        GoDine a = new GoDine();
        a.CreateCompanyToUserID(company, userID, DealRate, 0);
        a.CreateCUserToCompany(cuser, company, 0);

        //// SENDING EMAIL
        string subject = "Welcome to AroundTown";
        string body = GoDineEmails.PrepareMailBodyWith("newcompany.htm", "%name%", CreateUserWizard1.UserName, "%company%", company, "%cuser%", cuser, "%SALELINK%", HOST_URL + "/BuyGiftCard.aspx?Company=" + userID);
        GoDineEmails.SendMail(CreateUserWizard1.UserName, subject, body);

        //PUT THIS BACK IF WE DONT WANT USERS TO CLICK "SUCCESS"
        //Response.Redirect("Redirect.aspx");
    }