private void SaveIndividualsToDB(string fileName)
		{
			string connectionString = string.Format(_excelConStr, fileName);
			using (var adapter = new OleDbDataAdapter("SELECT * FROM [INDIVIDUALS$]", connectionString))
			{
				using (var ds = new DataSet())
				{
					adapter.Fill(ds, "AnyName");
					var data = ds.Tables["AnyName"].AsEnumerable();
					var query = data.Where(x => x.Field<string>("Last Name") != string.Empty).AsQueryable();
					List<Individual> individuals = new List<Individual>();
					foreach (var item in query)
					{
						Individual individual = new Individual();
						individual.AddressLine1 = item["Address Line 1"].ToString();
						individual.AddressLine2 = item["Address Line 2"].ToString();
						individual.AddressLine3 = item["Address Line 3"].ToString();
						individual.Aka = item["aka/dba"].ToString();
						individual.City = item["City"].ToString();
						individual.Comments = item["Comments"].ToString();
						individual.FirstName = item["First Name"].ToString();
						individual.IssuingState = item["Issuing State"].ToString();
						individual.LastName = item["Last Name"].ToString();
						individual.LicenseNumber = item["License Number"].ToString();
						individual.LicenseType = item["License Type"].ToString();
						individual.State = item["State"].ToString();
						individual.Zip = item["Zip"].ToString();
						individuals.Add(individual);
					}
					CCTValidationProvider validationProvider = new CCTValidationProvider();
					validationProvider.SaveExcludedIndividuals(individuals);
				}
			}
		}
Esempio n. 2
0
		public List<Individual> GetExcludedIndividuals(int? id)
		{
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				var query = dc.T_ExcListIndividuals.AsQueryable();
				if (id.HasValue)
				{
					query = query.Where(i => i.ExcListIndividualID == id);
				}
				List<Individual> result = new List<Individual>();
				foreach (var tIndividual in query.ToArray())
				{
					Individual individual = new Individual();
					individual.ID = tIndividual.ExcListIndividualID;
					individual.AddressLine1 = tIndividual.eliAddressLine1;
					individual.AddressLine2 = tIndividual.eliAddressLine2;
					individual.AddressLine3 = tIndividual.eliAddressLine3;
					individual.Aka = tIndividual.eliAkaDba;
					individual.City = tIndividual.eliCity;
					individual.Comments = tIndividual.eliComments;
					individual.FirstName = tIndividual.eliFirstName;
					individual.IssuingState = tIndividual.eliIssuingState;
					individual.LastName = tIndividual.eliLastName;
					individual.LicenseNumber = tIndividual.eliLicenseNumber;
					individual.LicenseType = tIndividual.eliLicenseType;
					individual.State = tIndividual.eliState;
					individual.Zip = tIndividual.eliZip;
					result.Add(individual);
				}
				return result;
			}
		}