/// <summary> /// 获得数据列表 /// </summary> public List <hm.Model.web_site> DataTableToList(DataTable dt) { List <hm.Model.web_site> modelList = new List <hm.Model.web_site>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { hm.Model.web_site model; for (int n = 0; n < rowsCount; n++) { model = new hm.Model.web_site(); if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } if (dt.Rows[n]["webName"] != null && dt.Rows[n]["webName"].ToString() != "") { model.webName = dt.Rows[n]["webName"].ToString(); } if (dt.Rows[n]["title"] != null && dt.Rows[n]["title"].ToString() != "") { model.title = dt.Rows[n]["title"].ToString(); } if (dt.Rows[n]["keywords"] != null && dt.Rows[n]["keywords"].ToString() != "") { model.keywords = dt.Rows[n]["keywords"].ToString(); } if (dt.Rows[n]["description"] != null && dt.Rows[n]["description"].ToString() != "") { model.description = dt.Rows[n]["description"].ToString(); } if (dt.Rows[n]["logo"] != null && dt.Rows[n]["logo"].ToString() != "") { model.logo = dt.Rows[n]["logo"].ToString(); } if (dt.Rows[n]["bottom"] != null && dt.Rows[n]["bottom"].ToString() != "") { model.bottom = dt.Rows[n]["bottom"].ToString(); } if (dt.Rows[n]["qq"] != null && dt.Rows[n]["qq"].ToString() != "") { model.qq = dt.Rows[n]["qq"].ToString(); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(hm.Model.web_site model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(hm.Model.web_site model) { return(dal.Add(model)); }