コード例 #1
0
        internal static void RejectDuplicateRecord <T>(this ISimpleRepo <T> repo, Func <T, bool> predicate, string field, T record, Func <T, int> idGetter = null)
        //where T : IDocumentDTO
        {
            var matches = repo.GetAll().Where(predicate);

            if (!matches.Any())
            {
                return;
            }

            if (matches.Count() > 1)
            {
                throw DuplicateRecordsException
                      .For(matches, field, record.ToString());
            }

            if (matches.Count() == 1 && idGetter != null)
            {
                var recId   = idGetter(record);
                var matchId = idGetter(matches.Single());
                if (recId == matchId)
                {
                    return;
                }
            }

            throw DuplicateRecordsException
                  .For(matches, field, record.ToString());
        }
コード例 #2
0
ファイル: InactiveLeasesVM.cs プロジェクト: peterson1/RentLog
        protected override List <InactiveLeaseDTO> QueryItems(ISimpleRepo <InactiveLeaseDTO> db)
        {
            var items = db.GetAll().OrderByDescending(_ => _.DeactivatedDate).ToList();

            Caption = $"  Inactive Leases  ({items.Count:N0})  ";
            return(items);
        }
コード例 #3
0
        protected override List <LeaseDTO> QueryItems(ISimpleRepo <LeaseDTO> db)
        {
            _postdDate = AppArgs.Collections.LastPostedDate();
            var items = db.GetAll().OrderByDescending(_ => _.Id).ToList();

            Caption = $"  Active Leases  ({items.Count:N0})  ";
            return(items);
        }
コード例 #4
0
 public void SetHost(List <AccountAllocation> listHost, BankAccountDTO bankAccount, ISimpleRepo <GLAccountDTO> glAcctsRepo)
 {
     _list = listHost;
     _bank = bankAccount;
     //todo: use .IncludeCashInBanks()
     _glAccts = glAcctsRepo?.GetAll();
     _glAccts?.Insert(0, GLAccountDTO.CashInBank(_bank));
     UpdateUILists();
 }
コード例 #5
0
 private static void EditAndRecompute <T>(ITenantDBsDir dir, int secId, ISimpleRepo <T> repo) where T : LeaseDTO
 {
     foreach (var lse in repo.GetAll())
     {
         if (lse.Stall.Section.Id != secId)
         {
             continue;
         }
         EditLease(lse, repo);
         dir.Balances.GetRepo(lse)?.RecomputeAll();
     }
 }
コード例 #6
0
 private static void ProcessRequests(ISimpleRepo <FundRequestDTO> repo)
 {
     foreach (var req in repo.GetAll())
     {
         if (IsBuggy(req, out AccountAllocation bdo1Alloc))
         {
             FixBuggyAlloc(bdo1Alloc);
             if (!repo.Update(req))
             {
                 throw new Exception("Request Update failed");
             }
         }
     }
 }
コード例 #7
0
        private static void ProcessLeases <T>(MainWindowVM2 main, ISimpleRepo <T> repo)
            where T : LeaseDTO
        {
            foreach (var lse in repo.GetAll())
            {
                main.StartBeingBusy($"Verifying memos for [{lse.Id}] “{lse}”...");

                var win = new LeaseBalAdjustmentsVM(lse, main);
                win.Show <LeaseBalAjsWindow>(false, true);

                //foreach (BalanceAdjustmentDTO byf in byfAdjs)
                //    VerifyLeaseMemo(byf, conv, main.AppArgs);
            }
        }
コード例 #8
0
 public List <T> GetAll() => ToSortedList(_repo.GetAll());
コード例 #9
0
 protected virtual List <TDTO> QueryItems(ISimpleRepo <TDTO> db)
 => db.GetAll();
コード例 #10
0
 protected override List <CollectorDTO> QueryItems(ISimpleRepo <CollectorDTO> db)
 => db.GetAll().OrderBy(_ => _.Id).ToList();
コード例 #11
0
ファイル: StallsJob.cs プロジェクト: peterson1/RentLog
 private static LeaseDTO FindLeaseIn <T>(StallDTO stall, ISimpleRepo <T> repo)
     where T : LeaseDTO
 => repo.GetAll().FindLast(_ => _.Stall.Id == stall.Id);