/// <summary> /// 获取菜单信息 /// </summary> /// <param name="menuID">菜单编号</param> /// <returns></returns> public MenuModel GetMenuModel(string menuID) { DataSet ds= menudal.GetMenuList("*", "MenuID=" + menuID); MenuModel model = new MenuModel(); if (ds!=null&&ds.Tables.Count>0&& ds.Tables[0].Rows.Count > 0) { DataTable dt = ds.Tables[0]; DataRow dr = dt.Rows[0]; model.Icon = dr["Icon"].ToString(); model.IsOpen = bool.Parse(dr["IsOpen"].ToString()); model.MenuID =int.Parse(menuID); model.MenuName = dr["MenuName"].ToString(); model.MenuTip = dr["MenuTip"].ToString(); model.MenuUrl = dr["MenuUrl"].ToString(); model.OpenIcon = dr["OpenIcon"].ToString(); model.ParentMenuID = int.Parse(dr["ParentMenuID"].ToString()); model.SystemNO = dr["SystemNO"].ToString(); model.Target = dr["Target"].ToString(); model.OrderNO = int.Parse(dr["OrderNo"].ToString().Equals("") ? "0" : dr["OrderNo"].ToString()); return model; } else { return null; } }
/// <summary> /// 插入数据 /// </summary> /// <param name="menuModel"></param> /// <returns></returns> public int Menu_Info_Add(MenuModel menuModel) { return menudal.Menu_Info_Add(menuModel); }
/// <summary> /// 更新菜单 /// </summary> /// <param name="menuModel"></param> /// <returns></returns> public int UpdateMenu_Info(MenuModel menuModel) { return menudal.UpdateMenu_Info(menuModel); }
/// <summary> /// 更新菜单 /// </summary> /// <param name="menuModel"></param> /// <returns></returns> public int UpdateMenu_Info(MenuModel menuModel) { SqlParameter[] para = { new SqlParameter("@SystemNO",SqlDbType.NVarChar,20), new SqlParameter("@MenuName",SqlDbType.NVarChar,20), new SqlParameter("@ParentMenuID",SqlDbType.Int), new SqlParameter("@MenuTip",SqlDbType.NVarChar,20), new SqlParameter("@MenuUrl",SqlDbType.VarChar,100), new SqlParameter("@Target",SqlDbType.VarChar,20), new SqlParameter("@Icon",SqlDbType.VarChar,100), new SqlParameter("@OpenIcon",SqlDbType.VarChar,100), new SqlParameter("@IsOpen",SqlDbType.Bit), new SqlParameter("@MenuID",SqlDbType.Int), new SqlParameter("@OrderNO",SqlDbType.Int), new SqlParameter("@helpUrl",SqlDbType.VarChar,100) }; para[0].Value = menuModel.SystemNO; para[1].Value = menuModel.MenuName; para[2].Value = menuModel.ParentMenuID; para[3].Value = menuModel.MenuTip; para[4].Value = menuModel.MenuUrl; para[5].Value = menuModel.Target; para[6].Value = menuModel.Icon; para[7].Value = menuModel.OpenIcon; para[8].Value = menuModel.IsOpen; para[9].Value = menuModel.MenuID; para[10].Value = menuModel.OrderNO; para[11].Value = menuModel.HelpUrl; try { int iReturn = 0; DbHelperSQL.RunProcedure("Power_Update_Menu", para, out iReturn); return iReturn; } catch { return -1; } }