public Transaction parse(string[] row)
{
Transaction t = new Transaction();
// 日付
string date = getCol(row, "Date");
if (date != null)
{
t.date = CsvUtil.parseDate(date);
}
else {
int year = getColInt(row, "Year");
int month = getColInt(row, "Month");
int day = getColInt(row, "Day");
if (year == 0 || month == 0 || day == 0) {
return null;
}
if (year < 100)
{
year += 2000;
}
t.date = new DateTime(year, month, day, 0, 0, 0);
}
// ID
string id = getCol(row, "Id");
if (id != null)
{
try
{
t.id = getColInt(row, "Id");
}
catch (FormatException)
{
// just ignore : do not use ID
}
}
// 金額
t.value = getColInt(row, "Income");
t.value -= getColInt(row, "Outgo");
// 残高
t.balance = getColInt(row, "Balance");
// 適用
t.desc = getMultiCol(row, "Desc");
// 備考
t.memo = getMultiCol(row, "Memo");
// トランザクションタイプを自動設定
t.GuessTransType(t.value >= 0);
return t;
}