Example #1
0
        protected override List <InactiveLeaseDTO> QueryItems(ISimpleRepo <InactiveLeaseDTO> db)
        {
            var items = db.GetAll().OrderByDescending(_ => _.DeactivatedDate).ToList();

            Caption = $"  Inactive Leases  ({items.Count:N0})  ";
            return(items);
        }
Example #2
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());
        }
Example #3
0
        protected override List <LeaseDTO> QueryItems(ISimpleRepo <LeaseDTO> db)
        {
            var lses = GetLeases(AppArgs.MarketState, PickedSection?.Id ?? 0);

            FillBillsDictionary(lses);
            return(lses);
        }
Example #4
0
 private static void EditLease <T>(T lse, ISimpleRepo <T> repo) where T : LeaseDTO
 {
     lse.Rent.PenaltyRule = RentPenalty.ZeroBackrent;
     if (!repo.Update(lse))
     {
         throw Bad.Data("Update(lse) did NOT return true.");
     }
 }
Example #5
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);
        }
Example #6
0
 protected virtual void DeleteRecord(ISimpleRepo <TDTO> db, TDTO dto)
 {
     if (CanDeletetRecord(dto))
     {
         db.Delete(dto);
     }
     ReloadFromDB();
 }
Example #7
0
        public EncoderListVMBase(ISimpleRepo <TDTO> repository, MainWindowVM mainWindowVM) : base(repository, mainWindowVM.AppArgs, false)
        {
            Main       = mainWindowVM;
            CanAddRows = Main.CanEncode;
            Caption    = ListTitle;

            //if (refreshMainOnUpdatedTotal)
            TotalSumChanged += (s, e) => OnTotalSumChanged();
        }
 public IndirectFilteredListVMBase(ISimpleRepo <TDTO> simpleRepo, TArg appArguments, bool doReload = true) : base(simpleRepo, appArguments, doReload)
 {
     Filter.TextFilterChanged += (s, e) => ApplyTextFilters();
     Rows.ItemDeleted         += (s, e) => ExecuteDeleteRecord(e.DTO);
     Rows.ItemOpened          += (s, e) =>
     {
         OnItemOpened(e.DTO);
         UpdateTotalSum();
     };
 }
Example #9
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();
     }
 }
 public UserService(IRepository <CoinEntity> coinRepository,
                    IRepository <DrinkEntity> drinkRepository,
                    ISimpleRepo <CurrentStateEntity> stateRepository,
                    IVendingMachineLogger logger)
 {
     _coinRepository  = coinRepository;
     _drinkRepository = drinkRepository;
     _stateRepository = stateRepository;
     _logger          = logger;
     _vengineMachine  = new VengineMachine();
     _printer         = new Printer(logger);
 }
Example #11
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");
             }
         }
     }
 }
Example #12
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);
            }
        }
Example #13
0
        public SavedListVMBase(ISimpleRepo <TDTO> repository, TArg appArguments, bool doReload = true)
        {
            _repo      = repository;
            AppArgs    = appArguments;
            RefreshCmd = R2Command.Relay(ReloadFromDB, null, "Refresh");

            _repo.ContentChanged        += (s, e) => ReloadFromDB();
            ItemsList.ItemDeleted       += (s, e) => ExecuteDeleteRecord(e);
            ItemsList.CollectionChanged += (s, e) => UpdateTotalSum();
            ItemsList.ItemOpened        += ItemsList_ItemOpened;

            if (doReload)
            {
                ReloadFromDB();
            }
        }
Example #14
0
        private List <UncollectedLeaseDTO> GetUpdatedUncollecteds(ISimpleRepo <UncollectedLeaseDTO> db)
        {
            //return (db as IUncollectedsRepo).InferUncollecteds(
            //                   _tab.IntendedColxns.ItemsList,
            //                   _tab.NoOperations.ItemsList);
            var repo    = db as IUncollectedsRepo;
            var intents = _tab.IntendedColxns.ItemsList;
            var no_ops  = _tab.NoOperations.ItemsList;

            try
            {
                return(repo.InferUncollecteds(intents, no_ops));
            }
            catch (LockedFileException ex)
            {
                Alert.ShowModal("Access Conflict caused the file to be locked.",
                                "Please restart your PC, login to your Windows account,"
                                + L.f + "then wait for 5 mins. before relaunching MSA."
                                + L.F + ex.Info());
                App.Current.Shutdown();
                return(null);
            }
        }
