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); }
public bool Delete(PassbookRowDTO rec) { var ok = FindRepo(rec.TransactionDate).Delete(rec); if (!ok) { throw new Exception("IPassbookRowsRepo.Delete returned False"); } return(ok); }
public bool Update(PassbookRowDTO rec) => throw new InvalidOperationException("Don't call IPassbookRowsRepo.Update(). Instead, call Delete() then Insert()");
public int Insert(PassbookRowDTO rec) => FindRepo(rec.TransactionDate).Insert(rec);
public bool IsValidForDelete(PassbookRowDTO rec, out string whyInvalid) => FindRepo(rec.TransactionDate).IsValidForDelete(rec, out whyInvalid);
public bool IsValidForInsert(PassbookRowDTO draft, out string whyInvalid) => FindRepo(draft.TransactionDate).IsValidForInsert(draft, out whyInvalid);