/// <summary> /// 获得数据列表 /// </summary> public List <Maticsoft.Model.NicheInfo> DataTableToList(DataTable dt) { List <Maticsoft.Model.NicheInfo> modelList = new List <Maticsoft.Model.NicheInfo>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Maticsoft.Model.NicheInfo model; for (int n = 0; n < rowsCount; n++) { model = new Maticsoft.Model.NicheInfo(); if (dt.Rows[n]["NicheID"].ToString() != "") { model.NicheID = int.Parse(dt.Rows[n]["NicheID"].ToString()); } model.NicheTitle = dt.Rows[n]["NicheTitle"].ToString(); model.NicheKey = dt.Rows[n]["NicheKey"].ToString(); if (dt.Rows[n]["Fatime"].ToString() != "") { model.Fatime = DateTime.Parse(dt.Rows[n]["Fatime"].ToString()); } model.Write = dt.Rows[n]["Write"].ToString(); model.ImageURL = dt.Rows[n]["ImageURL"].ToString(); if (dt.Rows[n]["NicheTypeID"].ToString() != "") { model.NicheTypeID = int.Parse(dt.Rows[n]["NicheTypeID"].ToString()); } if (dt.Rows[n]["HitNum"].ToString() != "") { model.HitNum = int.Parse(dt.Rows[n]["HitNum"].ToString()); } model.NicheContent = dt.Rows[n]["NicheContent"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Maticsoft.Model.NicheInfo model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Maticsoft.Model.NicheInfo model) { return(dal.Add(model)); }