public ProfileExternalResource GetFileContent(List <ProfileColumnComparer <String> > columns, dtoCsvSettings settings, dtoCSVfile file) { CsvFile csvFile = ContentOf.LoadCsvFile(file.RealName, settings); ProfileExternalResource result = new ProfileExternalResource(columns, csvFile); return(result); }
public List <ProfileColumnComparer <String> > GetAvailableColumns(dtoCsvSettings settings, dtoCSVfile file) { List <ProfileColumnComparer <String> > columns = new List <ProfileColumnComparer <String> >(); if (file != null) { CsvFile header = ContentOf.LoadCsvFile(file.RealName, settings, 1); if (header != null) { Dictionary <ProfileAttributeType, String> attributes = new Dictionary <ProfileAttributeType, String>(); foreach (ProfileAttributeType att in Enum.GetValues(typeof(ProfileAttributeType))) { attributes.Add(att, att.ToString().ToLower()); } columns = (from c in header.ColumHeader select new ProfileColumnComparer <String> { SourceColumn = (c.Empty) ? c.Number.ToString() : c.Value, Number = c.Number, DestinationColumn = (c.Empty || !attributes.Values.Contains(c.Value.ToLower())) ? Authentication.ProfileAttributeType.skip : attributes.ToList().Where(a => a.Value == c.Value.ToLower()).Select(a => a.Key).FirstOrDefault() }).ToList(); } } return(columns); }
public void Preview(dtoCsvSettings settings, dtoCSVfile file) { if (file != null) { View.PreviewRows(ContentOf.LoadCsvFile(file.RealName, settings, 8)); } else { View.PreviewRows(null); } }
public List <ExternalColumnComparer <String, Int32> > GetAvailableColumns(dtoCsvSettings settings, dtoCSVfile file) { List <ExternalColumnComparer <String, Int32> > columns = new List <ExternalColumnComparer <String, Int32> >(); if (file != null) { CsvFile header = ContentOf.LoadCsvFile(file.RealName, settings, 1); if (header != null) { columns = (from c in header.ColumHeader select new ExternalColumnComparer <String, Int32> { SourceColumn = (c.Empty) ? c.Number.ToString() : c.Value, Number = c.Number, DestinationColumn = new DestinationItem <Int32>() { Id = -1, InputType = InputType.skip }, InputType = InputType.skip }).ToList(); } } return(columns); }