using Dapper; using NPOI.SS.Formula.Functions; using System.Data.SqlClient; using static DbTableClass; public class kolDetial : kol { DbConn dbConn = new DbConn(); SqlConnection conn = new SqlConnection(GlobalClass.appsettings("ConnectionStrings:SQLConnectionString")); public List cooperateTypes = new List(); public List fansTypes = new List(); public List makeups = new List(); public List medias = new List(); public List styles = new List(); public kolDetial() { } public kolDetial(kol kolObj) { Type kolType = kolObj.GetType(); foreach (var prop in kolType.GetProperties()) { string propName = prop.Name; var valueProperty = kolType.GetProperty(propName); object propValue = valueProperty.GetValue(kolObj, null); this.GetType().GetProperty(propName).SetValue(this, propValue); } } private void loadList() { if (this.kol_uid != "") { this.cooperateTypes.Clear(); this.fansTypes.Clear(); this.makeups.Clear(); this.medias.Clear(); this.styles.Clear(); this.cooperateTypes = conn.Query("select * from ").ToList(); } } }