/// <summary> /// 获得数据列表 /// </summary> public List <JY.Model.InformationType> DataTableToList(DataTable dt) { List <JY.Model.InformationType> modelList = new List <JY.Model.InformationType>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { JY.Model.InformationType model; for (int n = 0; n < rowsCount; n++) { model = new JY.Model.InformationType(); if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "") { model.ID = long.Parse(dt.Rows[n]["ID"].ToString()); } if (dt.Rows[n]["TypeName"] != null && dt.Rows[n]["TypeName"].ToString() != "") { model.TypeName = dt.Rows[n]["TypeName"].ToString(); } if (dt.Rows[n]["Fid"] != null && dt.Rows[n]["Fid"].ToString() != "") { model.Fid = int.Parse(dt.Rows[n]["Fid"].ToString()); } if (dt.Rows[n]["Sort"] != null && dt.Rows[n]["Sort"].ToString() != "") { model.Sort = int.Parse(dt.Rows[n]["Sort"].ToString()); } if (dt.Rows[n]["Depth"] != null && dt.Rows[n]["Depth"].ToString() != "") { model.Depth = int.Parse(dt.Rows[n]["Depth"].ToString()); } if (dt.Rows[n]["Remark"] != null && dt.Rows[n]["Remark"].ToString() != "") { model.Remark = dt.Rows[n]["Remark"].ToString(); } if (dt.Rows[n]["CreateDate"] != null && dt.Rows[n]["CreateDate"].ToString() != "") { model.CreateDate = DateTime.Parse(dt.Rows[n]["CreateDate"].ToString()); } if (dt.Rows[n]["IsDelete"] != null && dt.Rows[n]["IsDelete"].ToString() != "") { if ((dt.Rows[n]["IsDelete"].ToString() == "1") || (dt.Rows[n]["IsDelete"].ToString().ToLower() == "true")) { model.IsDelete = true; } else { model.IsDelete = false; } } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(JY.Model.InformationType model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public long Add(JY.Model.InformationType model) { return(dal.Add(model)); }