/// <summary> /// 根据DataTable转换成List对象数组 /// </summary> public List <MultiColorPen.Model.sys_menubutton> DataTableToList(DataTable dt) { List <MultiColorPen.Model.sys_menubutton> modelList = new List <MultiColorPen.Model.sys_menubutton>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { MultiColorPen.Model.sys_menubutton model; for (int n = 0; n < rowsCount; n++) { model = new MultiColorPen.Model.sys_menubutton(); if (dt.Rows[n]["id"].ToString() != "") { model.id = int.Parse(dt.Rows[n]["id"].ToString()); } model.menucode = dt.Rows[n]["menucode"].ToString(); model.btncode = dt.Rows[n]["btncode"].ToString(); if (dt.Rows[n]["createtime"].ToString() != "") { model.createtime = DateTime.Parse(dt.Rows[n]["createtime"].ToString()); } model.createman = dt.Rows[n]["createman"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public int Update(MultiColorPen.Model.sys_menubutton model) { return(dal.Update(model) ? 1 : 0); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(MultiColorPen.Model.sys_menubutton model) { return(dal.Add(model) ? 1 : 0); }