public static List <string> GetLinesFromPagesNEW(List <string> pages) { var result = new List <string>(); var foundBeginning = false; foreach (var line in pages) { if (line.Contains(HelperVISA.BEGIN_TRANSACTIONS) || line.Contains(HelperStreamline.BEGIN_TRANSACTIONS)) { foundBeginning = true; } if (line.Contains(HelperVISA.END_TRANSACTIONS)) { break; } if ((foundBeginning) && LineParser.IsCrap(line) == false) { if (StreamLine.IsBracketLine(line)) { } result.Add(line); } } return(result); }
public static List <string> GetLinesFromPages(List <string> pages, bool processAll) { var result = new List <string>(); //var sb = new StringBuilder(); var foundBeginning = processAll; foreach (var line in pages) { if (line.Contains(HelperVISA.BEGIN_TRANSACTIONS) || line.Contains(HelperStreamline.BEGIN_TRANSACTIONS)) { foundBeginning = true; } if (line.Contains(HelperVISA.END_TRANSACTIONS)) { break; } if ((foundBeginning) && LineParser.IsCrap(line) == false) { if (StreamLine.IsBracketLine(line)) { } //sb.AppendLine(line); result.Add(line); } } //sb.AppendLine("---------------------------------------"); return(result); }
/// <summary> /// /// </summary> /// <param name="lines"></param> /// <param name="year"></param> /// <param name="accountType"></param> /// <param name="filename"></param> /// <returns></returns> public List <Prototype> GetPrototypesFromLines(List <string> lines, int year, AccountType accountType, string filename) { var result = new List <Prototype>(); var newProto = new Prototype(); var lineCount = 0; foreach (var line in lines) { Trace.WriteLineIf(this.Verbose, " >>> " + line); var item = LineParser.TrimEndBalance(line); var date = LineParser.GetDateFromLine(item, year); if (date.HasValue) { // Is beginning of a new transaction -- save the previous and start a new one if (newProto != null && string.IsNullOrWhiteSpace(newProto.Line0) == false) { result.Add(newProto); } lineCount = 0; newProto = new Prototype() { AccountType = accountType, Date = date.Value, Line0 = item, SourceFile = filename }; } else { // Add subsequent lines that belong to this transaction lineCount++; if (lineCount == 0) { // should never end up here.. newProto.Line0 = item; } if (lineCount == 1) { newProto.Line1 = item; } if (lineCount == 2) { newProto.Line2 = item; } if (lineCount == 3) { newProto.Line3 = item; } } } // HACK if (result.Count == 0 && newProto.IsValid()) { result.Add(newProto); } return(result); }
public decimal?GetAmount() { decimal?result = 0M; var lines = new string[] { this.Line0, this.Line1, this.Line2, this.Line3 }; foreach (var line in lines) { var amt = LineParser.GetAmountFromLine(line); if (amt.HasValue) { result = amt.GetValueOrDefault(); break; } } //this.Amount = result.GetValueOrDefault(); return(result); }