Esempio n. 1
0
        /// <summary>
        /// "Method to get data usage for all users
        /// </summary>
        /// <param name="subsystemName"></param>
        /// <param name="startDate"></param>
        /// <returns></returns>
        public Hashtable GetDataUsage()
        {
            // get the local time
            DateTime timeNow = DateTime.Now;
            // go back 2 hours for now
            TimeSpan tminus = new TimeSpan(m_timeDelay, 0, 0);
            DateTime dt     = timeNow.Subtract(tminus);

            string theDate = dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString();

            Hashtable     data   = new Hashtable();
            StringBuilder cmdStr = new StringBuilder(" SELECT  userName, SUM(DeltaAcctInputOctets) AS DataInTotal, ");

            cmdStr.Append(" SUM(DeltaAcctOutputOctets) AS DataOutTotal FROM SprintAMSRecord");
            cmdStr.Append(" WHERE (AccountStatus = '2')  AND EventTimestamp > '" + theDate + "'");
            cmdStr.Append(" GROUP BY userName ORDER by userName");

            DataSet ds = new DataSet();

            try
            {
                ds = GetData(cmdStr.ToString());

                // make sure there is only one SID/BID returned here
                foreach (DataTable myTable in ds.Tables)
                {
                    //r.count = myTable.Rows.Count.ToString();

                    // only one row with the sidbid
                    foreach (DataRow myRow in myTable.Rows)
                    {
                        AMSData d = new AMSData();
                        d.User    = (String)myRow.ItemArray[0];
                        d.DataIn  = (int)myRow.ItemArray[1];
                        d.DataOut = (int)myRow.ItemArray[2];

                        data.Add(d.User, d);
                    }
                }
            }
            catch (System.Exception ex)
            {
                LogMsg("FraudDbManager::GetDataUsage():FailedTryingToGetTheDataUsage");
                LogMsg("ECaught:" + ex.Message);
            }

            return(data);
        }  //GetSMSUsage
Esempio n. 2
0
        /// <summary>
        /// method to apply the rules to detect fraud
        /// </summary>
        public void CheckData(Hashtable dataUsage)
        {
            string msg = string.Empty;

            // Get our users
            List <string> rUsers = _db.GetUsers(); // list of users

            // only one row with the sidbid
            foreach (string user in rUsers)
            {
                if (dataUsage.ContainsKey(user))
                {
                    AMSData d     = (AMSData)dataUsage[user];
                    int     total = d.DataIn + d.DataOut;
                    if (total > this.m_DataLimit)
                    {
                        SendCallReportNotification(user, total);
                    }
                }
            }
        }//CheckData