Exemplo n.º 1
0
        public void AddRecordForServingSidBid(string servingCarrierSidBid, string homeCarrierSidBid, CiberRecordInfo cri,
            Record22 r22)
        {
            // is there already data for this servingCarrierSidBid
            if (m_picoCiberData.ContainsKey(servingCarrierSidBid))
            {
                // grab the hashtable and add the data for this serving carrier sid bid
                SidBidData sidBidData = (SidBidData)m_picoCiberData[servingCarrierSidBid];
                sidBidData.AddSidBidRecord(homeCarrierSidBid, r22);
                sidBidData.AddSidBidFileInfo(homeCarrierSidBid, cri);

                // no need to do this:  hashtable is updated from above
                // m_picoCiberData.Add(servingCarrierSidBid, data);
            }
            else
            {
                // create a new hashtable and list for the data
                SidBidData data = new SidBidData();
                data.AddSidBidRecord(homeCarrierSidBid, r22);
                data.AddSidBidFileInfo(homeCarrierSidBid, cri);
                // add the hashtable with data to our site/pico hashtable
                m_picoCiberData.Add(servingCarrierSidBid, data);

            }
        }
Exemplo n.º 2
0
 public void AddSidBidRecord(string sidBid, Record22 r22)
 {
     // if our sidbid exists, add to the list
     if (m_sidBidRecords.ContainsKey(sidBid))
     {
         List<Record22> rList = (System.Collections.Generic.List<Record22>)m_sidBidRecords[sidBid];
         rList.Add(r22);
     }
     else
     {
         List<Record22> rList = new List<Record22>();
         rList.Add( r22 );
         m_sidBidRecords.Add(sidBid, rList);
     }
 }
Exemplo n.º 3
0
        public void ProcessTheFile( string fileName )
        {
            // MAF only supports type01, 22 and 98.
            m_logger.WriteToLogFile("-NFORMATIONAL::MAFFileReader::ProcessTheFile():Entered");

            string type01 = "01";
            string type02 = "02";
            string type22 = "22";
            string type32 = "32";
            string type97 = "97";
            string type98 = "98";

            try
            {

                using (StreamReader sr = new StreamReader(fileName))
                {
                    char[] buff = new char[2];
                    int recordCount = 1;

                    //string str = sr.ReadToEnd();
                    while ((sr.Read(buff, 0, 2) != 0 ))
                    {
                        string recordType = buff[0].ToString() + buff[1].ToString();

                        if (recordType.Equals(type01))
                        {
                            // type 01, 02 record length = 200
                            // read the rest of the type 01 record
                            char[] buff1 = new char[200];

                            // first two elements are 01
                            sr.Read(buff1, 2, 198);
                            buff1[0] = buff[0];
                            buff1[1] = buff[1];

                            StringBuilder sb = new StringBuilder();

                            // process type 01 record
                            foreach (char c in buff1)
                                sb.Append( c.ToString() );

                            Record01 r01 = new Record01(sb.ToString());
                            //WriteToFile(@"d:\apps\data\test.dat", sb.ToString() );

                        }
                        else if (recordType.Equals(type22))
                        {
                            // type 22, record length = 547
                            // read the rest of the type 01 record
                            char[] buff22 = new char[547];
                            sr.Read(buff22, 2, 545);
                            buff22[0] = buff[0];
                            buff22[1] = buff[1];

                            StringBuilder sb = new StringBuilder();
                            // process type 22 record
                            foreach (char c in buff22)
                                sb.Append(c.ToString());

                            Record22 r22 = new Record22(sb.ToString());

                            // update the database with the following parameters for reporting
                            UpdateDb( r22 );
                            // FileWriter.Instance.WriteToLogFile( sb.ToString() );
                        }
                        else if (recordType.Equals(type32))
                        {
                            // type 32, record length = 567
                        }
                        else if (recordType.Equals(type02))
                        {
                            // type 22, record length = 200
                        }
                        else if (recordType.Equals(type97))
                        {
                            // type 97, record length = 200
                        }
                        else if (recordType.Equals(type98))
                        {
                            // type 98, record length = 200
                            // read the rest of the type 01 record
                            char[] buff98 = new char[200];
                            sr.Read(buff98, 2, 198);
                            buff98[0] = buff[0];
                            buff98[1] = buff[1];

                            StringBuilder sb = new StringBuilder();
                            // process type 22 record
                            foreach ( char c in buff98 )
                                sb.Append( c.ToString() );

                           Record98 r98 = new Record98( sb.ToString() );
                           // WriteToFile( "test", sb.ToString() );
                           break;

                        }
                        else
                        {
                            //
                        }

                        // increment our record count
                        recordCount++;

                    }// while loop - end of file

                }//using sr

            }//try
            catch (SystemException se)
            {
                m_logger.WriteToLogFile("-NEXCEPTION::MAFFileReader::ProcessTheFile():ECaught:" + se.Message + se.StackTrace );

            }
            m_logger.WriteToLogFile("-NFORMATIONAL::MAFFileReader::ProcessTheFile()Exiting");
        }
Exemplo n.º 4
0
 private void UpdateDb( Record22 r22 )
 {
     //add code for the update db method here
     // update the database with the following parameters
     // r22.CalledNumberDigits, r22.CallDate, r22.ServingPlace, r22.ServingStateProvince, r22.CallerId, r22.AirConnectTime,
     // r22.AirChargeableTime, r22.InitialCellSite, r22.TollChargeableTime, r22.Msid, r22.MsisdnMdn, r22.CallDirection, r22.EsnUimidImeiMeid
     m_dbMgr.InsertMafRecord(r22);
 }
Exemplo n.º 5
0
        public void InsertMafRecord( Record22 r22 )
        {
            //FileWriter.Instance.WriteToLogFile("-NFORMATIONAL::MAFDbMgr::InsertMafRecord()Entering");

            StringBuilder commandStr = new StringBuilder("INSERT INTO SprintMafRecord ");
            commandStr.Append(" ( HomeCarrierSidBid, CalledNumber, CallDate, ServingPlace, ServingStateProvince, CallerId, AirConnectTime,");
            commandStr.Append(" AirChargeableTime, InitialCellSite, TollChargeableTime, MsidIndicator, Msid, MsisdnMdnLength, Msisdn, EsnImeiIndicator,");
            commandStr.Append(" CallDirection, EsnImei, ServingCarrierSidBid, CallCompletionIndicator, CallTerminationIndicator, CallerIdLength,");
            commandStr.Append(" CalledNumberLength, Tldn, TldnLength, LocRoutingNumber, LocRoutingNumberLength, TimeZoneIndicator, DaylightSavingsIndicator,");
            commandStr.Append(" AirElapsedTime, SpecialFeaturesUsed, TollConnectTime, TollNetworkCarrierId, TollElapsedTime, TollRatingPointLengthIndicator,");
            commandStr.Append(" TollRatingPoint ) VALUES(" );

            try
            {
                using (SqlConnection dataConnection = new SqlConnection(_connectionString))
                {
                    // add try catch block around setting up the command
                    StringBuilder sb = new StringBuilder();
                    DateTime dt = new DateTime( DateTime.Now.Year, Convert.ToInt16( r22.CallDate.Substring(2, 2)),
                       Convert.ToInt16(r22.CallDate.Substring(4, 2)), Convert.ToInt16( r22.AirConnectTime.Substring(0, 2)),
                       Convert.ToInt16(r22.AirConnectTime.Substring(2, 2)), Convert.ToInt16( r22.AirConnectTime.Substring(4, 2) ) );

                    // get the call direction
                    String theCallDirection = GetCallDirection(r22.CallDirection);
                    String theSpecialFeature = GetSpecialFeatures(r22.SpecialFeaturesUsed);

                    // for now going to log the air connect time to find out why not converting time right (AM time, 00:00:00 AM )
                    //FileWriter.Instance.WriteToLogFile("MAFDbMgr::InsertMafRecord():CallDate:AirConnectTime:AirConnectTime(0,2):" + r22.CallDate + " : " +
                      //  r22.AirConnectTime + " : "  + r22.AirConnectTime.Substring(0, 2) + " : " + " DateTime::" + dt.ToString());

                    sb.Append("'" + r22.HomeCarrierSidBid + "'");
                    sb.Append(",'" + r22.CalledNumberDigits + "'");
                    sb.Append(",'" + dt.ToString() +"'");
                    sb.Append(",'" + r22.ServingPlace + "'");
                    sb.Append(",'" + r22.ServingStateProvince + "'");
                    sb.Append(",'" + r22.CallerId + "'");
                    sb.Append(",'" + r22.AirConnectTime + "'");
                    sb.Append(",'" + r22.AirChargeableTime + "'");
                    sb.Append(",'" + r22.InitialCellSite + "'");
                    sb.Append(",'" + r22.TollChargeableTime + "'");
                    sb.Append(",'" + r22.MsidIndicator + "'");
                    sb.Append(",'" + r22.Msid + "'");
                    sb.Append(",'" + r22.MsisdnMdnLength + "'");
                    sb.Append(",'" + r22.MsisdnMdn + "'");
                    sb.Append(",'" + r22.EsnUimidImeiMeidIndicator + "'");
                    sb.Append(",'" + theCallDirection + "'");
                    sb.Append(",'" + r22.EsnUimidImeiMeid + "'");
                    sb.Append(",'" + r22.ServingCarrierSidBid + "'");
                    sb.Append(",'" + r22.CallCompletionIndicator + "'");
                    sb.Append(",'" + r22.CallTerminationIndicator + "'");
                    sb.Append(",'" + r22.CallerIdLength + "'");
                    sb.Append(",'" + r22.CalledNumberLength + "'");
                    sb.Append(",'" + r22.Tldn + "'");
                    sb.Append(",'" + r22.TldnLength + "'");
                    sb.Append(",'" + r22.LocationRoutingNumber + "'");
                    sb.Append(",'" + r22.LocationRoutingNumberLengthIndicator + "'");
                    sb.Append(",'" + r22.TimeZoneIndicator + "'");
                    sb.Append(",'" + r22.DaylightSavingIndicator + "'");
                    sb.Append(",'" + r22.AirElapsedTime + "'");
                    sb.Append(",'" + theSpecialFeature + "'");
                    sb.Append(",'" + r22.TollConnectTime + "'");
                    sb.Append(",'" + r22.TollNetworkCarrierId + "'");
                    sb.Append(",'" + r22.TollElapsedTime + "'");
                    sb.Append(",'" + r22.TollRatingPointLengthIndicator + "'");
                    sb.Append(",'" + r22.TollRatingPoint + "'" + ")");

                    // write the CDR to the database
                    string tc = commandStr.ToString() + sb.ToString();
                    try
                    {
                        dataConnection.Open();
                        SqlCommand sqlCommand = new SqlCommand(tc, dataConnection);
                        sqlCommand.CommandType = CommandType.Text;
                        sqlCommand.ExecuteNonQuery();
                    }
                    catch (Exception ex)
                    {
                        FileWriter.Instance.WriteToLogFile("MAFDbMgr::InsertMafRecord():ECaught:" + ex.Message + ex.StackTrace);
                    }

                }//using

            }//try
            catch (Exception ex)
            {
                FileWriter.Instance.WriteToLogFile("MAFDbMgr::InsertMafRecord():ECaught:" + ex.Message + ex.StackTrace);
            }

            // FileWriter.Instance.WriteToLogFile("-NFORMATIONAL::MAFDbMgr::InsertMafRecord()Exiting");
        }
Exemplo n.º 6
0
 private Strata8.Wireless.Cdr.Rating.Record22 ProcessRecordType22(string line)
 {
     // construct the record
     Record22 r = new Record22(line);
     return r;
 }
Exemplo n.º 7
0
        /// <summary>
        /// private method to parse the dids in the file
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        private ArrayList ReadTheFile(string fileName)
        {
            // make the array size (number of cdrs per file ) configurable
            System.Collections.ArrayList theControls = new System.Collections.ArrayList(1000);
            char[] sep = new char[] { ',' };
            char[] trim = new char[] { ' ' };
            int lineNumber = 1;
            try
            {
                using (StreamReader sr = new StreamReader(fileName))
                {
                    String line;
                    bool callHit = false;

                    while ((line = sr.ReadLine()) != null)
                    {

                        try
                        {

                            //// parse the line
                            //string[] controls = line.Split(sep);
                            //if (controls.GetLength(0) < 0)
                            //{
                            //    // we have a non-data line -- header or footer... so skip it
                            //    continue;
                            //}

                            //string did = controls[0].Trim().Replace(" ", String.Empty);
                            //// cache the record
                            //theControls.Add( did );
                            string recordType = line.Substring(0, 2);

                            switch (recordType)
                            {
                                case ("01"):
                                    {
                                        Console.WriteLine("Type 01 RecordType : Batch Header Record");
                                        Record01 r = ProcessRecordType01(line);

                                        // let us look and see
                                        Console.WriteLine(r.ToString());
                                        break;
                                    }
                                case ("02"):
                                    {
                                        Console.WriteLine("Type 01 RecordType : ClearingHouse Batch Header Record");
                                        Record02 r = ProcessRecordType02(line);

                                        // let us look and see
                                        Console.WriteLine(r.ToString());
                                        break;
                                    }
                                case ("22"):
                                    {
                                        Record22 r = new Record22(line);

                                        if (r.CallDate.Equals("110816"))
                                        {
                                            Console.WriteLine("Type 22 RecordType : Air and Toll Charges Record");
                                            Console.WriteLine(r.ToString());
                                            callHit = true;
                                        }
                                        //look and see for now
                                        //Console.WriteLine(r.ToString());
                                        break;
                                    }
                                case ("52"):
                                    {
                                        Console.WriteLine("Type 52 RecordType : Billing OCC Charge Record");
                                        //Record52 r = new Record52(line);

                                        ////look and see for now
                                        //Console.WriteLine(r.ToString());
                                        break;
                                    }
                                case ("98"):
                                    {
                                        Console.WriteLine("Type 98 RecordType : Batch Trailer Record");
                                        Record98 r = ProcessRecordType98(line);

                                        // let us look and see
                                        if (callHit)
                                        {
                                            Console.WriteLine(r.ToString());
                                            callHit = false;
                                        }

                                        break;
                                    }
                                default:
                                    {
                                        break;
                                    }

                            }
                            //Console.WriteLine(line.ToString());
                            lineNumber++;
                        }
                        catch (System.Exception ex)
                        {
                            string errorMsg = "Error in File>" + fileName + " Line>" + lineNumber;
                            if (line != null)
                            {// add the line information if available
                                errorMsg += "Line>" + line;
                            }
                            LogFileError(errorMsg + "\r\n" + ex.Message + "\r\n" + ex.StackTrace);
                        }
                    }
                }
            }// try
            catch (Exception e)
            {
                LogFileError(e.Message + "\r\n" + e.StackTrace);
            }// catch

            return theControls;
        }
Exemplo n.º 8
0
 /// <summary>
 /// method used to create a CDR based on the MSC/OMC CDR and the 
 /// CIBER record type 22.
 /// </summary>
 /// <param name="oCdr"></param>
 /// <param name="r22"></param>
 /// <returns></returns>
 public Bcdr CreateCdr(OmcCdr oCdr, Record22 r22 )
 {
     // populate the bworks cdr here and return it
     Bcdr bCdr = new Bcdr(oCdr);
     return bCdr;
 }