Esempio n. 1
0
        public bool CanJoinExistingSession(BSLCompanyServer objCoServer)
        {
            if (this.TUsers.Count == 0)
            {
                throw new Exception("BSLUser must be populated before calling CanJoinExistingSession.");
            }

            BSLCompany objCompany       = GetCompany();
            short      maxCollaborators = objCompany.TCompanies[0].numCollaborators;
            short      numLicenses      = objCompany.TCompanies[0].numLicenses;

            int numCurrentSessions = 0;
            int numCurrentUsers    = 0;

            objCompany.GetCurrentSessionStats(TUsers[0].userName, TUsers[0].password,
                                              ref numCurrentSessions, ref numCurrentUsers);

            if (numCurrentUsers >= numLicenses)
            {
                return(false);
            }

            if (objCoServer.GetNumCurrentUsers(TUsers[0].userName, TUsers[0].password) >= maxCollaborators)
            {
                return(false);
            }

            return(true);
        }
Esempio n. 2
0
        public bool CanStartNewSession()
        {
            if (this.TUsers.Count == 0)
            {
                throw new Exception("BSLUser must be populated before calling CanStartNewSession.");
            }

            BSLCompany objCompany            = GetCompany();
            short      maxConcurrentSessions = objCompany.TCompanies[0].numConcurrentSessions;
            short      numLicenses           = objCompany.TCompanies[0].numLicenses;

            int numCurrentSessions = 0;
            int numCurrentUsers    = 0;

            objCompany.GetCurrentSessionStats(TUsers[0].userName, TUsers[0].password,
                                              ref numCurrentSessions, ref numCurrentUsers);

            if ((numCurrentSessions >= maxConcurrentSessions) ||
                (numCurrentUsers >= numLicenses))
            {
                return(false);
            }

            return(true);
        }
Esempio n. 3
0
        /*public static DSLUser GetUser(string userName, string password)
         * {
         *      DSLUtils objDSLUtils = new DSLUtils();
         *      return objDSLUtils.GetUser(userName, password);
         * }
         *
         * public static DSLUser GetUser(int userId)
         * {
         *      DSLUtils objDSLUtils = new DSLUtils();
         *      return objDSLUtils.GetUser(userId);
         * }*/

        public BSLCompany GetCompany()
        {
            if (this.TUsers.Count == 0)
            {
                throw new Exception("BSLUser must be populated before calling GetCompany.");
            }

            if (m_objBSLCompany == null)
            {
                m_objBSLCompany = new BSLCompany(m_strConnStr);
                m_objBSLCompany.Fill(this.TUsers[0].coId);
            }
            return(m_objBSLCompany);
        }