Advertisement
Advertisement
| 04.20.2008 at 02:01AM PDT, ID: 23337502 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: |
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Profile;
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.Practices.EnterpriseLibrary.Data;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using SubSonic;
using SubSonic.Sugar;
using HVT.Common.Objects;
using HVT.Common.BusinessLogic;
using HVT.Common.Util;
using System.Web.Mail;
using System.Net;
using System.IO;
namespace ConsoleAppMigrate
{
class Program
{
static void Main(string[] args)
{
MirgrateCustomerCollection cdata = new MirgrateCustomerCollection().Load();
foreach (MirgrateCustomer cust in cdata)
{
// Create new user
MembershipCreateStatus status;
string question = "What is your favorite color";
string answer = "Blue";
bool isApproved = true;
Membership.CreateUser(cust.EmailAddress, cust.Password, cust.EmailAddress, question, answer, isApproved, out status);
if (status == MembershipCreateStatus.Success)
{
//Add user to the Customer role
Roles.AddUserToRole(cust.EmailAddress, "Customer");
MembershipUser myObject = Membership.GetUser(cust.EmailAddress);
// New User Created.
// Get Their Profile
Profile newProfile = System.Web.Profile.GetProfile(myObject.UserName);
// Update Their Profile
newProfile.Address = cust.StreetAddress;
newProfile.City = cust.City;
newProfile.Country = cust.Country;
newProfile.Email = cust.EmailAddress;
newProfile.FirstName = cust.FirstName;
newProfile.LastName = cust.LastName;
newProfile.Phone = cust.Phone;
newProfile.PostalCode = cust.ZipCode;
newProfile.State = cust.State;
newProfile.Save();
}
}
}
}
}
|