/// <summary> /// 获得数据列表 /// </summary> public List <StudentMS.Model.Course> DataTableToList(DataTable dt) { List <StudentMS.Model.Course> modelList = new List <StudentMS.Model.Course>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { StudentMS.Model.Course model; for (int n = 0; n < rowsCount; n++) { model = new StudentMS.Model.Course(); model.CNO = dt.Rows[n]["CNO"].ToString(); model.CName = dt.Rows[n]["CName"].ToString(); if (dt.Rows[n]["Credit"].ToString() != "") { model.Credit = decimal.Parse(dt.Rows[n]["Credit"].ToString()); } model.CFirst = dt.Rows[n]["CFirst"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(StudentMS.Model.Course model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(StudentMS.Model.Course model) { dal.Add(model); }