private AuthenticationLevel LoginToIndividualSource(string sourceAlias, string username, string password) { AuthenticationLevel ret = AuthenticationLevel.None; try { string wsId = m_SysConfig.GetDefaultConfig().WorkstationAlias; UserInfo userInfo = new UserInfo(username, password); WorkstationInfo wsInfo = new WorkstationInfo(wsId, userInfo); LoginResponse loginResponse = m_DataSourceAccess.Login(sourceAlias, wsInfo); ret = loginResponse.UserAuthenticationLevel; if (!ret.Equals(AuthenticationLevel.None)) { SysConfiguration sysConfig = new SysConfiguration(); sysConfig.ID = sourceAlias; sysConfig.ContainerDBConnectionString = loginResponse.systemConfiguration.ContainerDBConnectString; sysConfig.ContainerRefreshPeriodmsecs = loginResponse.systemConfiguration.ContainerRefreshPeriodSeconds * 1000; if (m_SysConfig.Contains(sourceAlias)) { m_SysConfig.Delete(sourceAlias); } m_SysConfig.Add(sysConfig); if (m_SysConfig.UserProfileManager.Profile == null) { ProfileObject profile = ProfileTranslator.Translate(loginResponse.UserProfile, 4); profile.SourceAlias = sourceAlias; profile.UserName = wsInfo.userInfo.UserName; profile.Password = wsInfo.userInfo.Password; m_SysConfig.UserProfileManager.Profile = profile; m_SysConfig.UserProfileManager.Profile.ProfileUpdatedEvent += new ProfileUpdated(ProfileUpdated); } DataSet caselist = null; m_DataSourceAccess.GetCaseList(sourceAlias, out caselist); if (caselist != null) { CaseListDataSet caseListDataSet = (CaseListDataSet)caselist; caseListDataSet.CaseListTable.CaseListTableRowChanged += new CaseListDataSet.CaseListTableRowChangeEventHandler(CaseListTable_CaseListTableRowChanged); } } } catch (Exception ex) { throw ex; } return(ret); }
internal void ProfileUpdated() { ProfileObject profileObj = m_SysConfig.UserProfileManager.Profile; if (profileObj != null) { Profile profile = ProfileTranslator.Translate(profileObj); m_DataSourceAccess.UpdateProfile(profileObj.SourceAlias, profileObj.UserName, profile); } }