public List<ValidationResult> CheckValidationsSource()
		{
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				List<ValidationResult> list = new List<ValidationResult>();

				int excCompanies = dc.T_ExcListCompanies.Count();
				int excIndividuials = dc.T_ExcListIndividuals.Count();
				var ofacXml = dc.T_ValidationResources.Select(v => v.vrContent).First();

				var typeOFAC = new ValidationType();
				var statusOFAC = new ValidationStatus();
				typeOFAC.Type = ValidationConstants.OFAC;
				if (ofacXml != null)
					statusOFAC.Status = ValidationConstants.StatusPassed;
				else
					statusOFAC.Status = ValidationConstants.StatusError;
				list.Add(new ValidationResult { Type = typeOFAC, Status = statusOFAC });

				var typeFreddie = new ValidationType();
				var statusFreddie = new ValidationStatus();
				typeFreddie.Type = ValidationConstants.FreddieList;
				if (excCompanies != 0 && excIndividuials != 0)
					statusFreddie.Status = ValidationConstants.StatusPassed;
				else
					statusFreddie.Status = ValidationConstants.StatusError;
				list.Add(new ValidationResult { Type = typeFreddie, Status = statusFreddie });

				//var typeFreddie = new ValidationType();
				//var statusFreddie = new ValidationStatus();

				return list;
			}
		}
Beispiel #2
0
        protected int ValidateLead(Lead lead, UserInformation userInfo)
        {
            ValidationLead validation = new ValidationLead();
            validation.Lead = lead;
            validation.User = userInfo;

            List<ValidationResult> listResults = new List<ValidationResult>();

            bool ofac = true;
            bool freddie = true;

            var results = LeadValidationManager.CheckValidationsSource();
            foreach (var item in results)
            {
                switch (item.Type.Type)
                {
                    case ValidationConstants.OFAC:
                        if (item.Status.Status == ValidationConstants.StatusError)
                        {
                            ofac = false;
                        }

                        break;
                    case ValidationConstants.FreddieList:
                        if (item.Status.Status == ValidationConstants.StatusError)
                        {
                            freddie = false;
                        }
                        break;
                    default:
                        break;
                }
            }

            var typeOFAC = new ValidationType();
            var statusOFAC = new ValidationStatus();

            var typeAddress = new ValidationType();
            var statusAddress = new ValidationStatus();

            var typeFreddie = new ValidationType();
            var statusFreddie = new ValidationStatus();

            typeOFAC.Type = ValidationConstants.OFAC;
            if (ofac)
            {
                statusOFAC.Status = ValidationConstants.StatusPassed;
            }
            else
            {
                statusOFAC.Status = ValidationConstants.StatusNoInformation;
            }
            listResults.Add(new ValidationResult { Type = typeOFAC, Status = statusOFAC });


            typeFreddie.Type = ValidationConstants.FreddieList;
            if (freddie)
            {
                statusFreddie.Status = ValidationConstants.StatusPassed;
            }
            else
            {
                statusFreddie.Status = ValidationConstants.StatusNoInformation;
            }
            listResults.Add(new ValidationResult { Type = typeFreddie, Status = statusFreddie });


            typeAddress.Type = ValidationConstants.Address;
            statusAddress.Status = ValidationConstants.StatusNoInformation;
            listResults.Add(new ValidationResult { Type = typeAddress, Status = statusAddress });

            validation.Results = listResults;

            return LeadValidationManager.SaveValidationLead(validation);

        }
		internal ValidationType GetValidationTypeEntity(T_ValidationType tType)
		{
			ValidationType type = new ValidationType();
			type.TypeID = tType.TypeID;
			type.Type = tType.vtDescription;
			return type;
		}
Beispiel #4
0
		protected void btnSubmit_Click(object sender, EventArgs e)
		{
			lblMessage.Visible = false;
			if (!chkAddress.Checked && !chkFreddie.Checked && !chkOFAC.Checked)
			{
				lblMessage.Visible = true;
				return;
			}

			ValidationLead validation = new ValidationLead();
			int id = GetLeadID();
			if (id < 0)
				return;
			
			Lead lead = DataManager.GetLeadById(id);
			UserInformation user = DataManager.GetUserInformation(Membership.GetUser().UserName);
			if (lead == null || user == null)
				return;
			validation.Lead = lead;
			validation.User = user;

			List<ValidationResult> listResults = new List<ValidationResult>();


			var typeOFAC = new ValidationType();
			var statusOFAC = new ValidationStatus();

			var typeAddress = new ValidationType();
			var statusAddress = new ValidationStatus();

			var typeFreddie = new ValidationType();
			var statusFreddie = new ValidationStatus();

			if (chkOFAC.Checked)
			{
				typeOFAC.Type = ValidationConstants.OFAC;
				statusOFAC.Status = ValidationConstants.StatusPassed;
			}
			else
			{
				typeOFAC.Type = ValidationConstants.OFAC;
				statusOFAC.Status = ValidationConstants.StatusNoInformation;
			}
			listResults.Add(new ValidationResult { Type = typeOFAC, Status = statusOFAC });

			if (chkAddress.Checked)
			{
				typeAddress.Type = ValidationConstants.Address;
				statusAddress.Status = ValidationConstants.StatusPassed;
			}
			else
			{
				typeAddress.Type = ValidationConstants.Address;
				statusAddress.Status = ValidationConstants.StatusNoInformation;
			}
			listResults.Add(new ValidationResult { Type = typeAddress, Status = statusAddress });
			if (chkFreddie.Checked)
			{
				typeFreddie.Type = ValidationConstants.FreddieList;
				statusFreddie.Status = ValidationConstants.StatusPassed;
			}
			else
			{
				typeFreddie.Type = ValidationConstants.FreddieList;
				statusFreddie.Status = ValidationConstants.StatusNoInformation;
			}
			listResults.Add(new ValidationResult { Type = typeFreddie, Status = statusFreddie });
			validation.Results = listResults;
			LeadValidationManager.SaveValidationLead(validation);
            DataManager.LeadModified(lead.LeadID.Value);
		}