Example #15
0
        public SavedListVMBase(ISimpleRepo <TDTO> repository, TArg appArguments, bool doReload = true)
        {
            _repo         = repository;
            AppArgs       = appArguments;
            AddNewCmd     = R2Command.Relay(AddNewItem, _ => CanAddNewItem(), "Add New Item");
            RefreshCmd    = R2Command.Relay(ReloadFromDB, null, "Refresh");
            MainMethodCmd = R2Command.Relay(RunMainMethod, _ => PrivateCanRunMain(), MainMethodCmdLabel);

            ItemsList.ItemDeleted       += (s, e) => ExecuteDeleteRecord(e);
            ItemsList.ItemsDeleted      += (s, e) => ExecuteDeleteRecords(e);
            ItemsList.CollectionChanged += (s, e) => OnCollectionChanged();
            ItemsList.ItemsReplaced     += (s, e) => OnItemsReplaced();
            ItemsList.ItemOpened        += ItemsList_ItemOpened;
            if (_repo != null)
            {
                _repo.ContentChanged += (s, e) => ReloadFromDB();
            }

            if (doReload)
            {
                ReloadFromDB();
            }
        }
Example #16
0
 protected override List <StallDTO> QueryItems(ISimpleRepo <StallDTO> db)
 => AppArgs.MarketState.Stalls.ForSection(AppArgs.CurrentSection);
Example #17
0
 public ResponseFilter(ISimpleRepo repo)
 {
     _isimpleRepo = repo;
 }
Example #18
0
 public BankDepositsRepo1(ISimpleRepo <BankDepositDTO> simpleRepo) : base(simpleRepo)
 {
 }
Example #19
0
 public SimpleRepoShimBase(ISimpleRepo <T> simpleRepo)
 {
     _repo = simpleRepo;
     _repo.ContentChanged += (s, e) => ContentChanged?.Invoke(s, e);
 }
 public PassbookRowsSimpleRepo(ISimpleRepo <PassbookRowDTO> simpleRepo) : base(simpleRepo)
 {
 }
Example #21
0
 public FilteredSavedListVMBase(ISimpleRepo <TDTO> simpleRepo, TArg appArguments, bool doReload = true) : base(simpleRepo, appArguments, doReload)
 {
     Filter.TextFilterChanged += (s, e) => ApplyTextFilters();
 }
Example #22
0
 protected override List <FundRequestDTO> QueryItems(ISimpleRepo <FundRequestDTO> db)
 => base.QueryItems(db).Where(_ => _.BankAccountId == AppArgs.CurrentBankAcct.Id)
 .OrderByDescending(_ => _.SerialNum)
 .ToList();
Example #23
0
 public ActiveLeasesRepo1(ISimpleRepo <LeaseDTO> simpleRepo, IMarketStateDB allRepositories) : base(simpleRepo, allRepositories)
 {
 }
Example #24
0
 public InactiveLeasesRepo1(ISimpleRepo <InactiveLeaseDTO> simpleRepo, MarketStateDbBase marketStateDB) : base(simpleRepo, marketStateDB)
 {
 }
Example #25
0
 public FundRequestsRepo1(ISimpleRepo <FundRequestDTO> simpleRepo) : base(simpleRepo)
 {
 }
Example #26
0
 protected override List <FundRequestDTO> QueryItems(ISimpleRepo <FundRequestDTO> db)
 => db.Find(_ => _.BankAccountId == AppArgs.CurrentBankAcct.Id);
Example #27
0
 public MainListVM(ISimpleRepo <FundRequestDTO> simpleRepo, ITenantDBsDir appArguments, bool doReload = true) : base(simpleRepo, appArguments, doReload)
 {
 }
Example #28
0
        //private ICollectionsDir _colxnsDir;


        public BalanceAdjsRepo1(DateTime date, ISimpleRepo <BalanceAdjustmentDTO> simpleRepo, IBalanceDB balanceDB) : base(simpleRepo)
        {
            _balDB = balanceDB;
            //_colxnsDir = collectionsDir;
            Date = date;
        }
Example #29
0
 public StallsRepo1(ISimpleRepo <StallDTO> simpleRepo, MarketStateDbBase allRepositories) : base(simpleRepo, allRepositories)
 {
 }
Example #30
0
 public PreparedChequesRepo1(ISimpleRepo <ChequeVoucherDTO> simpleRepo) : base(simpleRepo)
 {
 }