public static void ToBankTransaction(this PassbookDB pbk, RequestedChequeDTO chq, DateTime clearedDate, SoaRowsRepo1 txnsRepo) { //txnsRepo.Withdraw(clearedDate, req.Payee, req.Purpose, req.Amount.Value, chq.ChequeNumber.ToString()); var dto = ToClearedTransaction(chq, clearedDate); txnsRepo.UpsertAndUpdateBalances(dto); //pbk.InactiveCheques.Insert(chq); pbk.ActiveCheques.Delete(chq); }
private static SoaRowDTO ToClearedTransaction(RequestedChequeDTO chq, DateTime clearedDate) { var req = chq.Request; var dto = SoaRowDTO.Withdrawal(clearedDate, req.Payee, req.Purpose, req.Amount.Value, chq.ChequeNumber.ToString()); dto.DocRefId = chq.Id; dto.DocRefType = chq.GetType().FullName; dto.DocRefJson = chq.ToJson(true); return(dto); }
//todo: implem this //private static bool ChequeExists(int chequeNumber, PassbookDB pbk) //{ // //var exists = pbk.InactiveCheques // throw new NotImplementedException(); //} public static void ToIssuedCheque(this PassbookDB pbk, RequestedChequeDTO cheque, string issuedTo, DateTime issuedDate) { cheque.IssuedTo = issuedTo; cheque.IssuedDate = issuedDate; pbk.ActiveCheques.Update(cheque); }