/// <summary> /// 单点登录 /// </summary> /// <param name="pLanguageLCID">Web平台当前语言(中文:2052,英文:1033。)</param> /// <param name="pClientIP">客户端IP地址</param> /// <param name="pClientID">登录用户所属客户标识</param> /// <param name="pUserID">登录用户标识</param> /// <param name="pWebSiteSessionId">Web站点的会话标识</param> public int Login(int pLanguageLCID, string pClientIP, string pClientID, string pUserID, string pWebSiteSessionId) { //TO-DO:登录成功后,准备记录MSTR集成组件所使用的单点登录信息。 var sqlHelper = new JIT.Utility.DataAccess.DefaultSQLHelper(ConfigurationManager.AppSettings["MstrIntegrationConn"]); //1.根据客户获取报表服务器及项目相关信息 var userInfo = new ReportUserInfo() { ClientID = pClientID, UserID = pUserID }; MSTRProjectEntity mstrProjectQueryEntity = new MSTRProjectEntity(); mstrProjectQueryEntity.ClientID = pClientID; MSTRProjectBLL mstrProjectBLL = new MSTRProjectBLL(userInfo, sqlHelper); MSTRProjectEntity[] mstrProjectEntities = mstrProjectBLL.QueryByEntity(mstrProjectQueryEntity, null); if (mstrProjectEntities == null || mstrProjectEntities.Length == 0) { JIT.Utility.Log.Loggers.Exception(new JIT.Utility.Log.ExceptionLogInfo(new Exception("未找到客户ID为[" + pClientID + "]的MSTR项目信息."))); return(-1); throw new Exception("未找到客户ID为[" + pClientID + "]的MSTR项目信息."); } var mstrProjectInfo = mstrProjectEntities[0]; //2.记录用户会话记录 MSTRIntegrationUserSessionBLL mstrIntegrationUserSessionBLL = new MSTRIntegrationUserSessionBLL(userInfo, sqlHelper); MSTRIntegrationUserSessionEntity mstrIntegrationUserSessionQueryEntity = new MSTRIntegrationUserSessionEntity(); mstrIntegrationUserSessionQueryEntity.UserID = pUserID; mstrIntegrationUserSessionQueryEntity.ClientID = pClientID; mstrIntegrationUserSessionQueryEntity.IP = pClientIP; mstrIntegrationUserSessionQueryEntity.IsChange = 0; mstrIntegrationUserSessionQueryEntity.IsCheckIP = 0; mstrIntegrationUserSessionQueryEntity.LCID = pLanguageLCID; mstrIntegrationUserSessionQueryEntity.MSTRIServerName = mstrProjectInfo.IServerName; mstrIntegrationUserSessionQueryEntity.MSTRIServerPort = mstrProjectInfo.IServerPort; mstrIntegrationUserSessionQueryEntity.MSTRProjectName = mstrProjectInfo.ProjectName; mstrIntegrationUserSessionQueryEntity.WebSessionID = pWebSiteSessionId; mstrIntegrationUserSessionQueryEntity.MSTRUserName = mstrProjectInfo.MSTRUserName; mstrIntegrationUserSessionQueryEntity.MSTRUserPassword = mstrProjectInfo.MSTRUserPassword; mstrIntegrationUserSessionBLL.Create(mstrIntegrationUserSessionQueryEntity); //记录单点登录表中的自增主键 //HttpContext.Current.Session["MstrSSO_SessionID"] = mstrIntegrationUserSessionQueryEntity.SessionID.Value; //HttpContext.Current.Session["MstrSSO_UserID"] = pUserID; //HttpContext.Current.Session["MstrSSO_ClientID"] = pClientID; //HttpContext.Current.Session["MstrSSO_LCID"] = pLanguageLCID; return(mstrIntegrationUserSessionQueryEntity.SessionID.Value); }