Esempio n. 1
0
        /// <summary>
        /// Hàm lấy các hóa đơn theo điều kiện lọc
        /// </summary>
        /// <param name="invoiceDto">Đối tượng Dto</param>
        /// <returns>Danh sách hóa đơn</returns>
        /// Người tạo: ntxuan (20/6/2019)
        public List <Invoice> GetListInvoiceByFilter(InvoiceDto invoiceDto)
        {
            var result   = new List <Invoice>();
            var invoices = invoiceDL.GetAllInvoice();

            if (invoiceDto.TypeFilter == "search-importNumber")
            {
                result = invoices.Where(s => s.ImportNumber.ToLower().Contains(invoiceDto.TextFilter.ToLower())).ToList();
            }
            else if (invoiceDto.TypeFilter == "search-supplierName")
            {
                var supplierBL = new SupplierBL();
                result = invoices.Where(s => supplierBL.GetSupplierByID(s.SupplierID).SupplierName.ToLower().Contains(invoiceDto.TextFilter.ToLower())).ToList();
            }
            else if (invoiceDto.TypeFilter == "search-explanation")
            {
                result = invoices.Where(s => s.Explanation.ToLower().Contains(invoiceDto.TextFilter.ToLower())).ToList();
            }

            return(result);
        }