Exemplo n.º 1
0
		public int SaveValidationLead(ValidationLead validation)
		{

			using (var dc = new EngageCCTDataClassesDataContext())
			{
				T_Validation tValidation = new T_Validation();

				tValidation.LeadID = (int)validation.Lead.LeadID;
				tValidation.Login = validation.User.Login;
				tValidation.vldDate = DateTime.Now;
				dc.T_Validations.InsertOnSubmit(tValidation);


				dc.SubmitChanges();

				List<ValidationResult> results = validation.Results;
				int ofac = 0;
				int exList = 0;
				int addVal = 0;

				int noInfoStatus = dc.T_ValidationStatus
					.Where(s => s.vsDescription == ValidationConstants.StatusNoInformation)
					.Select(f => f.StatusID).First();


				foreach (var result in results)
				{
					switch (result.Type.Type)
					{
						case ValidationConstants.OFAC:
							ofac = SaveOFAC(tValidation.ValidationID, validation.Lead, result.Status.Status);
							break;
						case ValidationConstants.FreddieList:
							exList = SaveExcList(tValidation.ValidationID, validation.Lead, result.Status.Status);
							break;
						case ValidationConstants.Address:
							addVal = SaveAddrValidation(tValidation.ValidationID, validation.Lead, result.Status.Status);
							break;
						default: break;
					}
				}

				var tLead = dc.T_Leads.Where(l => l.LeadID == (int)validation.Lead.LeadID).First();
				tLead.ldOFAC = ofac;
				tLead.ldAddrVal = addVal;
				tLead.ldExlList = exList;
				dc.SubmitChanges();
				return tValidation.ValidationID;
			}
		}
Exemplo n.º 2
0
		public ValidationFail GetValidationsResultsByValidationID(int validationID)
		{
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				T_ValidationFail tFail;
				T_ValidationResult tResults;
				T_Validation tValidation = new T_Validation();

				ValidationFail result = new ValidationFail();
				tResults = dc.T_ValidationResults
					.Where(r => r.ValidationID == validationID && r.T_ValidationType.vtDescription == ValidationConstants.OFAC)
					.FirstOrDefault();
				if (tResults == null)
					return null;
				tFail = dc.T_ValidationFails.Where(f => f.FailID == tResults.FailID).FirstOrDefault();
				if (tFail == null)
					return null;
				var table = GetValidationFailEntity(tFail);
				return table;

				//tResults = dc.T_ValidationResults.Where(r => r.ValidationID == validationID && r.FailID == r.T_ValidationFail.FailID).First();
				//tFail = dc.T_ValidationFails.Where(f => f.FailID == tResults.FailID).First();
				//var table = GetValidationFailEntity(tFail);

			}

		}
		private void detach_T_Validations(T_Validation entity)
		{
			this.SendPropertyChanging();
			entity.T_UserInformation = null;
		}
		private void detach_T_Validations(T_Validation entity)
		{
			this.SendPropertyChanging();
			entity.T_Lead = null;
		}
 partial void DeleteT_Validation(T_Validation instance);
 partial void UpdateT_Validation(T_Validation instance);
 partial void InsertT_Validation(T_Validation instance);