}//Session_End protected void Application_End() { OptimizationService.EndProcess(); IUserService service = _container.Resolve <IUserService>(); LogoffCommand cmd = new LogoffCommand { Users = lstUsers }; service.Logoff(cmd); }
public override Task OnDisconnected(bool stopCalled) { var userId = WebApiApplication.hubUsers.FirstOrDefault(x => x.Value == Context.ConnectionId).Key; LogoffCommand cmd = new LogoffCommand { IP = "", Users = new List <long>() { userId } }; _userService.Logoff(cmd); // WebApiApplication.hubUsers.Remove(userId); if (WebApiApplication.hubUsers.ContainsKey(userId)) { this.Clients.Client(WebApiApplication.hubUsers[userId]).disconnected(); } return(base.OnDisconnected(stopCalled)); }
public void Logoff(LogoffCommand command) { repository.ExecuteTransaction(session => { foreach (var userID in command.Users) { var user = session.Get <Entities.dbo.Users>(userID); user.IsLoggedin = false; user.LoggedinIP = ""; session.Update(user); Entities.dbo.UsersLogin usersLogin = session.Query <Entities.dbo.UsersLogin>().Where(x => (x.UserID == userID && x.LogoutDT == null)).FirstOrDefault(); if (usersLogin != null) { usersLogin.LogoutDT = DateTime.Now; session.Update(usersLogin); } } }); }
protected void Session_End(object sender, EventArgs e) { IUserService service = _container.Resolve <IUserService>(); var user = ((Cherries.Models.dbo.User)Session["user"]); if (user != null) { var userId = user.UserID; LogoffCommand cmd = new LogoffCommand { IP = Session["ip"].ToString(), Users = new List <long>() { userId } }; service.Logoff(cmd); lstUsers.Remove(userId); var hub = Microsoft.AspNet.SignalR.GlobalHost.ConnectionManager.GetHubContext <TakinHub>(); if (hubUsers.ContainsKey(userId)) { hub.Clients.Client(hubUsers[userId]).sessionEnded(); } } }//Session_End
public void Logoff(LogoffCommand command) { userBL.Logoff(command); }