/// <summary> /// 获得数据列表 /// </summary> public List <lgk.Model.tb_power> DataTableToList(DataTable dt) { List <lgk.Model.tb_power> modelList = new List <lgk.Model.tb_power>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { lgk.Model.tb_power model; for (int n = 0; n < rowsCount; n++) { model = new lgk.Model.tb_power(); if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } if (dt.Rows[n]["URL"] != null && dt.Rows[n]["URL"].ToString() != "") { model.URL = dt.Rows[n]["URL"].ToString(); } if (dt.Rows[n]["MenuName"] != null && dt.Rows[n]["MenuName"].ToString() != "") { model.MenuName = dt.Rows[n]["MenuName"].ToString(); } if (dt.Rows[n]["ParentID"] != null && dt.Rows[n]["ParentID"].ToString() != "") { model.ParentID = int.Parse(dt.Rows[n]["ParentID"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(lgk.Model.tb_power model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(lgk.Model.tb_power model) { return(dal.Add(model)); }