/// <summary> /// 获得数据列表 /// </summary> public List <dbamet.Model.ActiveIntro> DataTableToList(DataTable dt) { List <dbamet.Model.ActiveIntro> modelList = new List <dbamet.Model.ActiveIntro>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { dbamet.Model.ActiveIntro model; for (int n = 0; n < rowsCount; n++) { model = new dbamet.Model.ActiveIntro(); if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "") { model.id = int.Parse(dt.Rows[n]["id"].ToString()); } if (dt.Rows[n]["type"] != null && dt.Rows[n]["type"].ToString() != "") { model.type = dt.Rows[n]["type"].ToString(); } if (dt.Rows[n]["content"] != null && dt.Rows[n]["content"].ToString() != "") { model.content = dt.Rows[n]["content"].ToString(); } if (dt.Rows[n]["modifytime"] != null && dt.Rows[n]["modifytime"].ToString() != "") { model.modifytime = DateTime.Parse(dt.Rows[n]["modifytime"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(dbamet.Model.ActiveIntro model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(dbamet.Model.ActiveIntro model) { return(dal.Add(model)); }