using DbCommon.BusinessCore.DbCore;
using DbCommon.Enties.DbModels;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DbCommon.BusinessCore.BaseCore
{
    public class WareHouseManager : DbContext<WareHouse>
    {
        public DataTable QueryWareHouse()
        {
            return CurrentDb.AsQueryable()
                .OrderBy(d => d.WareHouseProperty, SqlSugar.OrderByType.Asc)
                .ToDataTable();
        }

        public DataTable QueryWareHouse(string filter)
        {
            return CurrentDb.AsQueryable()
                .Where(d => d.WareHouseCode.Contains(filter))
                .OrderBy(d => d.WareHouseProperty, SqlSugar.OrderByType.Asc)
                .ToDataTable();
        }

        public DataTable QueryWareHouse(string[] filters)
        {
            return CurrentDb.AsQueryable()
                .Where(d => filters.Contains(d.WareHouseCode))
                .OrderBy(d => d.WareHouseProperty, SqlSugar.OrderByType.Asc)
                .ToDataTable();
        }
    }
}
