Advertisement
Guest User

Untitled

a guest
Feb 16th, 2016
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. namespace Plus.HabboHotel.Items.Televisions
  2. {
  3. public class TelevisionManager
  4. {
  5. private static readonly ILog log = LogManager.GetLogger("Plus.HabboHotel.Items.Televisions.TelevisionManager");
  6.  
  7. public Dictionary<int, TelevisionItem> _televisions;
  8.  
  9. public TelevisionManager()
  10. {
  11. this._televisions = new Dictionary<int, TelevisionItem>();
  12.  
  13. this.Init();
  14. }
  15.  
  16.  
  17.  
  18. public void Init()
  19. {
  20. if (this._televisions.Count > 0)
  21. _televisions.Clear();
  22.  
  23.  
  24. DataTable getData;
  25. using (var queryReactor = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
  26. {
  27. queryReactor.SetQuery("SELECT * FROM `items_youtube` ORDER BY `user_id` DESC");
  28. getData = queryReactor.getTable();
  29. queryReactor.AddParameter("id", UserId);
  30. if (getData != null)
  31. {
  32. foreach (DataRow Row in getData.Rows)
  33. {
  34. this._televisions.Add(Convert.ToInt32(Row["id"]), new TelevisionItem(Convert.ToInt32(Row["user_id"]), Row["youtube_id"].ToString(), Row["title"].ToString(), Row["description"].ToString(), PlusEnvironment.EnumToBool(Row["enabled"].ToString())));
  35. }
  36. }
  37. }
  38.  
  39.  
  40. log.Info("Youtube Tv -> Chargé");
  41. }
  42.  
  43.  
  44. public ICollection<TelevisionItem> TelevisionList
  45. {
  46. get
  47. {
  48. return this._televisions.Values;
  49.  
  50. }
  51. }
  52.  
  53. public object UserId { get; private set; }
  54.  
  55. public bool TryGet(int ItemId, out TelevisionItem TelevisionItem)
  56. {
  57. if (this._televisions.TryGetValue(ItemId, out TelevisionItem))
  58. return true;
  59. return false;
  60.  
  61.  
  62. }
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement