using System; using System.Collections.Generic; using System.Linq; using System.Text; using Dapper; using NX.ERP.Model; namespace NX.ERP.U8 { public class WarehouseDAL { public IEnumerable GetList(string strWhere = "", object Param = null) { using (var conn = U8LoginContext.Instance.Connection) { var sql = "select cWhCode as WarehouseCode,cWhName as WarehouseName from Warehouse"; if (!string.IsNullOrEmpty(strWhere)) { sql += $" where {strWhere}"; } return conn.Query(sql, Param); } } public IEnumerable GetList(NX.ERP.Model.Request.Warehouse Params) { List where = new List(); if (!string.IsNullOrEmpty(Params.WarehouseCode)) { where.Add(" cWhCode like @WarehouseCode"); } if (!string.IsNullOrEmpty(Params.WarehouseName)) { where.Add(" cWhName like @WarehouseName"); } return this.GetList(string.Join(" and ", where.ToArray()), new { WarehouseCode = $"%{Params.WarehouseCode}%", WarehouseName = $"%{Params.WarehouseName}%" }); } } }