private static (int BankAcctID, PassbookRowDTO DTO) CastToRnt(dynamic byf)
        {
            var dto = new PassbookRowDTO
            {
                Subject        = As.Text(byf.title),
                Description    = As.Text(byf.remarks),
                TransactionRef = As.Text(byf.referencenum),
                DateOffset     = As.DateOffset(byf.date),
                Amount         = As.Decimal(byf.amount),
                DocRefType     = ByfBankMemoNode.TypeName,
                DocRefId       = As.ID(byf.nid),
                DocRefJson     = "{}",
            };

            if (dto.Subject.IsBlank())
            {
                dto.Subject = "-";
            }
            if (dto.Description.IsBlank())
            {
                dto.Description = "-";
            }
            if (dto.TransactionRef.IsBlank())
            {
                dto.TransactionRef = "-";
            }
            return(As.ID(byf.bankacctnid), dto);
        }
Beispiel #2
0
        public bool Delete(PassbookRowDTO rec)
        {
            var ok = FindRepo(rec.TransactionDate).Delete(rec);

            if (!ok)
            {
                throw new Exception("IPassbookRowsRepo.Delete returned False");
            }
            return(ok);
        }
Beispiel #3
0
 public bool Update(PassbookRowDTO rec)
 => throw new InvalidOperationException("Don't call IPassbookRowsRepo.Update(). Instead, call Delete() then Insert()");
Beispiel #4
0
 public int Insert(PassbookRowDTO rec)
 => FindRepo(rec.TransactionDate).Insert(rec);
Beispiel #5
0
 public bool IsValidForDelete(PassbookRowDTO rec, out string whyInvalid)
 => FindRepo(rec.TransactionDate).IsValidForDelete(rec, out whyInvalid);
Beispiel #6
0
 public bool IsValidForInsert(PassbookRowDTO draft, out string whyInvalid)
 => FindRepo(draft.TransactionDate).IsValidForInsert(draft, out whyInvalid);