Journeys_WantHome/Models/kolDetial.cs

52 lines
1.4 KiB
C#

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<kolCooperateType> cooperateTypes = new List<kolCooperateType>();
public List<kolFansType> fansTypes = new List<kolFansType>();
public List<kolMakeup> makeups = new List<kolMakeup>();
public List<kolMedia> medias = new List<kolMedia>();
public List<kolStyle> styles = new List<kolStyle>();
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<kolCooperateType>("select * from ").ToList();
}
}
}