Re: cutechat integration horror

  •  01-14-2005, 9:54 AM

    Re: cutechat integration horror

    Adam,

    thx for your answer...

    the dataproviders coming with cutechat are not useable for us because our portal is not basing on those, we coded an own in c#

    we ere using internal only numbers/ids to verify users, could this make problems?
    Here is the code for our Dataprovider:

     

    using

    CuteChat;

     

    namespace

    SediSys.Portal.Community.WebPL.Chat {

    using System;

    using System.Collections;

    using System.Data;

    using System.Data.SqlClient;

    using SediSys.Portal.Main.BF;

     

    publicclass SediSysSqlDataProvider : CuteChat.SqlServer.SqlDataProvider {

    public SediSysSqlDataProvider(string connstr):base(connstr) {

    }

    publicoverride CuteChat.UserInfoData GetUserInfo(string useruniquename) {

    // 234_hansi

     

    String[] arr = useruniquename.Split('_');

    int id = Convert.ToInt32( arr[0] );

    DataSet ds =

    new User().GetUserByID( id );

    if ( ds.Tables[0].Rows.Count == 0 ) {

    thrownew Exception("ERROR: Couldn't find user with id: " + id );

    }

    DataRow row = ds.Tables[0].Rows[0];

    string username = row["UserName"].ToString();

    int globGroupID = Convert.ToInt32( row["GlobalGroupID"] );

    bool admin = false;

    if ( globGroupID == 1 ) {

    admin =

    true;

    }

    returnnew CuteChat.UserInfoData(useruniquename,username,admin );

    }

    publicoverridestring[] ListUserUniqueName() {

    ArrayList al=

    new ArrayList();

    DataSet ds =

    new User().GetAllUsers();

    //DataRow row = ds.Tables[0].Rows[0];

     

    foreach (DataRow row in ds.Tables[0].Rows) {

    string ids = Convert.ToString( row["ID"] );

    string usern = Convert.ToString( row["UserName"] );

    al.Add( usern + "_" + ids);

    }

    return (string[])al.ToArray(typeof(string));

    }

    publicoverridebool IsUserNickNameExists(string nickname) {

    // FIXME: implement once we know how they handle this

     

    returnfalse;

    }

    }

    }

     
    thx for trying...

View Complete Thread