using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using dccdc.Models; using Dapper; namespace dccdc.DAL { public class AccessygsqDal { public List GetAllList(string TrueName) { using (IDbConnection conn = CommHelper.GetSqlConnection()) { string sql = ""; if(!string.IsNullOrEmpty(TrueName)) { TrueName = "%" + TrueName + "%"; sql += "and TrueName like @TrueName"; } return conn.Query("select * from oa.dbo.erpuser where 1=1 "+sql, new { @TrueName = TrueName }).ToList(); } } public List findName(String TrueName) { using (IDbConnection conn = CommHelper.GetSqlConnection()) { string param = ""; param = " and TrueName like @TrueName"; return conn.Query("select * from oa.dbo.erpuser where 1=1 " + param, new { @TrueName = TrueName }).ToList(); } } } }