コード例 #1
0
ファイル: BSLUser.cs プロジェクト: magicwang2017/GenSym-Test2
        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);
        }
コード例 #2
0
ファイル: BSLUser.cs プロジェクト: magicwang2017/GenSym-Test2
        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);
        }