using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Dapper; namespace dccdc.DAL { public class OA { public object getKSlist(string selected,string ksmc) { using (var db = CommHelper.GetSqlConnection("OADB")) { string sql = "select id,bumenname from erpbumen where dirid<>0"; if(!string.IsNullOrEmpty(ksmc)) { sql += "and bumenname like @ksmc"; } string[] sels = selected.Split(','); if(sels.Length>0) { sql += " and id not in @sels"; } return db.Query(sql, new { ksmc = "%" + ksmc + "%", sels }); } } public object getSelKSlist(string selected) { using (var db = CommHelper.GetSqlConnection("OADB")) { string sql = "select id,bumenname from erpbumen where dirid<>0"; string[] sels = selected.Split(','); sql += " and id in @sels"; return db.Query(sql, new { sels }); } } } }