public static IManage.IManSession AdminSession() { IManage.IManSession imSession = null; var currentUser = ConfigUtility.GetImAdminLoginInfo().Item1; if (!dictIManageDms.ContainsKey(currentUser)) { IManage.ManDMS dms = new IManage.ManDMS(); dictIManageDms.Add(currentUser, dms); imSession = dms.Sessions.Add(ConfigUtility.GetImSrvr().Item1); imSession.Login(ConfigUtility.GetImAdminLoginInfo().Item1, ConfigUtility.GetImAdminLoginInfo().Item2); return(imSession); } else { var dms = dictIManageDms[currentUser]; imSession = dms.Sessions.ItemByName(ConfigUtility.GetImSrvr().Item1); if (imSession != null && imSession.Connected) { return(imSession); } else { imSession.Login(ConfigUtility.GetImAdminLoginInfo().Item1, ConfigUtility.GetImAdminLoginInfo().Item2); return(imSession); } } }
public IManage.IManSession AdminSession() { var adminId = _IMInstance.IMAdminUserID; if (!dictIManSession.ContainsKey(adminId)) { IManage.ManDMS dms = new IManage.ManDMS(); IManage.IManSession imSession = dms.Sessions.Add(_IMInstance.IMServer); imSession.Login(adminId, _IMInstance.IMAdminPassword); dictIManSession.Add(adminId, imSession); return(imSession); } else { IManage.IManSession imSession = dictIManSession[adminId]; if (imSession != null && imSession.Connected) { return(imSession); } else { dictIManSession.Remove(adminId); return(AdminSession()); } } }
private static IManage.IManSession GetUsrSession(IManage.IManSession imSession) { if (ConfigUtility.IsImTLogin()) { //imSession.TrustedLogin2(System.Security.Principal.WindowsIdentity.GetCurrent().Token.ToInt32()); imSession.TrustedLogin(); } else { imSession.Login(ConfigUtility.GetImLoginInfo().Item1, ConfigUtility.GetImLoginInfo().Item2); } return(imSession); }