static TxCoreV2 doTxnBlockQif(string block, string file, TxMoneySrc txMoneySrc) { try { var ls = block.Split(new[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries); var rv = new TxCoreV2 { Id = --_cntr, CreatedAt = /**/ _batchTimeNow, FitId = /**/ ls.FirstOrDefault(r => r[0] == 'N').Substring(1), TxDate = /**/ parseTxnDate(ls.FirstOrDefault(r => r[0] == 'D').Substring(1)), TxAmount = /**/ -parseTA(ls.FirstOrDefault(r => r[0] == 'T').Substring(1)), TxDetail = /**/ ls.FirstOrDefault(r => r[0] == 'P').Substring(1), MemoPP = /**/ string.Join(", ", ls.Where(r => r[0] == 'A' && r.Length > 1).Select(r => r.Substring(1))) + ". ", TxCategoryIdTxt = /**/ PreSet.__UnKn, TxMoneySrc = /**/ txMoneySrc, TxMoneySrcId = /**/ txMoneySrc.Id, // inferTxMoneySrcId(file), SrcFile = /**/ Path.GetFileNameWithoutExtension(file) }; Debug.WriteLine(rv); return(rv); } catch (Exception ex) { ex.Log(); } return(null); }
static TxCoreV2 doTxnBlock(string block, string file, TxMoneySrc txMoneySrc) { var start = block.IndexOf("<STMTTRN>"); if (start < 0) { return(null); } //Debug.WriteLine(block.Substring(33).Replace("<TRNAMT>", "\t").Replace("<FITID>", "\t").Replace("<NAME>", "\t\t").Replace("<MEMO>", "\t\t").Replace("<CHECKNUM>", "\t\t").Replace("<DTUSER>", "\t\t").Replace("<SIC>", "\t\t")); //var tt = getElCont(block, "<TRNTYPE>"); var dp = getElCont(block, "<DTPOSTED>"); // posted date var ta = getElCont(block, "<TRNAMT>"); var fi = getElCont(block, "<FITID>"); var dt = getElCont(block, "<NAME>") ?? "°"; // required db field var mm = getElCont(block, "<MEMO>"); // CV only: details of $US txn. var cs = getElCont(block, "<CHECKNUM>"); // TD only: cheque number var td = getElCont(block, "<DTUSER>"); // MC only: tx date var si = getElCont(block, "<SIC>"); // MC only: 4-digits like 0000, 4816, ... if (td != null) { td = string.Format("txDate:{0}, ", parseTxnDate(td)); } if (si != null) { si = string.Format("sic:{0}", si); } var rv = new TxCoreV2 { Id = --_cntr, CreatedAt = _batchTimeNow, FitId = fi, TxDate = parseTxnDate(dp), TxAmount = -parseTA(ta), TxDetail = dt, MemoPP = mm + cs + td + si, TxCategoryIdTxt = PreSet.__UnKn, TxMoneySrc = txMoneySrc, TxMoneySrcId = txMoneySrc.Id, // inferTxMoneySrcId(file), SrcFile = Path.GetFileNameWithoutExtension(file) }; //Debug.WriteLine(rv); return(rv); }