using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.SqlServer.NotificationServices;

public partial class RegisterNewUser : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
	protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
	{		
		// Add a subscriber record and a default subscriber device.
		NSInstance nsInstance = new NSInstance("MusicStore");
		Subscriber subscriber = new Subscriber(nsInstance);
		subscriber.SubscriberId = CreateUserWizard1.UserName;
		subscriber.Enabled = true;

		subscriber.Add();

		SubscriberDevice device = new SubscriberDevice(nsInstance);
		device.SubscriberId = subscriber.SubscriberId;
		device.DeviceName = "DefaultDevice";
		
		// Email Delivery Protocol
		device.DeviceTypeName = "Email";
		device.DeviceAddress = CreateUserWizard1.Email;
		device.DeliveryChannelName = "SMTPChannel";
		
		device.Add();		
	}
}
