extending UserObject with new fields
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Microsoft Commerce Server > Commerce Server General > extending UserObject with new fields




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    extending UserObject with new fields  
Jason


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-21-04 09:36 PM

I have extended the User Profile by adding several fields to the database,
and creating new data objects and new profile definitions in the Commerce
Server Manager.  I have also created a custom user registration page that
uses those new fields.  I am attempting to make use of the "UserObject"
class on my site to register users.  This class is part of the
"Microsoft.Solutions.Framework" package.  This class allows you to set
properties for all the default user profile values and than call a "save()"
method to write everything to the database.  However, this class obviously
does not know about my new fields.  Is there a way to extend the UserObject
so that I can continue using it in the same way with my new fields?  An
example of where this class is used is in the MSIB Adventure Works sample
site.  Thank you.







[ Post a follow-up to this message ]



    RE: extending UserObject with new fields  
Telmo Brito


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-23-04 03:46 PM

Hi Jason,

I had the same problem, added new fields to the userobject, etc... The save(
) method does know of these new fields because the Microsoft.Solutions.Frame
work was coded only for these default fields of the Adventure works site.

What I did was instead of calling SetProfileProperties(userprofile) I commen
ted this line and added the following code below:

AuthenticationInfo authInfo = CommerceContext.Current.AuthenticationInfo;
ProfileContext profContext = CommerceContext.Current.ProfileSystem;
Profile userprof;

userprof = profContext.CreateProfile(this.LogonName, "UserObject");

userprof.Properties["GeneralInfo.logon_name"].Value = this.LogonName;
userprof.Properties["GeneralInfo.user_security_password"].Value = this.P
assword;
userprof.Properties["AccountInfo.org_id"].Value = sOrgID;
userprof.Properties["GeneralInfo.first_name"].Value = this.FirstName;
userprof.Properties["GeneralInfo.last_name"].Value = this.LastName;
userprof.Properties["GeneralInfo.email_address"].Value = this.EmailAddre
ss;
userprof.Properties["AccountInfo.account_status"].Value = 1;
userprof.Properties["AccountInfo.date_registered"].Value = DateTime.Now;
userprof.Properties["GeneralInfo.u_Cargo"].Value = CargoTextBox.Text; //
/ New fields that where added to the userobject
userprof.Properties["GeneralInfo.u_Departament"].Value = DepartamentText
Box.Text; /// New fields that where added to the userobject
userprof.Properties["GeneralInfo.user_title"].Value = TitleTextBox.Text;
userprof.Properties["GeneralInfo.tel_number"].Value = this.PhoneNumber;
userprof.Properties["GeneralInfo.fax_number"].Value = this.FaxNumber;
userprof.Properties["GeneralInfo.user_id_changed_by"].Value = Request.Se
rverVariables[ "AUTH_USER" ];
userprof.Properties["GeneralInfo.user_type"].Value = 1;
userprof.Properties["BusinessDesk.partner_desk_role"].Value = 1;
userprof.Update();

And instead of using save() you use update()

Hope this helps.





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:32 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register