Re: Integrating info

  •  08-19-2005, 10:20 AM

    Re: Integrating info

    Hi Adam,

    I found the document that you referred to, but all the guides seem to be written for integrating with IBuySpy, DotNetNuke etc, which I am not using. 

    As I am writing in VB.net I took a look at the guide for Integrating with DotNetNuke 3.0, but obviously because I am not integrating with DotNetNuke I have no reference to theDotNetNuke .dll which is causing quite a few errors.

    I am definitely interested in purchasing your software but I have to be sure that it can indeed integrate with my current system.  I am sure that you are quire busy but I would really appreciate some assistance integrating CuteChat with my site.

    With regards to my code this is what I have gotten so far:

    <code>
    Namespace Chat
        PUBLIC CLASS DotNetNukeDataProvider
            Inherits CuteSoft.Chat.DataProvider
           
            Public Overrides Function GetUserDisplayName(ByVal useruniquename As String) As String
                 Return GetUser(useruniquename).UserName
            End Function
           
            Protected Function GetUser(ByVal uniquename As String) As DotNetNuke.Entities.Users.UserInfo
                 Dim userid As Integer = Integer.Parse(uniquename)
                 Dim ps As DotNetNuke.Entities.Portals.PortalSettings = CType(System.Web.HttpContext.Current.Items("PortalSettings"), DotNetNuke.Entities.Portals.PortalSettings)
                 Return New DotNetNuke.Entities.Users.UserController().GetUser(ps.PortalId, userid)
            End Function

            Public Overrides Function ListUserUniqueName() As String()
                  Dim ps As DotNetNuke.Entities.Portals.PortalSettings = CType(System.Web.HttpContext.Current.Items("PortalSettings"), DotNetNuke.Entities.Portals.PortalSettings)
                  Dim names As New System.Collections.ArrayList
                  For Each user As DotNetNuke.Entities.Users.UserInfo In New DotNetNuke.Entities.Users.UserController().GetUsers(ps.PortalId, False, False)
                      names.Add(user.UserID.ToString())
                  Next
                  Return CType(names.ToArray(GetType(String)), String())
            End Function

            Public Overrides Function IsAdministrator(ByVal useruniquename As String) As Boolean
                Dim user As DotNetNuke.Entities.Users.UserInfo = GetUser(useruniquename)
                If user.IsSuperUser Then
                    Return True
                End If
       
                Dim ps As DotNetNuke.Entities.Portals.PortalSettings = CType(System.Web.HttpContext.Current.Items("PortalSettings"), DotNetNuke.Entities.Portals.PortalSettings)
                Dim roles() As String = New DotNetNuke.Security.Roles.RoleController().GetRolesByUser(user.UserID, ps.PortalId)
       
                Return Array.IndexOf(roles, "Administrators") <> -1
            End Function
           
            Public Overrides Function SearchUserUniqueNameByDisplayName(ByVal userDisplaName As String) As String()
                   Return SearchUserUniqueNamesByProperty("FirstName", userDisplaName)
             End Function
             
             Public Overrides Function SearchUserUniqueNamesByProperty(ByVal category As String, ByVal keyword As String) As String()
                   Dim ps As DotNetNuke.Entities.Portals.PortalSettings = CType(System.Web.HttpContext.Current.Items("PortalSettings"), DotNetNuke.Entities.Portals.PortalSettings)
                   keyword = keyword.ToLower()
                   Dim names As New System.Collections.ArrayList
                   For Each user As DotNetNuke.Entities.Users.UserInfo In New DotNetNuke.Entities.Users.UserController().GetUsers(ps.PortalId, False, False)
                       Dim prop As String
                       Select Case category
                           Case "FirstName"
                               prop = user.FirstName
                               Exit Select
                           Case "UserName"
                               prop = user.Username
                               Exit Select
                           Case "Country"
                               prop = user.Profile.Country
                               Exit Select
                       End Select
                       If prop <> Nothing Then
                           If prop.ToLower().IndexOf(keyword) <> -1 Then
                               names.Add(user.UserID.ToString())
                           End If
                       End If
                   Next
                   Return CType(names.ToArray(GetType(String)), String())
             End Function
        END CLASS
       
        public class DotNetNukeConnectionStringProvider: CuteSoft.Chat.ConnectionStringProvider { }
            Inherits CuteSoft.Chat.DataProvider
           
            Protected Overrides Function GetConnectionString(ByVal user As CuteSoft.Chat.UserIdentity) As String
                    Dim pc As DotNetNuke.Framework.Providers.ProviderConfiguration
                    pc = DotNetNuke.Framework.Providers.ProviderConfiguration.GetProviderConfiguration("data")
                    Dim p As DotNetNuke.Framework.Providers.Provider = pc.Providers(pc.DefaultProvider)
                    Dim s As String = p.Attributes("connectionStringName")
                    If s <> Nothing And s <> "" Then
                        s = System.Configuration.ConfigurationSettings.AppSettings(s)
                        If s <> Nothing And s <> "" Then
                            Return s
                        End If
                    End If
                    Return p.Attributes("connectionString")
             End Function
        END CLASS
    END NAMESPACE
    </code>

    Thanks for the help
    GP
View Complete Thread