Esempio n. 1
0
        public IPagedList <OrderDetail> searchOrder(OrderDetailSearchArgs args, int page, int size)
        {
            var query = _orderdetailRepository.Table;

            if (args != null)
            {
                if (!String.IsNullOrEmpty(args.q))
                {
                    var userList          = _sysUserRepository.Entities.Where(o => o.Account == (args.q));
                    Entities.SysUser user = null;
                    if (userList.Count() > 0)
                    {
                        user = userList.First();
                    }
                    int seatNumber;
                    Entities.LibrarySeat seat = null;
                    bool isInt = int.TryParse(args.q, out seatNumber);
                    if (isInt)
                    {
                        var seatList = _librarySeatRepository.Entities.Where(o => o.SeatNumber == seatNumber);
                        if (seatList.Count() > 0)
                        {
                            seat = seatList.First();
                        }
                    }
                    ;
                    if (user != null && seat != null)
                    {
                        query = query.Where(o => o.SysUserId == user.Id || o.LibrarySeatId == seat.Id);
                    }
                    else if (user != null)
                    {
                        query = query.Where(o => o.SysUserId == user.Id);
                    }
                    else if (seat != null)
                    {
                        query = query.Where(o => o.LibrarySeatId == seat.Id);
                    }
                }
                if (args.hascheckin.HasValue)
                {
                    query = query.Where(o => o.HasCheckIn == args.hascheckin);
                }
                if (args.hasend.HasValue)
                {
                    query = query.Where(o => o.HasEnd == args.hasend);
                }
            }
            query = from e in query orderby e.CreateTime descending select e;
            return(new PagedList <Entities.OrderDetail>(query, page, size));
        }
        public static Entities.LibrarySeat[] CreateLibrarySeat(int floor, int count)
        {
            Entities.LibrarySeat[] librarySeats = new Entities.LibrarySeat[count];
            for (int i = 0; i < count; i++)
            {
                Entities.LibrarySeat seat = new Entities.LibrarySeat();
                seat.Id         = Guid.NewGuid();
                seat.Floor      = floor;
                seat.SeatNumber = floor * 100 + i + 1;
                seat.SeatState  = Entities.LibrarySeat.SeatStates.Available;
                librarySeats[i] = seat;
            }

            return(librarySeats);
        }
Esempio n. 3
0
        public ActionResult EditLibrarySeat(Entities.LibrarySeat model, string returnUrl = null)
        {
            ModelState.Remove("Id");
            ViewBag.ReturnUrl = Url.IsLocalUrl(returnUrl) ? returnUrl : Url.RouteUrl("librarySeatIndex");
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            if (model.Id == Guid.Empty)
            {
                model.Id = Guid.NewGuid();
                _librarySeatService.InsertLibrarySeat(model);
            }
            else
            {
                _librarySeatService.UpdateLibrarySeat(model);
            }


            return(Redirect(ViewBag.ReturnUrl));
        }
Esempio n. 4
0
 public void UpdateLibrarySeat(Entities.LibrarySeat librarySeat)
 {
     _librarySeatRepository.update(librarySeat);
 }
Esempio n. 5
0
 public void InsertLibrarySeat(Entities.LibrarySeat librarySeat)
 {
     _librarySeatRepository.insert(librarySeat);
 }