/// <summary> /// 获得数据列表 /// </summary> public List<ForKids.DB.Model.CLASSBASE> DataTableToList(DataTable dt) { List<ForKids.DB.Model.CLASSBASE> modelList = new List<ForKids.DB.Model.CLASSBASE>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { ForKids.DB.Model.CLASSBASE model; for (int n = 0; n < rowsCount; n++) { model = new ForKids.DB.Model.CLASSBASE(); if(dt.Rows[n]["ID"]!=null && dt.Rows[n]["ID"].ToString()!="") { model.ID=int.Parse(dt.Rows[n]["ID"].ToString()); } if(dt.Rows[n]["HEADTEACHERID"]!=null && dt.Rows[n]["HEADTEACHERID"].ToString()!="") { //model.HEADTEACHERID=dt.Rows[n]["HEADTEACHERID"].ToString(); } if(dt.Rows[n]["GRADEID"]!=null && dt.Rows[n]["GRADEID"].ToString()!="") { //model.GRADEID=dt.Rows[n]["GRADEID"].ToString(); } if(dt.Rows[n]["NAME"]!=null && dt.Rows[n]["NAME"].ToString()!="") { model.NAME=dt.Rows[n]["NAME"].ToString(); } if(dt.Rows[n]["KIDCOUNT"]!=null && dt.Rows[n]["KIDCOUNT"].ToString()!="") { //model.KIDCOUNT=dt.Rows[n]["KIDCOUNT"].ToString(); } modelList.Add(model); } } return modelList; }
/// <summary> /// 获得数据列表 /// </summary> public List <ForKids.DB.Model.CLASSBASE> DataTableToList(DataTable dt) { List <ForKids.DB.Model.CLASSBASE> modelList = new List <ForKids.DB.Model.CLASSBASE>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { ForKids.DB.Model.CLASSBASE model; for (int n = 0; n < rowsCount; n++) { model = new ForKids.DB.Model.CLASSBASE(); if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } if (dt.Rows[n]["HEADTEACHERID"] != null && dt.Rows[n]["HEADTEACHERID"].ToString() != "") { model.HEADTEACHERID = int.Parse(dt.Rows[n]["HEADTEACHERID"].ToString()); } if (dt.Rows[n]["GRADEID"] != null && dt.Rows[n]["GRADEID"].ToString() != "") { model.GRADEID = int.Parse(dt.Rows[n]["GRADEID"].ToString()); } if (dt.Rows[n]["NAME"] != null && dt.Rows[n]["NAME"].ToString() != "") { model.NAME = dt.Rows[n]["NAME"].ToString(); } if (dt.Rows[n]["KIDCOUNT"] != null && dt.Rows[n]["KIDCOUNT"].ToString() != "") { model.KIDCOUNT = int.Parse(dt.Rows[n]["KIDCOUNT"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(ForKids.DB.Model.CLASSBASE model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(ForKids.DB.Model.CLASSBASE model) { return(dal.Add(model)); }