예제 #1
0
		public List<ValidationLead> GetValidationsPage(int leadID, int rowIndex, int pageSize)
		{
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				int pageIndex = rowIndex / pageSize;

				var list = new List<ValidationLead>();
				var validPage = dc.T_Validations.Where(v => v.T_Lead.LeadID == leadID).OrderByDescending(o => o.vldDate).Skip(pageIndex * pageSize).Take(pageSize);

				foreach (var item in validPage)
				{
					List<ValidationResult> results = new List<ValidationResult>();
					var tResults = dc.T_ValidationResults
						.Where(res => res.ValidationID == item.ValidationID)
						.OrderBy(ob => ob.TypeID);

					foreach (T_ValidationResult res in tResults)
					{
						//if (item.)
						results.Add(GetValidationResultEntity(res));
					}
					ValidationLead validation = new ValidationLead();

					DateTime dt = item.vldDate;
					int year = dt.Year;
					int month = dt.Month;
					int day = dt.Day;
					validation.Date = string.Format("{0}/{1}/{2}", month, day, year);

					validation.Results = results;

					CCTLeadProvider leadProvider = new CCTLeadProvider();
					validation.ValidationID = item.ValidationID;
					validation.Lead = leadProvider.GetLeadEntity(item.T_Lead);
					validation.User = leadProvider.GetUserInformationEntity(item.T_UserInformation);
					list.Add(validation);
				}

				return list;
			}
		}
예제 #2
0
		//public static void ValidateLead(int leadID, List<string> types)
		//{
		//  _provider.ValidateLead(leadID, types);
		//}
		public static int SaveValidationLead(ValidationLead validaion)
		{
			return _provider.SaveValidationLead(validaion);

		}
예제 #3
0
		public ValidationLead GetValidationInformation(int validationID)
		{
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				ValidationLead vlead = new ValidationLead();
				var tValidation = dc.T_Validations.Where(v => v.ValidationID == validationID).FirstOrDefault();
				if (tValidation != null)
				{
					List<ValidationResult> results = new List<ValidationResult>();
					var tResults = dc.T_ValidationResults
							.Where(res => res.ValidationID == tValidation.ValidationID);

					foreach (T_ValidationResult res in tResults)
					{
						results.Add(GetValidationResultEntity(res));
					}

					vlead.Results = results;
					DateTime dt = tValidation.vldDate;
					int year = dt.Year;
					int month = dt.Month;
					int day = dt.Day;
					vlead.Date = string.Format("{0}/{1}/{2}", month, day, year);

					CCTLeadProvider leadProvider = new CCTLeadProvider();
					vlead.ValidationID = tValidation.ValidationID;
					vlead.Lead = leadProvider.GetLeadEntity(tValidation.T_Lead);
					vlead.User = leadProvider.GetUserInformationEntity(tValidation.T_UserInformation);
				}

				return vlead;
			}
		}
예제 #4
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;
			}
		}
예제 #5
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);

        }
예제 #6
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);
		}