Exemplo n.º 1
0
        public void Execute(ref Address address)
        {
            Parameters.AddWithValue("@Company", string.Empty);
            Parameters.AddWithValue("@RawAddress", address.RawAddress);
            Parameters.AddWithValue("@RawAddress2", address.RawAddress2);
            Parameters.AddWithValue("@City", address.City);
            Parameters.AddWithValue("@State", address.State);
            Parameters.AddWithValue("@ZipCode", address.ZipCode);
            Parameters.AddWithValue("@ZipFour", address.ZipFour);
            Parameters.AddWithValue("@County", address.County);
            Parameters.AddWithValue("@AddressTypeID", (int?) address.AddressTypeID);
            Parameters.AddWithValue("@Standardized", address.Standardized);
            Parameters.AddWithValue("@StandardizedAddress", address.StandardizedAddress);
            Parameters.AddWithValue("@StandardizedCityStZip", address.StandardizedCityStZip);
            Parameters.AddWithValue("@StandardizationResult", (int?) address.StandardizationResult);
            Parameters.AddWithValue("@StandardizationWarnings", address.StandardizationWarnings);
            Parameters.AddWithValue("@CarrierRoute", address.CarrierRoute);
            Parameters.AddWithValue("@Latitude", address.Latitude);
            Parameters.AddWithValue("@Longitude", address.Longitude);
            Parameters.AddWithValue("@DPV", address.DPV);
            Parameters.AddWithValue("@Vacant", address.Vacant);
            Parameters.AddWithValue("@Deliverable", address.Deliverable);
            Parameters.AddWithValue("@InsertJobID", address.InsertJobID);

            DataTable t = ExecuteReader();
            DataRow row = t.Rows[0];
            address.AddressID = row.Field<int>("AddressID");
        }
Exemplo n.º 2
0
        public void GeoCodeAddress(ref Address address)
        {
            GeoCodeResult result = LookupZipCode(address.ZipCode + address.ZipFour);
            if (result.Found)
            {
                log.DebugFormat("Latitude: String {0}, Decimal {1}", result.Latitude, address.Latitude);
                log.DebugFormat("Longitude: String {0}, Decimal {1}", result.Longitude, address.Longitude);

                address.Latitude = Convert.ToDecimal(result.Latitude);
                address.Longitude = Convert.ToDecimal(result.Longitude);
            }
        }
        private Address CreateTestAddress()
        {
            Address a = new Address();
            a.Company = "Test Company";
            a.RawAddress = "123 Main St";
            a.City = "Lafayette";
            a.State = "GA";
            a.ZipCode = "30728";
            a.ZipFour = "1713";
            a.InsertJobID = 0;

            return a;
        }
Exemplo n.º 4
0
        public void Execute(ref Address address)
        {
            Parameters.AddWithValue("@AddressID", address.AddressID);
            Parameters.AddWithValue("@AddressTypeID", (int) address.AddressTypeID);
            Parameters.AddWithValue("@CarrierRoute", address.CarrierRoute);
            Parameters.AddWithValue("@City", address.City);
            Parameters.AddWithValue("@County", address.County);
            Parameters.AddWithValue("@DPV", address.DPV);
            Parameters.AddWithValue("@Deliverable", address.Deliverable);
            Parameters.AddWithValue("@Latitude", address.Latitude);
            Parameters.AddWithValue("@Longitude", address.Longitude);
            Parameters.AddWithValue("@Standardized", address.Standardized);
            Parameters.AddWithValue("@StandardizedAddress", address.StandardizedAddress);
            Parameters.AddWithValue("@StandardizedCityStZip", address.StandardizedCityStZip);
            Parameters.AddWithValue("@StandardizationResult", (int?) address.StandardizationResult);
            Parameters.AddWithValue("@StandardizationWarnings", address.StandardizationWarnings);
            Parameters.AddWithValue("@State", address.State);
            Parameters.AddWithValue("@UpdateJobID", address.UpdateJobID);
            Parameters.AddWithValue("@Vacant", address.Vacant);
            Parameters.AddWithValue("@ZipCode", address.ZipCode);
            Parameters.AddWithValue("@ZipFour", address.ZipFour);
            ExecuteNonQuery();

        }
Exemplo n.º 5
0
        public int LookupAddress(ref Address address)
        {
            int result = -1;
            Clear();
            inputPrimaryAddress = address.RawAddress;
            inputPrimaryAddress = address.RawAddress;
            if (!string.IsNullOrEmpty(address.RawAddress2))
            {
                inputSecondaryAddress = address.RawAddress2;
            }
            inputCityName = address.City;
            inputStateName = address.State;
            inputZipCode = address.ZipCode;
            log.DebugFormat("{0} {1},{2} {3}", inputPrimaryAddress, inputCityName, inputStateName, inputZipCode);

            CASSLookup();
            address.CarrierRoute = resultCarrierRouteCode;
            address.County = resultCountyName;
            address.DPV = resultDPV;
            address.StandardizedAddress = resultPrimaryAdddress;
            address.StandardizedCityStZip = resultLastLine;
            if (Int32.TryParse(resultReturnCode, out result))
            {
                address.StandardizationResult = result;
            }
            address.Vacant = resultVacancyFlag == "Y";
            address.ZipCode = resultZipCode;
            address.ZipFour = resultPlus4;

            //address.StandardizationWarnings = resultErrorAndWarning;
            address.StandardizationWarnings = GetStandardizationWarnings(result);
            address.Standardized = true;
            address.Deliverable = result == 31;

            log.DebugFormat("resultReturnCode: {0}", result);
            return result;
        }
 public int AddressStandardize(ref Address address)
 {
     AddressServiceClient client = new AddressServiceClient();
     int result = 0;
     //int result = client.GetStandardizedAddress(ref address);
     return result;
 }
        public void AddressFind(ref Address address)
        {
            if (address.AddressID > 0)
            {
                return;
            }
            byte[] hash = address.ComputedHash();
            if (hash != null)
            {

                StoredProcedure proc = new StoredProcedure(SQLResource.FindAddress, ConnectionString);
                SqlParameter param = new SqlParameter()
                {
                    ParameterName = "@AddressHash",
                    SqlDbType = SqlDbType.VarBinary,
                    Value = hash
                };
                proc.Parameters.Add(param);


                DataTable t = proc.ExecuteReader();
                if (t.Rows.Count > 0)
                {
                    address.AddressID = t.Rows[0].Field<int>("AddressID");
                }
            }
        }
 public void AddressSave(ref Address address)
 {
     if (address.AddressID == 0)
     {
         AddressAdd(ref address);
     }
     else
     {
         AddressUpdate(address);
     }
 }
 private void AddressUpdate(Address address)
 {
     spAddressUpdate proc = new spAddressUpdate(this.ConnectionString);
     proc.Execute(ref address);
 }
Exemplo n.º 10
0
 private void AddressAdd(ref Address address)
 {
     spAddAddress proc = new spAddAddress(this.ConnectionString);
     proc.Execute(ref address);
 }
Exemplo n.º 11
0
 public ClientOrgModel(ClientOrganization org, Address address)
 {
     this.clientOrg = org;
     this.address = address;
 }
Exemplo n.º 12
0
 public Address Clone()
 {
     Address result = new Address();
     result.AddressID = this.AddressID;
     result.AddressHash = this.AddressHash;
     result.Company = this.Company;
     result.RawAddress = this.RawAddress;
     result.RawAddress2 = this.RawAddress2;
     result.City = this.City;
     result.State = this.State;
     result.ZipCode = this.ZipCode;
     result.ZipFour = this.ZipFour;
     result.County = this.County;
     result.AddressTypeID = this.AddressTypeID;
     result.Standardized = this.Standardized;
     result.StandardizedAddress = this.StandardizedAddress;
     result.StandardizedCityStZip = this.StandardizedCityStZip;
     result.StandardizationResult = this.StandardizationResult;
     result.StandardizationWarnings = this.StandardizationWarnings;
     result.CarrierRoute = this.CarrierRoute;
     result.Latitude = this.Latitude;
     result.Longitude = this.Longitude;
     result.DPV = this.DPV;
     result.Vacant = this.Vacant;
     result.MailabilityScore = this.MailabilityScore;
     result.Deliverable = this.Deliverable;
     result.InsertJobID = this.InsertJobID;
     result.UpdateJobID = this.UpdateJobID;
     result.EncounterImportID = this.EncounterImportID;
     return result;
 }
Exemplo n.º 13
0
        AddressServiceResult IAddressService.GetStandardizedAddress(AddressServiceParameter asp)
        {
            if (asp == null)
            {
                throw new ArgumentNullException(nameof(asp));
            }

            log.DebugFormat("Standardizing Address {0}", asp.Address);
            AddressServiceResult result = new AddressServiceResult();
            result.ID = asp.ID;

            // map incoming parameters to an Address object we can use
            Address a = new Address();
            a.RawAddress = asp.Address;
            a.RawAddress2 = asp.Address2;
            a.City = asp.City;
            a.State = asp.State;
            a.ZipCode = asp.ZipCode;
            a.ZipFour = asp.ZipFour;

            int returnCode = Cass.LookupAddress(ref a);
            log.DebugFormat("StandardizationResult: {0}", returnCode);
            Geo.GeoCodeAddress(ref a);

            // set results to send back
            switch (returnCode)
            {
                case 10: // Invalid Address
                    result.StandardizationWarnings = "Invalid Address";
                    break;
                case 11: // Invalid Zip Code
                    result.StandardizationWarnings = "Invalid ZipCode";
                    break;
                case 12: // Invalid State Code
                    result.StandardizationWarnings = "Invalid State Code";
                    break;
                case 13: // Invalid City
                    result.StandardizationWarnings = "Invalid City";
                    break;
                case 21: // Address Not Found
                    result.StandardizationWarnings = "Address not found";
                    break;
                case 22: // Multiple Response
                    result.StandardizationWarnings = "Multiple Response";
                    break;
                case 31: // Exact Match
                    result.StandardizationWarnings = "Exact Match";
                    result.CarrierRoute = a.CarrierRoute;
                    result.County = a.County;
                    result.DPV = a.DPV;
                    //result.FamilyID = a.FamilyId;
                    result.Latitude = a.Latitude.Value;
                    result.Longitude = a.Longitude.Value;
                    result.StandardizationWarnings = a.StandardizationWarnings;
                    result.StandardizedAddress = a.StandardizedAddress;
                    result.StandardizedCityStZip = String.Format("{0}, {1} {2}-{3}", a.City, a.State, a.ZipCode, a.ZipFour);
                    result.Vacant = a.Vacant.Value;
                    result.ZipCode = a.ZipCode;
                    result.ZipFour = a.ZipFour;
                    break;
                case 32: // Default Response
                    result.StandardizationWarnings = "Missing Suite information";
                    break;
                default:
                    break;                
            }

            result.StandardizationResult = returnCode;
            result.AddressType = MapAddressType(Cass.resultAddressRecordType);

            return result;
        }