1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Extending Sitefinity-User with ERP-Data

Extending Sitefinity-User with ERP-Data

2 posts, 0 answered
  1. Dave
    Dave avatar
    37 posts
    Registered:
    26 Dec 2008
    20 Jan 2009
    Link to this post
    Hello!

    I'm checking right now, if Sitefinity could be the right choice for our needs and have one question related to Users in Sitefinity.

    For our current CMS I've developed a shop in c# where the Users of the CMS are linked to the relating data in our ERP (Microsoft Dynamics Nav). To deal with the data in the shop I've extended the CMS-User with an extra-field which contains the unique number from Nav and various functions to attach the Nav-User-Data to the CMS-user.

    Has anyone experiences extending the Users in Sitefinity. Perhaps working with Nav-Data or another ERP-System and can give me a hint if it's practicable without difficulty.

    Thanks in advance for Your help.

    Dieter

  2. Parvan
    Parvan avatar
    151 posts
    Registered:
    24 Sep 2012
    23 Jan 2009
    Link to this post
    Hi Dieter,

    Thank you for contacting us.

    Adding a new field to the User Profile is possible out of the box. Here is an example of adding such a field:
    web.config:

    <profile defaultProvider="Sitefinity">    
        <providers>    
            <clear />    
            <add name="Sitefinity" connectionStringName="DefaultConnection" applicationName="/" type="Telerik.DataAccess.AspnetProviders.TelerikProfileProvider, Telerik.DataAccess" />    
          </providers>    
        <properties>    
            <add name="FirstName" />    
            <add name="LastName" />    
            <!--ADD NEW NAME HERE-->    
            <add name="ExampleField" type="System.String"/>    
      


    If you want to show this filed in the administration side, you should add a control with the same ID (as the name of the field added in the web.config) in [YourProject]\Sitefinity\Admin\CmsAdmin\Users.aspx
    :

    <asp:Literal ID="Literal6" runat="server" Text="<%Resources:UserDetails%" /></h3>    
        <fieldset class="userinfo set">    
            <cc1:ManageProfile ID="manageProfile" runat="server" Mode="Insert">    
                <InsertTemplate>    
                    <ol class="setIn">    
                        <li>    
                            <cc2:FieldLabel ID="lblFirstName" runat="server" Text="First name" TargetID="FirstName">    
                            </cc2:FieldLabel>    
                            <asp:TextBox ID="FirstName" runat="server"></asp:TextBox></li>    
                        <li>    
                            <cc2:FieldLabel ID="lblLastName" runat="server" Text="Last name" TargetID="LastName">    
                           </cc2:FieldLabel>    
                            <asp:TextBox ID="LastName" runat="server"></asp:TextBox></li>    
                            <li><cc2:FieldLabel ID="lblExampleField" runat="server" Text="ExampleField" TargetID="ExampleField">    
                        </cc2:FieldLabel>    
    <asp:TextBox ID="ExampleField"runat="server"></asp:TextBox></li>     
                    </ol>    
                </InsertTemplate>    
            </cc1:ManageProfile>    
     

    Here is an example on how to use this field in your code:
    (This sample code iterates through all users from the role "administrators")

    UserManager manager = new UserManager();   
    IList cmsUsers = manager.GetUsersInRole("administrators");   
    foreach (string user in cmsUsers)   
    {   
        ProfileBase userProfile = ProfileBase.Create(user);   
        string fieldValueSomething = (string)userProfile.GetPropertyValue("ExampleField");   
    }   
     


    We hope this helps.

    Sincerely yours,
    Parvan
    The Telerik Team

2 posts, 0 answered