コード例 #1
0
        public int Count(ReceiptNoteSearchEntity ReceiptNoteSearchEntity)
        {
            if (ReceiptNoteSearchEntity == null)
            {
                ReceiptNoteSearchEntity = new ReceiptNoteSearchEntity();
            }
            IQueryable <ReceiptNote> ReceiptNotes = context.ReceiptNotes;

            Apply(ReceiptNotes, ReceiptNoteSearchEntity);
            return(ReceiptNotes.Count());
        }
コード例 #2
0
        public List <ReceiptNote> List(ReceiptNoteSearchEntity ReceiptNoteSearchEntity)
        {
            if (ReceiptNoteSearchEntity == null)
            {
                ReceiptNoteSearchEntity = new ReceiptNoteSearchEntity();
            }
            IQueryable <ReceiptNote> ReceiptNotes = context.ReceiptNotes
                                                    .Include(rn => rn.WareHouse)
                                                    .Include(rn => rn.Supplier)
                                                    .Include(rn => rn.ReceiptNoteLines).ThenInclude(rnl => rnl.Product);

            Apply(ReceiptNotes, ReceiptNoteSearchEntity);
            SkipAndTake(ReceiptNotes, ReceiptNoteSearchEntity);
            return(ReceiptNotes.ToList());
        }
コード例 #3
0
ファイル: ReceiptNoteService.cs プロジェクト: linhlpv/EShop-
        public List <ReceiptNoteEntity> Get(EmployeeEntity EmployeeEntity, ReceiptNoteSearchEntity ReceiptNoteSearchEntity)
        {
            List <ReceiptNote> ReceiptNotes = UnitOfWork.ReceiptNoteRepository.List(ReceiptNoteSearchEntity);

            return(ReceiptNotes.ToList().Select(rn => new ReceiptNoteEntity(rn, rn.WareHouse, rn.Supplier)).ToList());
        }
コード例 #4
0
ファイル: ReceiptNoteService.cs プロジェクト: linhlpv/EShop-
 public int Count(EmployeeEntity EmployeeEntity, ReceiptNoteSearchEntity ReceiptNoteSearchEntity)
 {
     return(UnitOfWork.ReceiptNoteRepository.Count(ReceiptNoteSearchEntity));
 }
コード例 #5
0
 public List<ReceiptNoteEntity> Get(ReceiptNoteSearchEntity SearchReceiptNoteEntity)
 {
     return ReceiptNoteService.Get(EmployeeEntity, SearchReceiptNoteEntity);
 }
コード例 #6
0
 public long Count(ReceiptNoteSearchEntity SearchReceiptNoteEntity)
 {
     return ReceiptNoteService.Count(EmployeeEntity, SearchReceiptNoteEntity);
 }
コード例 #7
0
 private IQueryable <ReceiptNote> Apply(IQueryable <ReceiptNote> ReceiptNotes, ReceiptNoteSearchEntity ReceiptNoteSearchEntity)
 {
     if (ReceiptNoteSearchEntity.Id.HasValue)
     {
         ReceiptNotes = ReceiptNotes.Where(wh => wh.Id == ReceiptNoteSearchEntity.Id.Value);
     }
     if (ReceiptNoteSearchEntity.WareHouseId.HasValue)
     {
         ReceiptNotes = ReceiptNotes.Where(wh => wh.WareHouseId == ReceiptNoteSearchEntity.WareHouseId.Value);
     }
     if (ReceiptNoteSearchEntity.SupplierId.HasValue)
     {
         ReceiptNotes = ReceiptNotes.Where(wh => wh.SupplierId == ReceiptNoteSearchEntity.SupplierId.Value);
     }
     if (ReceiptNoteSearchEntity.ReceiptNoteNo.HasValue)
     {
         ReceiptNotes = ReceiptNotes.Where(wh => wh.ReceiptNoteNo == ReceiptNoteSearchEntity.ReceiptNoteNo.Value);
     }
     if (!string.IsNullOrEmpty(ReceiptNoteSearchEntity.Title))
     {
         ReceiptNotes = ReceiptNotes.Where(wh => wh.Title.ToLower().Contains(ReceiptNoteSearchEntity.Title.ToLower()));
     }
     if (!string.IsNullOrEmpty(ReceiptNoteSearchEntity.Address))
     {
         ReceiptNotes = ReceiptNotes.Where(wh => wh.Address.ToLower().Contains(ReceiptNoteSearchEntity.Address.ToLower()));
     }
     if (!string.IsNullOrEmpty(ReceiptNoteSearchEntity.PhoneNumber))
     {
         ReceiptNotes = ReceiptNotes.Where(wh => wh.PhoneNumber.ToLower().Contains(ReceiptNoteSearchEntity.PhoneNumber.ToLower()));
     }
     if (!string.IsNullOrEmpty(ReceiptNoteSearchEntity.Comment))
     {
         ReceiptNotes = ReceiptNotes.Where(wh => wh.Comment.ToLower().Contains(ReceiptNoteSearchEntity.Comment.ToLower()));
     }
     if (ReceiptNoteSearchEntity.Lock.HasValue)
     {
         ReceiptNotes = ReceiptNotes.Where(wh => wh.Lock == ReceiptNoteSearchEntity.Lock.Value);
     }
     if (ReceiptNoteSearchEntity.EmployeeId.HasValue)
     {
         ReceiptNotes = ReceiptNotes.Where(wh => wh.EmployeeId == ReceiptNoteSearchEntity.EmployeeId.Value);
     }
     return(ReceiptNotes);
 }