Ejemplo n.º 1
0
        public List <LeaseDTO> GetAllLeases()
        {
            var activs  = ActiveLeases.GetAll();
            var inactvs = InactiveLeases.GetAll();

            return(activs.Concat(inactvs).ToList());
        }
Ejemplo n.º 2
0
        public LeaseDTO GetOccupant(StallDTO stall)
        {
            var matches = ActiveLeases.GetAll()
                          .Where(_ => _.Stall.Id == stall.Id);

            if (!matches.Any())
            {
                return(null);
            }
            if (matches.Count() > 1)
            {
                throw Bad.Data($"1 occupant for [{stall}] but found [{matches.Count()}]");
            }
            return(matches.Single());
        }
Ejemplo n.º 3
0
        public List <LeaseDTO> ActiveLeasesFor(DateTime date)
        {
            if (date == DateTime.MinValue)
            {
                return(new List <LeaseDTO>());
            }

            var activs = ActiveLeases.GetAll()
                         .Where(_ => _.IsActive(date));

            var inactvs = InactiveLeases.GetAll()
                          .Where(_ => _.IsActive(date));

            return(activs.Concat(inactvs).ToList());
        }
Ejemplo n.º 4
0
 protected override void OnRefreshClicked()
 {
     //Parallel.Invoke
     //(
     //    () => MainToolBar.UpdateAll(),
     //    () => ActiveLeases.ReloadFromDB(),
     //    () => InactiveLeases.ReloadFromDB()
     //);
     ActiveLeases.ReloadFromDB();
     StopBeingBusy();
     Parallel.Invoke
     (
         () => MainToolBar.UpdateAll(),
         () => InactiveLeases.ReloadFromDB()
     );
 }
Ejemplo n.º 5
0
        public LeaseDTO FindLease(int leaseID)
        {
            var match = ActiveLeases.Find(leaseID, false);

            if (match != null)
            {
                return(match);
            }

            match = InactiveLeases.Find(leaseID, false);

            if (match == null)
            {
                throw Fault.NoMatch <LeaseDTO>("Id", leaseID);
            }

            return(match);
        }