Ejemplo n.º 1
0
		protected void btnClickUpdate(object sender, EventArgs e)
		{
			hfSelectedTab.Value = _tabAddressValidation;
			Country country = new Country();
			int validationID = GetValidationID();
			CCTLeadProvider provider = new CCTLeadProvider();
			AddressValidationRezult avRezult = new AddressValidationRezult();
			Address address = new Address();
			avRezult = LeadValidationManager.GetAddressValidationInformation(validationID);
			var viAddress = LeadValidationManager.GetValidationInformation(validationID);
			address.AddressID = viAddress.Lead.SubjectPropertyAddress.AddressID;
			address.City = avRezult.CorrectAddress.City;
			country.Name = viAddress.Lead.SubjectPropertyAddress.Country.Name;
			address.Country = country;
			address.State = avRezult.CorrectAddress.State;
			address.Street = avRezult.CorrectAddress.Address;
			address.ZipCode = avRezult.CorrectAddress.ZipCode;
			provider.SaveAddress(address);
			LeadValidationManager.ChangeStatus(validationID, (int)TypeValidation.AddressValidation, (int)StatusValidation.Passed);
			lvAddrVal.DataBind();
			DataManager.LeadModified(viAddress.Lead.LeadID.Value);
		}
Ejemplo n.º 2
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;
			}
		}