/// <summary> /// 获得数据列表 /// </summary> public List <Leadin.Model.AdminType> DataTableToList(DataTable dt) { List <Leadin.Model.AdminType> modelList = new List <Leadin.Model.AdminType>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Leadin.Model.AdminType model; for (int n = 0; n < rowsCount; n++) { model = new Leadin.Model.AdminType(); if (dt.Rows[n]["Id"].ToString() != "") { model.Id = int.Parse(dt.Rows[n]["Id"].ToString()); } model.Title = dt.Rows[n]["Title"].ToString(); if (dt.Rows[n]["SortNum"].ToString() != "") { model.SortNum = int.Parse(dt.Rows[n]["SortNum"].ToString()); } if (dt.Rows[n]["ParentId"].ToString() != "") { model.ParentId = int.Parse(dt.Rows[n]["ParentId"].ToString()); } if (dt.Rows[n]["StateInfo"].ToString() != "") { model.StateInfo = int.Parse(dt.Rows[n]["StateInfo"].ToString()); } model.Remark = dt.Rows[n]["Remark"].ToString(); if (dt.Rows[n]["AddTime"].ToString() != "") { model.AddTime = DateTime.Parse(dt.Rows[n]["AddTime"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Leadin.Model.AdminType model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Leadin.Model.AdminType model) { return(dal.Add(model)); }