/// <summary> /// 获得数据列表 /// </summary> public List <LPWeb.Model.UserRecentItems> DataTableToList(DataTable dt) { List <LPWeb.Model.UserRecentItems> modelList = new List <LPWeb.Model.UserRecentItems>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { LPWeb.Model.UserRecentItems model; for (int n = 0; n < rowsCount; n++) { model = new LPWeb.Model.UserRecentItems(); if (dt.Rows[n]["UserId"].ToString() != "") { model.UserId = int.Parse(dt.Rows[n]["UserId"].ToString()); } if (dt.Rows[n]["LastAccessed"].ToString() != "") { model.LastAccessed = DateTime.Parse(dt.Rows[n]["LastAccessed"].ToString()); } if (dt.Rows[n]["FileId"].ToString() != "") { model.FileId = int.Parse(dt.Rows[n]["FileId"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(LPWeb.Model.UserRecentItems model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(LPWeb.Model.UserRecentItems model) { dal.Add(model); }