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