Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class NotificationsControl
- {
- private static NotificationsManager _notificationsManager = new NotificationsManager(HttpContext.Current);
- internal static void AddHubId(HttpContextBase context, string hubid)
- {
- try
- {
- List<UserToHub> _listeners = context.Cache["Suzct_NotificationsListeners"] as List<UserToHub> ?? new List<UserToHub>();
- if (!_listeners.Any(m => m.hubid == hubid) && context.User != null && context.User.Identity.IsAuthenticated)
- {
- _listeners.Add(new UserToHub() {
- hubid = hubid,
- username = context.User.Identity.Name,
- browser = context.Request.Browser.Browser,
- ipaddress = context.Request.UserHostAddress
- });
- context.Cache["Suzct_NotificationsListeners"] = _listeners;
- ListenersDebugOutput(context);
- }
- }
- catch (Exception e)
- {
- LogWriter.InsertException(e, HttpContext.Current.User);
- }
- }
- internal static void RemoveHubId(HttpContextBase context, string hubId)
- {
- try
- {
- List<UserToHub> _listeners = context.Cache["Suzct_NotificationsListeners"] as List<UserToHub> ?? new List<UserToHub>();
- _listeners.RemoveAll(m => m.hubid == hubId);
- context.Cache["Suzct_NotificationsListeners"] = _listeners;
- ListenersDebugOutput(context);
- }
- catch (Exception e)
- {
- LogWriter.InsertException(e, HttpContext.Current.User);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement