Пример #1
0
 public DataCleaner(NameValueCollection c)
 {
     Initialize(c);
     ForceValidation = false;
     _db = new DataCleanRespository(); 
     _msgDict = new ParseResultDictionary(_db.GetMelissaReference());
 }
        public void CanGetParseDictionaryWarningsTest()
        {
            var db = new DataCleanRespository();
            var msgDict = new ParseResultDictionary(db.GetMelissaReference());
            Assert.IsTrue(msgDict.GetAllWarningMessages().Count() > 3);

        }
        public void CanGetParseDictionaryTest()
        {
            var db = new DataCleanRespository();
            var msgDict = new ParseResultDictionary(db.GetMelissaReference());
            Assert.IsTrue(msgDict.Count > 300);

        }
        public void CanDoLookupTest()
        {
            var db = new DataCleanRespository();
            var msgDict = new ParseResultDictionary(db.GetMelissaReference());
            var c = msgDict.LookupCode(PostalCodeErrorCode);
            Assert.IsTrue(c.Code == PostalCodeErrorCode);
            Assert.IsTrue(c.LongDescription.Length > 0 );

        }
        public static OutputStreetAddress ProcessResponseRecord(ResponseRecord respRec, ParseResultDictionary _msgDict )
        {

            var o = new OutputStreetAddress()
            {
                AddressDeliveryInstallation = respRec.AddressDeliveryInstallation,
                AddressExtras = respRec.AddressExtras,
                AddressHouseNumber = respRec.AddressHouseNumber,
                AddressKey = respRec.AddressKey,
                AddressLine1 = respRec.AddressLine1,
                AddressLine2 = respRec.AddressLine2,
                AddressLockBox = respRec.AddressLockBox,
                AddressPostDirection = respRec.AddressPostDirection,
                AddressPreDirection = respRec.AddressPreDirection,
                AddressPrivateMailboxName = respRec.AddressPrivateMailboxName,
                AddressPrivateMailboxRange = respRec.AddressPrivateMailboxRange,
                AddressRouteService = respRec.AddressRouteService,
                AddressStreetName = respRec.AddressStreetName,
                AddressStreetSuffix = respRec.AddressStreetSuffix,
                AddressSuiteName = respRec.AddressSuiteName,
                AddressSuiteNumber = respRec.AddressSuiteNumber,
                AddressTypeCode = respRec.AddressTypeCode,
                AreaCode = respRec.AreaCode,
                CBSACode = respRec.CBSACode,
                CBSADivisionCode = respRec.CBSADivisionCode,
                CBSADivisionLevel = respRec.CBSADivisionLevel,
                CBSADivisionTitle = respRec.CBSADivisionTitle,
                CBSALevel = respRec.CBSALevel,
                CBSATitle = respRec.CBSATitle,
                CarrierRoute = respRec.CarrierRoute,
                CensusBlock = respRec.CensusBlock,
                CensusTract = respRec.CensusTract,
                City = respRec.City,
                CityAbbreviation = respRec.CityAbbreviation,
                CompanyName = respRec.CompanyName,
                CongressionalDistrict = respRec.CongressionalDistrict,
                CountryCode = respRec.CountryCode,
                CountryName = respRec.CountryName,
                CountyFIPS = respRec.CountyFIPS,
                CountyName = respRec.CountyName,
                DateOfBirth = respRec.DateOfBirth,
                DateOfDeath = respRec.DateOfDeath,
                DeliveryIndicator = respRec.DeliveryIndicator,
                DeliveryPointCheckDigit = respRec.DeliveryPointCheckDigit,
                DeliveryPointCode = respRec.DeliveryPointCode,
                DemographicsGender = respRec.DemographicsGender,
                DemographicsResults = respRec.DemographicsResults,
                DomainName = respRec.DomainName,
                EmailAddress = respRec.EmailAddress,
                Gender = respRec.Gender,
                Gender2 = respRec.Gender2,
                HouseholdIncome = respRec.HouseholdIncome,
                Latitude = respRec.Latitude,
                LengthOfResidence = respRec.LengthOfResidence,
                Longitude = respRec.Longitude,
                MailboxName = respRec.MailboxName,
                MaritalStatus = respRec.MaritalStatus,
                NameFirst = respRec.NameFirst,
                NameFirst2 = respRec.NameFirst2,
                NameFull = respRec.NameFull,
                NameLast = respRec.NameLast,
                NameLast2 = respRec.NameLast2,
                NameMiddle = respRec.NameMiddle,
                NameMiddle2 = respRec.NameMiddle2,
                NamePrefix = respRec.NamePrefix,
                NamePrefix2 = respRec.NamePrefix2,
                NameSuffix = respRec.NameSuffix,
                NameSuffix2 = respRec.NameSuffix2,
                NewAreaCode = respRec.NewAreaCode,
                Occupation = respRec.Occupation,
                OwnRent = respRec.OwnRent,
                PhoneExtension = respRec.PhoneExtension,
                PhoneNumber = respRec.PhoneNumber,
                PhonePrefix = respRec.PhonePrefix,
                PhoneSuffix = respRec.PhoneSuffix,
                PlaceCode = respRec.PlaceCode,
                PlaceName = respRec.PlaceName,
                Plus4 = respRec.Plus4,
                PostalCode = respRec.PostalCode,
                PresenceOfChildren = respRec.PresenceOfChildren,
                PrivateMailBox = respRec.PrivateMailBox,
                RecordExtras = respRec.RecordExtras,
                Results = _msgDict.LookupCodeList(respRec.Results.Split(',')).ToList(),
                Salutation = respRec.Salutation,
                State = respRec.State,
                StateName = respRec.StateName,
                Suite = respRec.Suite,
                TopLevelDomain = respRec.TopLevelDomain,
                UTC = respRec.UTC,
                UrbanizationName = respRec.UrbanizationName
            };

            var i = SetIDS(respRec.RecordID);
            o.RecordID = i[0];
            o.ID = (int) int.Parse(i[1]);
            return o;
        }
Пример #6
0
        static void Main(string[] args)
        {
            var ctx = new DataCleanEntities();
            var p = new ParseResultDictionary();
            Console.WriteLine("Load Codes");
            int totalCnt= 0;
            int insCnt = 0;
            foreach (var v in p.ToList())
            {
                totalCnt += 1;
                try
                {
                    var z = new MelissaResultReference()
                    {
                        Code = v.Value.Code,
                        Type = v.Value.Type,
                        LongDescription = v.Value.LongDescription,
                        ShortDescription = v.Value.ShortDescription
                    };
                    ctx.MelissaResultReferences.Add(z);

                    ctx.SaveChanges();
                    insCnt += 1;
                }
                catch (DbEntityValidationException dbEx)
                {
                    foreach (var validationErrors in dbEx.EntityValidationErrors)
                    {
                        foreach (var validationError in validationErrors.ValidationErrors)
                        {
                            Trace.TraceInformation("Property: {0} Error: {1}",
                                validationError.PropertyName,
                                validationError.ErrorMessage);
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("{0} {1} {2}", v.Value.Code, v.Value.Type, v.Value.LongDescription);
                    Console.WriteLine(" Error {0} ", e.Message + " || "  + ((e.InnerException != null) ? e.InnerException.Message : ""));
                }

            }

            Console.WriteLine(" !!Done!! ");
            Console.WriteLine(" {0} Rows Read {1} Rows written ", totalCnt, insCnt);
            Console.ReadKey();
            //Console.WriteLine("CHECKS");

            //foreach (var v in ctx.vwPayments.Take(100).ToList())
            //{
            //    Console.WriteLine("{0} {1} {2} {3}", v.tran_id, v.job_num, v.batch_num, v.check_num);
                
            //};
            //Console.ReadKey();

            //Console.WriteLine("Bank Accounts");

            //foreach (var v in ctx.bank_accounts.Take(100).ToList())
            //{
            //    Console.WriteLine("{0} {1}  ", v.account_id, v.account_name);
            //};
            //Console.ReadKey();
        }
Пример #7
0
 public DataCleaner(NameValueCollection c, List<ParseResult> melissaCodes)
 {
     Initialize(c);
     _msgDict = new ParseResultDictionary(melissaCodes);
 }