/// <summary> /// 获得数据列表 /// </summary> public List<zlzw.Model.DictionaryListModel> DataTableToList(DataTable dt) { List<zlzw.Model.DictionaryListModel> modelList = new List<zlzw.Model.DictionaryListModel>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { zlzw.Model.DictionaryListModel model; for (int n = 0; n < rowsCount; n++) { model = new zlzw.Model.DictionaryListModel(); if (dt.Rows[n]["DictionaryListID"] != null && dt.Rows[n]["DictionaryListID"].ToString() != "") { model.DictionaryListID = int.Parse(dt.Rows[n]["DictionaryListID"].ToString()); } if (dt.Rows[n]["DictionaryKey"] != null && dt.Rows[n]["DictionaryKey"].ToString() != "") { model.DictionaryKey = dt.Rows[n]["DictionaryKey"].ToString(); } if (dt.Rows[n]["DictionaryValue"] != null && dt.Rows[n]["DictionaryValue"].ToString() != "") { model.DictionaryValue = dt.Rows[n]["DictionaryValue"].ToString(); } if (dt.Rows[n]["DictionaryCategory"] != null && dt.Rows[n]["DictionaryCategory"].ToString() != "") { model.DictionaryCategory = dt.Rows[n]["DictionaryCategory"].ToString(); } if (dt.Rows[n]["DictionaryDesc"] != null && dt.Rows[n]["DictionaryDesc"].ToString() != "") { model.DictionaryDesc = dt.Rows[n]["DictionaryDesc"].ToString(); } if (dt.Rows[n]["OrderNumber"] != null && dt.Rows[n]["OrderNumber"].ToString() != "") { model.OrderNumber = int.Parse(dt.Rows[n]["OrderNumber"].ToString()); } if (dt.Rows[n]["IsInner"] != null && dt.Rows[n]["IsInner"].ToString() != "") { model.IsInner = int.Parse(dt.Rows[n]["IsInner"].ToString()); } if (dt.Rows[n]["IsEnable"] != null && dt.Rows[n]["IsEnable"].ToString() != "") { model.IsEnable = int.Parse(dt.Rows[n]["IsEnable"].ToString()); } if (dt.Rows[n]["PublishDate"] != null && dt.Rows[n]["PublishDate"].ToString() != "") { model.PublishDate = DateTime.Parse(dt.Rows[n]["PublishDate"].ToString()); } modelList.Add(model); } } return modelList; }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(zlzw.Model.DictionaryListModel model) { return dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(zlzw.Model.DictionaryListModel model) { return dal.Add(model); }