Beispiel #1
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);
        }
Beispiel #2
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;
                }
            }
        }