public Client AddClient(string oldSessionId, string sessionId, Guid userId, IClientProxy clientProxy, Language language) { Client client; if (!string.IsNullOrEmpty(oldSessionId) && this._Clients.TryGetValue(oldSessionId, out client)) { client.Replace(sessionId, clientProxy); this._Clients.Remove(oldSessionId); } else { client = new Client(sessionId, userId, clientProxy, language); } this._Clients.Add(client.SessionId, client); return client; }
public LoginResult Login(string userName, string password, string oldSessionId, Language language) { Guid userId = UserDataAccess.LoginIn(userName,password); LoginResult loginResult = new LoginResult(); if (userId != Guid.Empty) { string sessionId = OperationContext.Current.SessionId; IClientProxy clientProxy = OperationContext.Current.GetCallbackChannel<IClientProxy>(); this._Client = Manager.ClientManager.AddClient(oldSessionId, sessionId, userId, clientProxy, language); OperationContext.Current.Channel.Faulted += this._Client.Channel_Broken; OperationContext.Current.Channel.Closed += this._Client.Channel_Broken; loginResult.SessionId = sessionId; } return loginResult; }