Пример #1
0
        }       //	loadDefault

        /// <summary>
        /// Validate Login.
        /// Creates session and calls ModelValidationEngine
        /// </summary>
        /// <param name="org">log-in org</param>
        /// <returns>error message</returns>
        public String ValidateLogin(KeyNamePair org)
        {
            String info         = m_user + ",R:" + m_role.ToString() + ",O=" + m_org.ToString();
            int    AD_Client_ID = m_ctx.GetAD_Client_ID();
            int    AD_Org_ID    = org.GetKey();
            int    AD_Role_ID   = m_ctx.GetAD_Role_ID();
            int    AD_User_ID   = m_ctx.GetAD_User_ID();
            //
            MSession session = MSession.Get(m_ctx, true);

            if (AD_Client_ID != session.GetAD_Client_ID())
            {
                session.SetAD_Client_ID(AD_Client_ID);
            }
            if (AD_Org_ID != session.GetAD_Org_ID())
            {
                session.SetAD_Org_ID(AD_Org_ID);
            }
            if (AD_Role_ID != session.GetAD_Role_ID())
            {
                session.SetAD_Role_ID(AD_Role_ID);
            }
            //
            String error = ModelValidationEngine.Get().LoginComplete(AD_Client_ID, AD_Org_ID, AD_Role_ID, AD_User_ID);

            if (error != null && error.Length > 0)
            {
                session.SetDescription(error);
                session.Save();
                return(error);
            }
            //	Log
            session.Save();
            return(null);
        }       //	validateLogin