public static void RegisterHubConnection(string connectionId, AspxCommonInfo aspxCommonObj)
        {
            var RealTimeNotificationInfo = new RealTimeNotificationInfo
            {
                ConnectionId = connectionId,
                SessionId    = HttpContext.Current.Session.SessionID
            };

            AddNewUser(RealTimeNotificationInfo, aspxCommonObj);
        }
        public static void RegisterHubConnection(string connectionId, AspxCommonInfo aspxCommonObj)
        {
            var RealTimeNotificationInfo = new RealTimeNotificationInfo
            {
                ConnectionId = connectionId,
                SessionId = HttpContext.Current.Session.SessionID
            };
            AddNewUser(RealTimeNotificationInfo, aspxCommonObj);

        }
 public static void AddNewUser(RealTimeNotificationInfo realTimeObj, AspxCommonInfo aspxCommonObj)
 {
     try
     {
         AspxRealTimeNotificationProvider.AddNewUser(realTimeObj, aspxCommonObj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public static void AddNewUser(RealTimeNotificationInfo realTimeObj, AspxCommonInfo aspxCommonObj)
        {
            try
            {
                AspxRealTimeNotificationProvider.AddNewUser(realTimeObj, aspxCommonObj);
             
              
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
 public static void AddNewUser(RealTimeNotificationInfo realTimeObj, AspxCommonInfo aspxCommonObj)
 {
     try
     {
         List <KeyValuePair <string, object> > parameterCollection = CommonParmBuilder.GetParamSPU(aspxCommonObj);
         parameterCollection.Add(new KeyValuePair <string, object>("ConnectionID", realTimeObj.ConnectionId));
         parameterCollection.Add(new KeyValuePair <string, object>("SessionCode", realTimeObj.SessionId));
         OracleHandler sqlH = new OracleHandler();
         sqlH.ExecuteNonQuery("Aspx_AddOnlineUser", parameterCollection);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public static void AddNewUser(RealTimeNotificationInfo realTimeObj, AspxCommonInfo aspxCommonObj)
 {
     try
     {
         List<KeyValuePair<string, object>> parameterCollection = CommonParmBuilder.GetParamSPU(aspxCommonObj);
         parameterCollection.Add(new KeyValuePair<string, object>("@ConnectionID", realTimeObj.ConnectionId));
         parameterCollection.Add(new KeyValuePair<string, object>("@SessionCode", realTimeObj.SessionId));
         SQLHandler sqlH = new SQLHandler();
         sqlH.ExecuteNonQuery("[dbo].[Aspx_AddOnlineUser]", parameterCollection);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
예제 #7
0
        public override Task OnConnected()
        {
            string sessionAspxCommonInfoCookie = Context.RequestCookies["session_aspxCommonInfo_cookie"].Value;
            string connectionId = Context.ConnectionId;
            string[] cookieValues = sessionAspxCommonInfoCookie.Split('-');

            if (cookieValues.Count() > 1)
            {

                int tempInt = 0;
                AspxCommonInfo aspxCommonInfo = new AspxCommonInfo();
                aspxCommonInfo.StoreID = Int32.TryParse(cookieValues[1], out tempInt) ? tempInt : 0;
                aspxCommonInfo.PortalID = Int32.TryParse(cookieValues[2], out tempInt) ? tempInt : 0;
                aspxCommonInfo.UserName = cookieValues[3];
                int connectedUsers = Aspxcommerce.RealTimeCartManagement.AspxRealTimeNotificationController.GetOnlineUserList(aspxCommonInfo, cookieValues[0]).Count;
                if (connectedUsers < 200)
                {
                    var realTimeNotificationInfo = new RealTimeNotificationInfo
                    {
                        ConnectionId = connectionId,
                        SessionId = cookieValues[0]
                    };

                    Aspxcommerce.RealTimeCartManagement.AspxRealTimeNotificationController.AddNewUser(realTimeNotificationInfo, aspxCommonInfo);
                    UserHandler.ConnectedIds.Add(connectionId);
                    base.Groups.Add(connectionId, "aspx_rt_users");
                    return base.OnConnected();
                }
            }
                
            Clients.All.MaxConnectionTimeOut(true);
            return base.OnConnected();
           
        }