Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Plus.HabboHotel.Items.Televisions
- {
- public class TelevisionManager
- {
- private static readonly ILog log = LogManager.GetLogger("Plus.HabboHotel.Items.Televisions.TelevisionManager");
- public Dictionary<int, TelevisionItem> _televisions;
- public TelevisionManager()
- {
- this._televisions = new Dictionary<int, TelevisionItem>();
- this.Init();
- }
- public void Init()
- {
- if (this._televisions.Count > 0)
- _televisions.Clear();
- DataTable getData;
- using (var queryReactor = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
- {
- queryReactor.SetQuery("SELECT * FROM `items_youtube` ORDER BY `user_id` DESC");
- getData = queryReactor.getTable();
- queryReactor.AddParameter("id", UserId);
- if (getData != null)
- {
- foreach (DataRow Row in getData.Rows)
- {
- 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())));
- }
- }
- }
- log.Info("Youtube Tv -> Chargé");
- }
- public ICollection<TelevisionItem> TelevisionList
- {
- get
- {
- return this._televisions.Values;
- }
- }
- public object UserId { get; private set; }
- public bool TryGet(int ItemId, out TelevisionItem TelevisionItem)
- {
- if (this._televisions.TryGetValue(ItemId, out TelevisionItem))
- return true;
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement