public List<Transaction> ConvertRecords(Stream s)
        {
            List<Transaction> xacts = new List<Transaction>();

              using (CSVReader.CSVReader csv = new CSVReader.CSVReader(s)) {
            string[] fields;
            while ((fields = csv.GetCSVLine()) != null) {
              if (fields[0] == "TRANSACTION DATE")
            continue;

              Transaction xact = new Transaction();

              try {
              xact.Date		  = DateTime.ParseExact(fields[0], "mm/dd/yy", null);
              xact.PostedDate = DateTime.ParseExact(fields[1], "mm/dd/yy", null);
              xact.Payee	  = fields[2].Trim();
              xact.Code		  = fields[3].Trim();
              xact.Amount	  = Convert.ToDecimal(fields[4].Trim());

              if (xact.Code.Length == 0)
                  xact.Code = null;

              xacts.Add(xact);
              }
              catch (System.FormatException) {}
            }
              }
              return xacts;
        }
        public List<Transaction> ConvertRecords(Stream s)
        {
            List<Transaction> xacts = new List<Transaction>();

              using (CSVReader.CSVReader csv = new CSVReader.CSVReader(s)) {
            string[] fields;
            while ((fields = csv.GetCSVLine()) != null) {
              Transaction xact = new Transaction();

              xact.Date   = DateTime.ParseExact(fields[0], "m/dd/yyyy", null);
              xact.Payee  = fields[2].Trim();
              xact.Code  = fields[3].Trim();
              xact.Amount  = - Convert.ToDecimal(fields[4].Trim());

              if (xact.Code.Length == 0)
            xact.Code = null;

              xacts.Add(xact);
            }
              }
              return xacts;
        }
 public string IdentifyAccount(Transaction xact)
 {
     return "Expenses:Food";
 }
Beispiel #4
0
 public string DefaultAccount(Transaction xact)
 {
     if (Regex.IsMatch(xact.Payee, "IGA"))
     return "Expenses:Food";
       return "Expenses:Food";
 }