Confusing issues with the installation of CuteChat

Last post 08-28-2005, 7:22 AM by jannifer. 5 replies.
Sort Posts: Previous Next
  •  09-15-2004, 2:16 AM 1812

    Confusing issues with the installation of CuteChat

    hi,

     
    I have installed cute chat on my machine and testign its sample website. Now my site don't have any forum its an indiviual site and i want to integrate this chat software with my site and I want to use my databse. The structure is different then yours sample website.
     
    When I configure with my databse and try to run it. It don't run and give me error.
     
    What are the steps to set such a site with chatsoft.
     
    Regards,
    Ghazala
  •  09-15-2004, 11:13 AM 1814 in reply to 1812

    Re: Confusing issues with the installation of CuteChat

    Ghazala,
     
    There is an article in the user manual show you how to hook CuteChat with the existing login system. I paste as followings:
     

    How can I hook CuteChat with my existing login system?

     

    The CuteChat 1.0 ships with seven pre-built providers:

    IBuySpyProvider
    DotNetNukeProvider
    RainbowPortalProvider
    AspNetForumsProvider
    AspNetForums2Provider
    SharePointProvider
    CuteChatSampleProvider

     

     

    Integrating with existing user login system

    If your portal is not based on the above projects. You need to create a custom Provider to integrate CuteChat with existing user login system. To implement a custom CuteChat Provider, you will need to provide a concrete implementation of the SqlDataProvider class and IUserIdentityAdapter class, and plug it into the system through appropriate configuration settings.

    In this section we will look at the steps that you can follow. To do this, we will build a CuteChat provider for the lastest ASPNetForums 2.0. The Provider for ASPNetForums 2.0 will allow CuteChat communicate with the existing ASPNetForums 2.0 login system.

     

    We assume the develpers use the Visual Studio .NET development environment in the following example.

    1. Open Microsoft Visual Studio .NET.
    2. On the File menu, click New Project.
    3. In the New Project dialog box, in Project Types, click Visual C# Projects.
    4. In the right pane, click Class Library.
    5. In the Name box, type a name (CuteChat.AspNetForums2Lib) for the new project and delete the Class1.cs that was auto create for us.  

      Set the project property Assembly Name t  CuteChat.AspNetForums2Lib
      Set the project property Default Namespace t CuteChat.AspNetForums2Lib

      Add your copyright and version requrements to the class file, AssemblyInfo.cs.
    6. In the Location box, select the location you want to save the file to.
    7. Add a reference to CuteChat.dll.  

      Add a Reference reference to the  System, System.Data, System.Web,System.XML  namespace 
    8. Derive a class from the SqlDataProvider abstract base class and name it AspNetForumsSqlDataProvider .

      public class AspNetForumsSqlDataProvider : SqlDataProvider 
      					{
      					}
      					


      To provide a complete implementation, we will need to provide overrides for all of the methods and properties of the SqlDataProvider class as followings:

      The implementation of the ListUserUniqueName method

      Description :
      Retrieves all the user names in the database.

      public override string[] ListUserUniqueName() { 
      using(SqlCommand cmd=CreateCommand()) {
      cmd.CommandText="select UserName from "+OwnerPrefix+"Forums_Users";
      return SqlDataAccess.ExecuteStringArray(cmd);
      }
      }

      The implementation of the ListRoleUniqueName method

      Description :
      Retrieves all the role names available to all users.

      public override string[] ListRoleUniqueName() { 
      using(SqlCommand cmd=CreateCommand()) {
      cmd.CommandText="select Name from "+OwnerPrefix+"Forums_Roles";
      return SqlDataAccess.ExecuteStringArray(cmd);
      }
      }

      The implementation of the IsUserNickNameExists method

      Description :
      Check if a username is already in use in the database .

      public override bool IsUserNickNameExists(string nickname) { 
      using(SqlCommand cmd=CreateCommand()) {
      cmd.CommandText="select count(*) from "+OwnerPrefix+"forums_Users where UserName=@nickname";
      SqlDataAccess.AddParameter(cmd.Parameters,"@nickname",nickname);
      int c=Convert.ToInt32(cmd.ExecuteScalar());
      return c>0;
      }
      }

      The implementation of the ListRoleUniqueNameOfUser method

      Description :
      Retrieves all the roles the current user belongs to.

      public override string[] ListRoleUniqueNameOfUser(string useruniquename) { 
      using(SqlCommand cmd=CreateCommand()) {
      cmd.CommandText=@" SELECT r.Name FROM "+OwnerPrefix+@"forums_Users u INNER JOIN "+OwnerPrefix+@"forums_UsersInRoles ur ON u.UserID = ur.UserID INNER JOIN "+OwnerPrefix+@"forums_Roles r ON ur.RoleID = r.RoleID where u.UserName=@uniquename ";
      SqlDataAccess.AddParameter(cmd.Parameters,"@uniquename",useruniquename);
      return SqlDataAccess.ExecuteStringArray(cmd);
      }
      }

      The implementation of the ListUserUniqueNameOfRole method

      Description :
      Retrieves all the user names of the input role name

      public override string[] ListUserUniqueNameOfRole(string roleuniquename) { 
      using(SqlCommand cmd=CreateCommand()) {
      cmd.CommandText=@" SELECT u.UserName FROM "+OwnerPrefix+@"forums_Users u INNER JOIN "+OwnerPrefix+@"forums_UsersInRoles ur ON u.UserID = ur.UserID INNER JOIN "+OwnerPrefix+@"forums_Roles r ON ur.RoleID = r.RoleID where r.Name=@uniquename ";
      SqlDataAccess.AddParameter(cmd.Parameters,"@uniquename",roleuniquename);
      return SqlDataAccess.ExecuteStringArray(cmd);
      }
      }

      The implementation of the GetUserInfo method

      Description :
      Get the current user information from the AspNetForums2 login system

      public override UserInfoData GetUserInfo(string useruniquename) { 
      string username;
      using(SqlCommand cmd=CreateCommand())
      {
      cmd.CommandText="select UserName from "+OwnerPrefix+"Forums_Users where UserName=@username"; SqlDataAccess.AddParameter(cmd.Parameters,"@username",useruniquename); using(SqlDataReader sdr=cmd.ExecuteReader()) {
      bool haverecord=sdr.Read(); if(!haverecord)
      return null;
      username=sdr.GetString(0);
      }
      }

      bool isadmin=false; foreach(string rolename in ListRoleUniqueNameOfUser(useruniquename))
      {
      if((string.Compare(rolename,"Global Administrators",true)==0)||(string.Compare(rolename,"Forum Administrators",true)==0))
      {
      isadmin=true;
      }
      }
      return new UserInfoData(useruniquename,username,isadmin);
      }

      The implementation of the GetRoleInfo method

      Description :
      Retrieves role information of the input role name

      public override RoleInfoData GetRoleInfo(string roleuniquename) { 
      using(SqlCommand cmd=CreateCommand()) {
      cmd.CommandText="select Name from "+OwnerPrefix+"Forums_Roles where Name=@roleid";
      SqlDataAccess.AddParameter(cmd.Parameters,"@roleid",roleuniquename);
      using(SqlDataReader sdr=cmd.ExecuteReader()) {
      bool haverecord=sdr.Read();
      if(!haverecord)
      return null;
      return new RoleInfoData(roleuniquename,sdr.GetString(0));
      }
      }
      }

    9. Create a class which implements the IUserIdentityAdapter interface and name it SqlServerUserIdentityAdapter .

      public class SqlServerUserIdentityAdapter : IUserIdentityAdapter 
      					{
      					}
      					


      To provide a complete implementation, we will need to provide overrides for the two methos of the SqlServerUserIdentityAdapter class as followings:

      The implementation of the GetCurrentUserUniqueName method

      Description :
      Retrieves the user name of the current user.

      public string GetCurrentUserUniqueName(HttpContext context) { 
      IIdentity iden=context.User.Identity;
      if(iden==null||!iden.IsAuthenticated)
      return null;
      if(iden.Name==null||iden.Name.Length==0)
      return null;
      return iden.Name;
      }

      The implementation of the IsAdministrators method

      Description :
      Check the current user is an administrator or not..

      public bool IsAdministrators(string useruniquename) { 
      using(IDataAccess da=ChatConfig.CreateDataAccess()) {
      int userid=da.GetUserInternalId(useruniquename);
      if(userid==0)
      return false;
      DataRow row=da.SelectUser(userid);
      if(row==null)
      return false;
      return Convert.ToBoolean(row["isadmin"]);
      }
      }


    10. Start the application: Press F5, or click Start on the Debug menu.  The classes will be compiled into an assembly CuteChat.AspNetForum2Lib.dll . Test and deploy the new assembly to a running server bin directory.
    11. Modify the configuration file to point the CuteChat default provider to our new provider CuteChat.AspNetForum2Lib.dll .

      The web.config file contains a number of critical sections to enable the Provider pattern. The first section registers the Providers and their corresponding ConfigurationSectionHandlers.  

          <configSections>
            <section name="cuteChat" type="CuteChat.ChatConfigurationHandler,CuteChat" />
          </configSections>

       

       

      The <cutechat> section includes a <providers> collection specification where all of the implementations for <cutechat> are identified. At a bare minimum, each provider must include a name, type, and providerPath attribute ( name is generic but usually refers to the classname, type refers to the strong classname of the provider, and providerPath refers to the location where provider specific resources such as scripts can be found  ).  

      The <cutechat> section should contain a defaultProvider attribute which relates to a specific instance in the <providers> collection below. The defaultProvider is used as the single switch for changing from one provider to another.

      In our case, the defaultProvider should be " AspNetForums2 "

        

      <cuteChat 
      WebFilePath="~/CuteChat/" IPAddressPolicy="*" BadWords="kill,hate" AllowAnonymous="Allow"           LoginUrl="~/" Culture="en-US" UpdateMessageInterval="1" ConnectionString="server=localhost;database=test;uid=test;pwd=test;App=ASP.NET Forums">            <fonts clear="true">                 <add font="Arial"/>
      <add font="Verdana"/>
      </fonts>           <providers defaultProvider="AspNetForums2">
      <provider name="AspNetForums2"
      sqlDataProviderType="CuteChat.AspNetForums2Lib.AspNetForums2SqlDataProvider,CuteChat.AspNetForums2Lib"
      userIdentityAdapterType="CuteChat.AspNetForums2Lib.SqlServerUserIdentityAdapter,CuteChat.AspNetForums2Lib" />
      </providers>

      </cuteChat>


    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  09-20-2004, 7:43 AM 1869 in reply to 1814

    Re: Confusing issues with the installation of CuteChat

    Can u send me the user manual. I tried to find that manual but ther is no link for the manual on the site
  •  09-20-2004, 2:32 PM 1874 in reply to 1869

    Re: Confusing issues with the installation of CuteChat

    Gh,

     
     
    The user manual is included in the software package.
     
    After you install the CuteChat on your machine, you can find the user manual:
     
    Start >> All programs >> CuteChat >> CuteChat Help
     
    Hope it helps.

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  09-21-2004, 1:11 AM 1880 in reply to 1874

    Re: Confusing issues with the installation of CuteChat

    thanx alot.
  •  08-28-2005, 7:22 AM 9968 in reply to 1814

    Re: Confusing issues with the installation of CuteChat

    Hi Adam,
     
    I tried to follow your implementation of the SqlDataProvider to create my own dataporvider for CuteChat, but I'm getting an error saying no overloads take 0 arguments for SqlDataProvider.
     
    Following your example I found the CuteSoft.dll in the CuteChat Legacy app. I'm gathering this is all redundant now.
     
    Do you have another example that uses the new CuteSoft.Chat.DataProvider? (besides the standalone sample) It would be extremely helpful if you had a walk through example of how to create a data provider for latest version of CuteChat. The documentation is very poor despite your continual referral to it.
     
    many thanks
     
    Jan
View as RSS news feed in XML