Example #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);
        }
Example #2
0
        public BSLCompanyServerList GetUserServers()
        {
            if (this.TUsers.Count == 0)
            {
                throw new Exception("BSLUser must be populated before calling GetUserServers.");
            }

            BSLCompanyServerList ds = GetCompany().GetCompanyServerList();

            foreach (DSLCompanyServer.TCompanyServersRow r in ds.TCompanyServers.Rows)
            {
                if (r.inactive)
                {
                    r.Delete();
                    continue;
                }

                BSLCompanyServer objCoServer = new BSLCompanyServer(r.serverId, r.serverName,
                                                                    r.ipAddress, this.TUsers[0].coId, r.portNo, m_strConnStr);

                if (!objCoServer.IsAvailable(this.TUsers[0].userName, this.TUsers[0].password))
                {
                    r.isRunning = false;
                }
                else
                {
                    r.isRunning = true;
                }

                if (objCoServer.GetNumCurrentUsers(this.TUsers[0].userName, this.TUsers[0].password) > 0)
                {
                    r.inUse = true;
                }
            }

            ds.AcceptChanges();
            return(ds);
        }
Example #3
0
        public void GetCurrentSessionStats(string strUserName, string strPassword,
                                           ref int numCurrentSessions, ref int numCurrentUsers)
        {
            if (this.TCompanies.Count == 0)
            {
                throw new Exception("BSLCompany must be populated before calling GetCurrentSessionStats.");
            }

            numCurrentSessions = 0;
            numCurrentUsers    = 0;

            BSLCompanyServerList objCoServerList = GetCompanyServerList();

            foreach (BSLCompanyServer.TCompanyServersRow r in objCoServerList.TCompanyServers.Rows)
            {
                if (r.inactive)
                {
                    continue;
                }

                BSLCompanyServer objCoServer = new BSLCompanyServer(r.serverId, r.serverName,
                                                                    r.ipAddress, TCompanies[0].coId, r.portNo, m_strConnStr);

                if (!objCoServer.IsAvailable(strUserName, strPassword))
                {
                    continue;
                }

                short i = objCoServer.GetNumCurrentUsers(strUserName, strPassword);
                if (i > 0)
                {
                    numCurrentSessions++;
                    numCurrentUsers += i;
                }
            }
        }