/// <summary> /// 获得数据列表 /// </summary> public List <Dianda.Model.News_Columns> DataTableToList(DataTable dt) { List <Dianda.Model.News_Columns> modelList = new List <Dianda.Model.News_Columns>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Dianda.Model.News_Columns model; for (int n = 0; n < rowsCount; n++) { model = new Dianda.Model.News_Columns(); if (dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } model.NAME = dt.Rows[n]["NAME"].ToString(); if (dt.Rows[n]["PARENTID"].ToString() != "") { model.PARENTID = int.Parse(dt.Rows[n]["PARENTID"].ToString()); } model.ForItems = dt.Rows[n]["ForItems"].ToString(); model.ItemsID = dt.Rows[n]["ItemsID"].ToString(); if (dt.Rows[n]["DATETIME"].ToString() != "") { model.DATETIME = DateTime.Parse(dt.Rows[n]["DATETIME"].ToString()); } if (dt.Rows[n]["ISMENU"].ToString() != "") { model.ISMENU = int.Parse(dt.Rows[n]["ISMENU"].ToString()); } if (dt.Rows[n]["ISSHENHE"].ToString() != "") { model.ISSHENHE = int.Parse(dt.Rows[n]["ISSHENHE"].ToString()); } if (dt.Rows[n]["ONLYONE"].ToString() != "") { model.ONLYONE = int.Parse(dt.Rows[n]["ONLYONE"].ToString()); } if (dt.Rows[n]["DELFLAG"].ToString() != "") { model.DELFLAG = int.Parse(dt.Rows[n]["DELFLAG"].ToString()); } model.COLUMNSPATH = dt.Rows[n]["COLUMNSPATH"].ToString(); if (dt.Rows[n]["SHUNXU"].ToString() != "") { model.SHUNXU = int.Parse(dt.Rows[n]["SHUNXU"].ToString()); } model.IMAGEURL = dt.Rows[n]["IMAGEURL"].ToString(); model.PNAMES = dt.Rows[n]["PNAMES"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Dianda.Model.News_Columns model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Dianda.Model.News_Columns model) { return(dal.Add(model)); }