public Session(string sessionID, DateTime expires, Coordinates newCoords, string newIP, string userLoggedIn, Session oldSession) { this.SessionID = oldSession.SessionID; this.UserID = userLoggedIn; this.DateExpired = (expires.Year == 1) ? DateTime.Now.AddDays(1) : expires; if (newCoords == null) { newCoords = new Coordinates(); } if ((oldSession.Location.LocationCoordinates.Latitude == 0 && oldSession.Location.IPAddress == null) || oldSession.Location.LocationCoordinates.IsFarAway(newCoords)) { this.Location = new SessionLocation(newCoords, newIP); } else { this.Location = oldSession.Location; this.Location.IPAddress = newIP; } if (userLoggedIn == null || userLoggedIn == "") { this.Defaults = GetSessionDefaultsFromLocation(); } else { this.Defaults = GetSessionDefaultsForUser(this.UserID); } }
public Session(string sessionID, DateTime expires, SecurityUser user, Coordinates coords, string ipAddr) { this.SessionID = sessionID; this.DateExpired = (expires.Year == 1) ? DateTime.Now.AddDays(1) : expires; this.Location = new SessionLocation(coords, ipAddr); this.UserID = user.UserID; if (user != null && user.UserID != "") { this.Defaults = GetSessionDefaultsForUser(user.UserID); } else { this.Defaults = GetSessionDefaultsFromLocation(); } }
public Session(string sessionID, DateTime expires, string userLoggedIn, Coordinates coords, string ipAddr) { this.SessionID = sessionID; this.DateExpired = (expires.Year == 1) ? DateTime.Now.AddDays(1) : expires; this.Location = new SessionLocation(coords, ipAddr); this.UserID = userLoggedIn; if (userLoggedIn == "" || userLoggedIn == null) { this.Defaults = GetSessionDefaultsFromLocation(); } else { //get from db for user this.Defaults = GetSessionDefaultsForUser(userLoggedIn); } }