Exemplo n.º 1
0
		//public string AddressValidation(int leadID)
		//{
		//  ValidationAddress validAddress;
		//  Address currentAddress;
		//  Lead lead = new Lead();
		//  lead = DataManager.GetLeadById(leadID);
		//  currentAddress = lead.SubjectPropertyAddress;
		//  validAddress = GetValidAddress(currentAddress);
		//  bool isAddressMatch;
		//  if (validAddress.Error == null)
		//  {
		//    if (string.IsNullOrWhiteSpace(validAddress.Address) || (validAddress.Address.ToLower().Equals(currentAddress.Street.ToLower())))
		//    {
		//      isAddressMatch = true;
		//    }
		//    return validAddress.Address;
		//  }
		//  else
		//  {
		//    return validAddress.Error.Description;
		//  }
		//}

		public static bool CompareAddresses(Address currentAddress, ValidationAddress validAddress)
		{
			bool isAddressMatch = false;
			bool isCityMatch = false;
	//		bool isCountryMatch = false;
			bool isStateMatch = false;
			bool isZipCodeMatch = false;
			if (string.IsNullOrWhiteSpace(currentAddress.Street) || currentAddress.Street.ToLower().Equals(validAddress.Address.ToLower()))
			{
				isAddressMatch = true;
			}
			if (string.IsNullOrWhiteSpace(currentAddress.City) || currentAddress.City.ToLower().Equals(validAddress.City.ToLower()))
			{
				isCityMatch = true;
			}
			//if (string.IsNullOrWhiteSpace(currentAddress.Country.Name) || currentAddress.Country.Name.ToLower().Equals(validAddress.Country.ToLower()))
			//{
			//  isCountryMatch = true;
			//}
			if (string.IsNullOrWhiteSpace(currentAddress.State) || currentAddress.State.ToLower().Equals(validAddress.State.ToLower()))
			{
				isStateMatch = true;
			}
			if (string.IsNullOrWhiteSpace(currentAddress.ZipCode) || currentAddress.ZipCode.ToLower().Equals(validAddress.ZipCode.ToLower()))
			{
				isZipCodeMatch = true;
			}
			if (isAddressMatch && isCityMatch && isStateMatch && isZipCodeMatch)
			{
				return true;
			}
			return false;
		}
Exemplo n.º 2
0
		private static ValidationAddress ToValidationAddress(FragmentAddress fAddress)
		{
			ValidationAddress validationAddress = new ValidationAddress();
			if (!string.IsNullOrEmpty(fAddress.Address))
			{
				validationAddress.Address = fAddress.Address;
			}
			if (!string.IsNullOrEmpty(fAddress.CountyName))
			{
				validationAddress.Country = fAddress.CountyName;
			}
			if (!string.IsNullOrEmpty(fAddress.City))
			{
				validationAddress.City = fAddress.City;
			}
			if (!string.IsNullOrEmpty(fAddress.State))
			{
				validationAddress.State = fAddress.State;
			}
			if (!string.IsNullOrEmpty(fAddress.City))
			{
				validationAddress.ZipCode = fAddress.Zip;
			}
			if (fAddress.Error != null)
			{
				ValidationAddressError error = new ValidationAddressError();
				error.Description = fAddress.Error[0].Desc;
				error.Location = fAddress.Error[0].Location;
				try
				{
					error.Number = int.Parse(fAddress.Error[0].Number);
				}
				catch (ArgumentNullException)
				{
					throw;
				}
				validationAddress.Error = error;
			}
			return validationAddress;
		}
Exemplo n.º 3
0
		public static int SaveValidationAddress(ValidationAddress address)
		{
			return _provider.SaveValidationAddress(address);
		}
Exemplo n.º 4
0
		public AddressValidationRezult GetAddressValidationInformation(int validationID)
		{
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				CCTLeadProvider leadProvider = new CCTLeadProvider();
				T_Lead tLead;
				T_ValidationAddress tValAddress;
				T_ValidationResult tRezult;
				T_Validation tValidation;
				T_ValidationStatus tStatus;
				T_ValidationAddressError tError;
				AddressValidationRezult avRezult = new AddressValidationRezult();
				tValidation = dc.T_Validations.Where(v => v.ValidationID == validationID).SingleOrDefault();
				tLead = dc.T_Leads.Where(l => l.LeadID == tValidation.LeadID).SingleOrDefault();
				tRezult = dc.T_ValidationResults.Where(r => r.ValidationID == validationID).FirstOrDefault();
				tValAddress = dc.T_ValidationAddresses.Where(va => va.AddressID == tRezult.AddressID).SingleOrDefault();
				tStatus = dc.T_ValidationStatus.Where(s => s.StatusID == tRezult.StatusID).SingleOrDefault();
				if (tValAddress != null)
				{
					if (tValAddress.ErrorID.HasValue)
					{
						tError = dc.T_ValidationAddressErrors.Where(e => e.ErrorID == tValAddress.ErrorID).FirstOrDefault();
						ValidationAddressError vaError = new ValidationAddressError();
						ValidationAddress vAddress = new ValidationAddress();
						vaError = GetValidationAddressErrorEntity(tError);
						vAddress.Error = vaError;
						avRezult.CorrectAddress = vAddress;
					}
					else
					{
						avRezult.CorrectAddress = GetValidationAddressEntity(tValAddress);
					}
				}
				if (tLead != null)
				{
					avRezult.Lead = leadProvider.GetLeadEntity(tLead);
				}
				if (tStatus != null)
				{
					avRezult.Status = GetValidationStatusEntity(tStatus);
				}

				return avRezult;
			}
		}
Exemplo n.º 5
0
		private ValidationAddress GetValidationAddressEntity(T_ValidationAddress tAddress)
		{
			ValidationAddress vAddress = new ValidationAddress();
			vAddress.AddressID = tAddress.AddressID;
			vAddress.City = tAddress.vadCity;
			vAddress.Country = tAddress.vadCountry;
			vAddress.State = tAddress.vadState;
			vAddress.Address = tAddress.vadAddress;
			vAddress.ZipCode = tAddress.vadZipCode;
			return vAddress;
		}
Exemplo n.º 6
0
		public int SaveValidationAddress(ValidationAddress address)
		{
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				T_ValidationAddressError tError = new T_ValidationAddressError();
				if (address.Error != null)
				{
					tError.erDesc = address.Error.Description;
					tError.erLocation = address.Error.Location;
					tError.erNumber = address.Error.Number;
					dc.T_ValidationAddressErrors.InsertOnSubmit(tError);
					dc.SubmitChanges();
				}
				T_ValidationAddress tAddress = new T_ValidationAddress();
				if (!string.IsNullOrEmpty(address.Address))
				{
					tAddress.vadAddress = address.Address;
				}
				if (!string.IsNullOrEmpty(address.City))
				{
					tAddress.vadCity = address.City;
				}
				if (!string.IsNullOrEmpty(address.Country))
				{
					tAddress.vadCountry = address.Country;
				}
				if (!string.IsNullOrEmpty(address.State))
				{
					tAddress.vadState = address.State;
				}
				if (!string.IsNullOrEmpty(address.ZipCode))
				{
					tAddress.vadZipCode = address.ZipCode;
				}
				if (address.Error != null)
				{
					tAddress.ErrorID = tError.ErrorID;
				}
				dc.T_ValidationAddresses.InsertOnSubmit(tAddress);
				dc.SubmitChanges();
				return tAddress.AddressID;
			}
		}