Thursday, September 13, 2007

Profile System

Well one of the intresting topic in Commerce is the Profile System. I believe that you know of a asp.net Membership scenerio. Well in Blogs a UserProfile if logged in is stored in the CommerceContext.Current.UserProfile
Now, in this blog I will explain the process of registration.

Firstly we provide a UserId. In my case i am using a asp.net User registration Wizard
// Set new user id. CommerceContext.Current.UserID = ((Guid)Membership.GetUser(UserRegWizard.UserName).ProviderUserKey).ToString();


Then we set the Commerce Profile :
commerceProfile.Profile currUserProfile = objUpmProfileProvider.GetCommerceProfile("GeneralInfo.email_address", TbxUserEmail.Text.Trim(), "UserObject");

Commerce has inbuilt Properties, you can make new properties using the Commerce Manager.

I will explain this in detail in another blog.


So Now we can set various properties of the commerce like
currUserProfile["GeneralInfo.first_name"].Value = userFirstName.Text.Trim();
After Setting the Properties to store it we do.
currUserProfile.Update();
Hence we just created a new user.
Hope the post is helpfull.

No comments: