// -------------------------------------------------------------------------------------------------------------------------- public NewWineEntry(LegacyWineEntry oldData) { // Basic copy.... DTOMapper.CopyMembers(oldData, this); // Now the manual stuff..... Label = oldData.Name; Variety = oldData.Varietal; WineType = TranslateType(oldData.Type, oldData.Varietal); Qty = oldData.Bottles; BottleSize = oldData.Size; Best = oldData.PeakYear; UserNotes1 = oldData.TastingNotes; UserNotes2 = oldData.Notes + Environment.NewLine + oldData.ExtendedNotes; //RackNames = string.Join(" Location = oldData.Location; // + ", " + oldData.Position; UserField3 = oldData.Position; // This is how we will handle the racks.... if (oldData.Bottles == "1") { RackNames = "Rack 1"; RackCols = "1"; RackRows = "1"; } }
// -------------------------------------------------------------------------------------------------------------------------- private List <LegacyWineEntry> ExtractWines(CSVFile file) { List <LegacyWineEntry> res = new List <LegacyWineEntry>(); List <CSVLine> useLines = file.Lines; LegacyWineEntry current = null; int internalIndex = 0; foreach (var l in useLines) { // See if we are parsing a new entry. if (l["Vintage"] != "" && l["Type"] != "") { internalIndex = 0; current = l.CreateData <LegacyWineEntry>(); res.Add(current); // Some cleanup... if (current.Bottles == "") { current.Bottles = "0"; } } else { // This is a continuation of the current entry. // We are just shoving the data into the 'Extended Notes' section since I don't know what else to do with it. string notes = l["Winery"]; current.ExtendedNotes += (internalIndex > 0 ? Environment.NewLine : "") + notes; ++internalIndex; } } return(res); }