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