Пример #1
0
        /// <summary>
        /// 更新菜单
        /// </summary>
        /// <param name="model"></param>
        /// <returns>成功返回true</returns>
        public static bool UpdateMenus(SeatManage.ClassModel.SysMenuInfo model)
        {
            IWCFService.ISeatManageService seatService = new WcfServiceForSeatManage.SeatManageDateService();
            bool error = false;

            try
            {
                return(seatService.UpdateMenus(model));
            }
            catch (Exception ex)
            {
                error = true;
                WriteLog.Write("更新菜单失败:" + ex.Message);
                return(false);
            }
        }
        /// <summary>
        /// 更新功能菜单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Update(SeatManage.ClassModel.SysMenuInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SysMenu ");
            strSql.Append(" set Mainnum=@Mainnum, ModSeq=@ModSeq, ItemSeq=@ItemSeq, MCaption=@MCaption, MenuImagePath=@MenuImagePath, MenuLv=@MenuLv");
            strSql.Append(" where MenuID=@MenuID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Mainnum",       SqlDbType.NVarChar, 50),
                new SqlParameter("@ModSeq",        SqlDbType.NVarChar, 50),
                new SqlParameter("@ItemSeq",       SqlDbType.NVarChar, 50),
                new SqlParameter("@MCaption",      SqlDbType.NVarChar, 50),
                new SqlParameter("@MenuImagePath", SqlDbType.NVarChar, 50),
                new SqlParameter("@MenuLv",        SqlDbType.Int),
                new SqlParameter("@MenuID",        SqlDbType.Int)
            };
            parameters[0].Value = model.MainNum;
            parameters[1].Value = model.FuncPageNum;
            parameters[2].Value = model.Index;
            parameters[3].Value = model.MenuName;
            parameters[4].Value = model.ImageUrl;
            parameters[5].Value = model.MenuLv;
            parameters[6].Value = model.MenuID;
            try
            {
                int row = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
                if (row > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }