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; }
public static int SaveValidationAddressError(ValidationAddressError error) { return _provider.SaveValidationAddressError(error); }
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; } }
public int SaveValidationAddressError(ValidationAddressError error) { using (var dc = new EngageCCTDataClassesDataContext()) { T_ValidationAddressError tError = new T_ValidationAddressError(); tError.erDesc = error.Description; tError.erLocation = error.Location; tError.erNumber = error.Number; dc.T_ValidationAddressErrors.InsertOnSubmit(tError); dc.SubmitChanges(); return tError.ErrorID; } }
public int SaveAddrValidation(int validationID, Lead lead, string status) { using (var dc = new EngageCCTDataClassesDataContext()) { int addrValStatus = 0; int addressID; T_ValidationResult tResult = new T_ValidationResult(); T_ValidationAddress tAddress = new T_ValidationAddress(); T_ValidationAddressError tError = new T_ValidationAddressError(); tResult.ValidationID = validationID; tResult.TypeID = (int)TypeValidation.AddressValidation; if (status != ValidationConstants.StatusNoInformation) { var validAddress = LeadValidationManager.GetValidAddress(lead.SubjectPropertyAddress); if (validAddress.Error != null) { int errorID; ValidationAddressError error = new ValidationAddressError(); error.Description = validAddress.Error.Description; error.Location = validAddress.Error.Location; error.Number = validAddress.Error.Number; errorID = SaveValidationAddressError(error); addrValStatus = (int)StatusValidation.Failed; tAddress.ErrorID = errorID; } else { // SaveValidationAddress(validAddress); bool isCorrect = LeadValidationManager.CompareAddresses(lead.SubjectPropertyAddress, validAddress); if (isCorrect) { addrValStatus = (int)StatusValidation.Passed; } else { addrValStatus = (int)StatusValidation.Error; } } addressID = SaveValidationAddress(validAddress); tResult.AddressID = addressID; tResult.StatusID = addrValStatus; } else { addrValStatus = (int)StatusValidation.NoInformation; tResult.StatusID = addrValStatus; } dc.T_ValidationResults.InsertOnSubmit(tResult); dc.SubmitChanges(); return addrValStatus; } }
private ValidationAddressError GetValidationAddressErrorEntity(T_ValidationAddressError tError) { using (var dc = new EngageCCTDataClassesDataContext()) { ValidationAddressError vaError = new ValidationAddressError(); vaError.ErrorID = tError.ErrorID; vaError.Description = tError.erDesc; vaError.Location = tError.erLocation; vaError.Number = (int)tError.erNumber; return vaError; } }