コード例 #1
0
        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;
        }
コード例 #2
0
        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;
        }
コード例 #3
0
 public string IdentifyAccount(Transaction xact)
 {
     return "Expenses:Food";
 }
コード例 #4
0
ファイル: ParseCcStmt.cs プロジェクト: skanthak/ledger
 public string DefaultAccount(Transaction xact)
 {
     if (Regex.IsMatch(xact.Payee, "IGA"))
     return "Expenses:Food";
       return "Expenses:Food";
 }