/// <summary> /// 获得数据列表 /// </summary> public List <zlzw.Model.JobListModel> DataTableToList(DataTable dt) { List <zlzw.Model.JobListModel> modelList = new List <zlzw.Model.JobListModel>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { zlzw.Model.JobListModel model; for (int n = 0; n < rowsCount; n++) { model = new zlzw.Model.JobListModel(); if (dt.Rows[n]["JobID"] != null && dt.Rows[n]["JobID"].ToString() != "") { model.JobID = int.Parse(dt.Rows[n]["JobID"].ToString()); } if (dt.Rows[n]["JobTypeID"] != null && dt.Rows[n]["JobTypeID"].ToString() != "") { model.JobTypeID = int.Parse(dt.Rows[n]["JobTypeID"].ToString()); } if (dt.Rows[n]["JobName"] != null && dt.Rows[n]["JobName"].ToString() != "") { model.JobName = dt.Rows[n]["JobName"].ToString(); } if (dt.Rows[n]["IsHot"] != null && dt.Rows[n]["IsHot"].ToString() != "") { model.IsHot = int.Parse(dt.Rows[n]["IsHot"].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()); } if (dt.Rows[n]["Other01"] != null && dt.Rows[n]["Other01"].ToString() != "") { model.Other01 = dt.Rows[n]["Other01"].ToString(); } if (dt.Rows[n]["Other02"] != null && dt.Rows[n]["Other02"].ToString() != "") { model.Other02 = dt.Rows[n]["Other02"].ToString(); } if (dt.Rows[n]["Other03"] != null && dt.Rows[n]["Other03"].ToString() != "") { model.Other03 = int.Parse(dt.Rows[n]["Other03"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(zlzw.Model.JobListModel model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(zlzw.Model.JobListModel model) { return(dal.Add(model)); }