예제 #1
0
 public override void DataBind()
 {
     Kingdom k = new KingdomService().GetInfo();
     LblKingdomArmy.Text = k.KingdomArmy.ToString();
     LblKingdomResources.Text = k.KingdomResources.ToString();
     LblKingdomSize.Text = k.KingdomSize.ToString();
     base.DataBind();
 }
예제 #2
0
    protected void RegistrationWizard_CreatedUser(object sender, EventArgs e)
    {
        TextBox TxtKingdom = RegistrationWizard.WizardSteps[0].Controls[0].FindControl("TxtKingdom") as TextBox;
        DropDownList DdlMap = RegistrationWizard.WizardSteps[0].Controls[0].FindControl("DdlMapList") as DropDownList;

        string userName = RegistrationWizard.UserName;
        string emailAddress = RegistrationWizard.Email;

        //// Lets get the user's id
        MembershipUser user = Membership.GetUser(userName);
        Guid userId = (Guid)user.ProviderUserKey;

        //// Now lets create an email message
        StringBuilder emailMessage = new StringBuilder();
        emailMessage.Append("Dziękujemy za stworzenie konta w serwisie seppuku.pl");
        emailMessage.Append("<br />");
        string appBaseUrl = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + '/';
        emailMessage.Append(string.Format("Kliknij <a href='" + appBaseUrl + "ActivateUser.aspx?userName={0}&Id={1}'> tutaj </a> aby dokończyć proces rejestracji.",
            userName, userId.ToString()));

        MailMessage email = new MailMessage();
        email.From = new MailAddress("*****@*****.**");
        email.To.Add(new MailAddress(emailAddress));
        email.Subject = "Prośba o aktywację konta w seppuku.pl";
        email.Body = emailMessage.ToString();
        email.IsBodyHtml = true;

        string KingdomName = TxtKingdom.Text;
        int MapId = Int32.Parse(DdlMap.SelectedValue);
        User u = new UserService().GetByEmail(user.Email);

        Kingdom kingdom = new Kingdom()
        {
            KingdomName = KingdomName,
            MapId = MapId,
            KingdomResources = 500,
            UserId = u.UserId
        };

        int kingdomId = new KingdomService().Add(kingdom);
        new MapService().InitializeKingdom(MapId, kingdomId);
        // Send the email
        SmtpClient client = new SmtpClient();
        //client.Send(email);


    }