public PreparedChequesListVM(ITenantDBsDir dir, VoucherReqsTabVM vouchersTab) : base(dir.Vouchers.PreparedCheques, dir, false) { _main = vouchersTab; Caption = "Prepared Cheques"; ViewVoucherCmd = R2Command.Relay(_ => OnItemOpened(ItemsList.CurrentItem), null, "View Voucher Details"); PrintVoucherCmd = R2Command.Relay(PrintVoucher, null, "Print Cheque Voucher"); EditChequeCmd = R2Command.Relay(EditChequeDetails, _ => AppArgs.CanInputChequeDetails(false), "Edit Cheque Details"); RemoveChequeInfoCmd = R2Command.Relay(RemoveChequeInfo, _ => AppArgs.CanInputChequeDetails(false), "Remove Cheque Details"); MarkAsCancelledCmd = R2Command.Relay(MarkAsCancelled, _ => AppArgs.CanMarkChequeAsCancelled(false), "Mark Cheque as “Cancelled”"); }
protected override bool CanRunMainMethod() { if (!AppArgs.CanInputChequeDetails(false)) { return(CantDo($"[{AppArgs.Credentials.Roles}] NOT authorized")); } if (!TryGetPickedItem(out FundRequestDTO dto)) { return(CantDo("No selected item")); } if (!dto.Amount.HasValue) { return(CantDo("Requested Amount is blank")); } return(true); }