/// <summary> /// 获得数据列表 /// </summary> public List <ROYcms.Sys.Model.ROYcms_ASK> DataTableToList(DataTable dt) { List <ROYcms.Sys.Model.ROYcms_ASK> modelList = new List <ROYcms.Sys.Model.ROYcms_ASK>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { ROYcms.Sys.Model.ROYcms_ASK model; for (int n = 0; n < rowsCount; n++) { model = new ROYcms.Sys.Model.ROYcms_ASK(); if (dt.Rows[n]["Id"] != null && dt.Rows[n]["Id"].ToString() != "") { model.Id = int.Parse(dt.Rows[n]["Id"].ToString()); } if (dt.Rows[n]["UserId"] != null && dt.Rows[n]["UserId"].ToString() != "") { model.UserId = int.Parse(dt.Rows[n]["UserId"].ToString()); } if (dt.Rows[n]["ASKType"] != null && dt.Rows[n]["ASKType"].ToString() != "") { model.ASKType = int.Parse(dt.Rows[n]["ASKType"].ToString()); } if (dt.Rows[n]["State"] != null && dt.Rows[n]["State"].ToString() != "") { model.State = int.Parse(dt.Rows[n]["State"].ToString()); } if (dt.Rows[n]["Title"] != null && dt.Rows[n]["Title"].ToString() != "") { model.Title = dt.Rows[n]["Title"].ToString(); } if (dt.Rows[n]["Contents"] != null && dt.Rows[n]["Contents"].ToString() != "") { model.Contents = dt.Rows[n]["Contents"].ToString(); } if (dt.Rows[n]["CreateTime"] != null && dt.Rows[n]["CreateTime"].ToString() != "") { model.CreateTime = DateTime.Parse(dt.Rows[n]["CreateTime"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(ROYcms.Sys.Model.ROYcms_ASK model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(ROYcms.Sys.Model.ROYcms_ASK model) { return(dal.Add(model)); }