Beispiel #1
0
 public LeaseBalanceRow(LeaseDTO lease, DailyBillDTO bill)
 {
     DTO      = lease;
     Rent     = bill?.For(BillCode.Rent)?.ClosingBalance;
     Rights   = bill?.For(BillCode.Rights)?.ClosingBalance;
     Electric = bill?.For(BillCode.Electric)?.ClosingBalance;
     Water    = bill?.For(BillCode.Water)?.ClosingBalance;
 }
Beispiel #2
0
        private static void EditBillRow(DailyBillDTO dto, decimal newVal, SoaViewerVM vm)
        {
            var bCode    = BillCode.Rights;
            var billr    = vm.AppArgs.DailyBiller;
            var newState = billr.ComputeBill(bCode, vm.Lease, dto.GetBillDate(), newVal);

            dto.Bills.RemoveAll(_ => _.BillCode == bCode);
            dto.Bills.Add(newState);
        }
Beispiel #3
0
        private static async Task PersistThenRecompute(DailyBillDTO updatedDto, SoaViewerVM vm)
        {
            var repo = vm.AppArgs.Balances.GetRepo(vm.Lease);
            var date = updatedDto.GetBillDate();
            await Task.Delay(1);

            await Task.Run(() =>
            {
                repo.Update(updatedDto);
                repo.RecomputeFrom(date.AddDays(1));
            });
        }
 private Action GetBillQueryJob(LeaseDTO lse, DateTime date) => () =>
 {
     DailyBillDTO bill = null;
     try
     {
         bill = GetBill(lse, date);
     }
     catch (Exception ex)
     {
         Alert.Show(ex, $"Getting bill for [{lse.Id}] “{lse}”");
     }
     _bills.TryAdd(lse.Id, bill);
 };
Beispiel #5
0
        protected override LeaseBalanceRow CastToRow(LeaseDTO lse)
        {
            DailyBillDTO bill = null;

            try
            {
                bill = AppArgs.Balances.GetBill(lse, _postdDate);
            }
            catch (Exception ex)
            {
                Alert.Show(ex, $"Getting bill for [{lse.Id}] “{lse}”");
            }
            return(new LeaseBalanceRow(lse, bill));
        }
Beispiel #6
0
        protected override LeaseBalanceRow CastToRow(InactiveLeaseDTO lse)
        {
            var          repo = AppArgs.Balances.GetRepo(lse);
            DailyBillDTO bill = null;

            try
            {
                bill = repo.Latest();
            }
            catch (Exception ex)
            {
                var desc = $"[{lse.Id}] “{lse.TenantAndStall}”";
                Alert.Show(ex, $"Reading latest bill row for {desc}");
            }
            return(new LeaseBalanceRow(lse, bill));
        }
Beispiel #7
0
        private static bool IsUpdateConfirmed(out DailyBillDTO dtoForUpdate, SoaViewerVM vm)
        {
            var day1 = vm?.Rows?.LastOrDefault();

            if (day1 == null)
            {
                throw Bad.Data("Day 1 row");
            }

            dtoForUpdate = day1.DTO;
            var origVal = day1.Rights.OpeningBalance;
            var suggVal = GetSuggestedVal(day1.Rights, vm);
            var dte     = $"{day1.Date:d-MMM-yyyy}";
            var msg     = $"[{dte}] Starting Rights  (orig.val: {origVal:N2})";
            var ok      = PopUpInput.TryGetDecimal(msg, out decimal newVal, suggVal);

            if (!ok)
            {
                return(false);
            }

            EditBillRow(dtoForUpdate, newVal, vm);
            return(true);
        }