private Table GetFreeTable(DateTime orderDate)
        {
            var allReservations = UnitOfWork.All <ReservationOrder>();
            var table           =
                UnitOfWork.GetActual <Table>(
                    x =>
                    x.IsNewest && !x.IsDeleted &&
                    !allReservations
                    .Any(
                        r =>
                        r.Status != ReservationOrderStatus.Cancelled && r.Table == x && DbFunctions.DiffMinutes(r.ReservationTime, orderDate) < 30));

            return(table);
        }
Exemplo n.º 2
0
        void ILoad <Items> .Init()
        {
            if (purchaseRequests == null)
            {
                frmItems.ItemsGridControl.DataSource       = new BindingList <Items>(new UnitOfWork().ItemsRepo.Get());
                frmItems.cboCategory.Properties.DataSource =
                    new EntityServerModeSource()
                {
                    QueryableSource = new UnitOfWork().CategoriesRepo.Fetch()
                };
                frmItems.cboSearch.Properties.DataSource = new EntityServerModeSource()
                {
                    QueryableSource = new UnitOfWork().ItemsRepo.Fetch()
                };
                return;
            }
            var itemsSelected = new UnitOfWork().PRDetailsRepo.Get(m => m.PRId == purchaseRequests.Id).Select(x => x.ItemId);

            frmItems.ItemsGridControl.DataSource       = new BindingList <Items>(new UnitOfWork().ItemsRepo.Get(x => itemsSelected.All(m => m != x.Id)));
            frmItems.cboCategory.Properties.DataSource = new UnitOfWork().ItemsRepo.Fetch(x => x.Category != null || x.Category != "").GroupBy(x => x.Category).ToList().Select(x => new Items()
            {
                Category = x.Key
            });
            frmItems.cboSearch.Properties.DataSource = new UnitOfWork().ItemsRepo.Fetch().Select(x => new { x.Item }).ToList().Select(x => new Items()
            {
                Item = x.Item
            });
        }
Exemplo n.º 3
0
        public void Search(string search)
        {
            if (purchaseRequests == null)
            {
                frmItems.ItemsGridControl.DataSource = new BindingList <Items>(new UnitOfWork().ItemsRepo.Get(x => (x.Item.StartsWith(search) || x.Category.Contains(search))));
                return;
            }
            var itemsSelected = new UnitOfWork().PRDetailsRepo.Get(m => m.PRId == purchaseRequests.Id).Select(x => x.ItemId);

            frmItems.ItemsGridControl.DataSource = new BindingList <Items>(new UnitOfWork().ItemsRepo.Get(x => itemsSelected.All(m => m != x.Id) && (x.Item.StartsWith(search) || x.Category.Contains(search))));
        }