Пример #1
0
 public void ReloadBuddies()
 {
     mBuddies.Clear();
     using (DatabaseClient dbClient = AleedaEnvironment.GetDatabase().GetClient())
     {
         dbClient.AddParamWithValue("@userid", mClient.GetHabbo().ID);
         foreach (DataRow row in dbClient.ReadDataTable("SELECT id,username,figure,motto FROM users WHERE id IN(SELECT buddyid FROM messenger_buddylist WHERE userid = @userid AND accepted = 0x01) OR id IN(SELECT userid FROM messenger_buddylist WHERE buddyid = @userid AND accepted = 0x01);").Rows)
         {
             MessengerBuddy buddy = MessengerBuddy.Parse(row);
             if (buddy != null)
             {
                 mBuddies.Add(buddy);
             }
         }
     }
 }
Пример #2
0
        public List <MessengerBuddy> SearchHabbos(string criteria)
        {
            List <MessengerBuddy> matches = new List <MessengerBuddy>();

            using (DatabaseClient dbClient = AleedaEnvironment.GetDatabase().GetClient())
            {
                dbClient.AddParamWithValue("@criteria", criteria + "%");
                foreach (DataRow row in dbClient.ReadDataTable("SELECT id,username,figure,motto FROM users WHERE username LIKE @criteria;").Rows)
                {
                    MessengerBuddy match = MessengerBuddy.Parse(row);
                    if (match != null)
                    {
                        matches.Add(match);
                    }
                }
            }
            return(matches);
        }
Пример #3
0
        public static MessengerBuddy Parse(DataRow row)
        {
            MessengerBuddy buddy = new MessengerBuddy();

            try
            {
                buddy.mID       = (uint)row["id"];
                buddy.mUsername = (string)row["username"];
                buddy.mFigure   = (string)row["figure"];
                buddy.mMotto    = (string)row["motto"];
                return(buddy);
            }
            catch (Exception ex)
            {
                AleedaEnvironment.GetLog().WriteUnhandledExceptionError("MessengerBuddy.Parse", ex);
            }

            return(null);
        }