public List<Posting> ConvertRecords(Stream s) { List<Posting> posts = new List<Posting>(); using (CSVReader.CSVReader csv = new CSVReader.CSVReader(s)) { string[] fields; while ((fields = csv.GetCSVLine()) != null) { if (fields[0] == "POSTING DATE") continue; Posting post = new Posting(); post.Date = DateTime.ParseEpost(fields[0], "mm/dd/yy", null); post.PostedDate = DateTime.ParseEpost(fields[1], "mm/dd/yy", null); post.Payee = fields[2].Trim(); post.Code = fields[3].Trim(); post.Amount = Convert.ToDecimal(fields[4].Trim()); if (post.Code.Length == 0) post.Code = null; posts.Add(post); } } return posts; }
public List <Posting> ConvertRecords(Stream s) { List <Posting> posts = new List <Posting>(); using (CSVReader.CSVReader csv = new CSVReader.CSVReader(s)) { string[] fields; while ((fields = csv.GetCSVLine()) != null) { if (fields[0] == "POSTING DATE") { continue; } Posting post = new Posting(); post.Date = DateTime.ParseEpost(fields[0], "mm/dd/yy", null); post.PostedDate = DateTime.ParseEpost(fields[1], "mm/dd/yy", null); post.Payee = fields[2].Trim(); post.Code = fields[3].Trim(); post.Amount = Convert.ToDecimal(fields[4].Trim()); if (post.Code.Length == 0) { post.Code = null; } posts.Add(post); } } return(posts); }
public string DefaultAccount(Posting post) { if (Regex.IsMatch(post.Payee, "IGA")) { return("Expenses:Food"); } return("Expenses:Food"); }
public string DefaultAccount(Posting post) { if (Regex.IsMatch(post.Payee, "IGA")) return "Expenses:Food"; return "Expenses:Food"; }