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);
        }
示例#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);
        }
示例#3
0
 public bool Update(PassbookRowDTO rec)
 => throw new InvalidOperationException("Don't call IPassbookRowsRepo.Update(). Instead, call Delete() then Insert()");
示例#4
0
 public int Insert(PassbookRowDTO rec)
 => FindRepo(rec.TransactionDate).Insert(rec);
示例#5
0
 public bool IsValidForDelete(PassbookRowDTO rec, out string whyInvalid)
 => FindRepo(rec.TransactionDate).IsValidForDelete(rec, out whyInvalid);
示例#6
0
 public bool IsValidForInsert(PassbookRowDTO draft, out string whyInvalid)
 => FindRepo(draft.TransactionDate).IsValidForInsert(draft, out whyInvalid);