Exemple #1
0
        /// <summary>
        /// 基础权限管理-写入二级栏目
        /// </summary>
        /// <param name="info">二级栏目信息业务实体</param>
        /// <returns></returns>
        public int InsertSecondMenu(EyouSoft.Model.SysStructure.MSysMenu2Info info)
        {
            if (info == null || string.IsNullOrEmpty(info.Name) || info.FirstId < 1 || string.IsNullOrEmpty(info.Url))
            {
                return(0);
            }
            info.Name = info.Name.Trim();
            if (string.IsNullOrEmpty(info.Name))
            {
                return(0);
            }
            if (dal.IsExistsMenu2Name(info.FirstId, info.Name))
            {
                return(0);
            }

            int menu2Id = dal.InsertSecondMenu(info);

            if (menu2Id > 0)
            {
                string cacheKey = EyouSoft.Cache.Tag.TagName.SysMenu2s;
                EyouSoft.Cache.Facade.EyouSoftCache.Remove(cacheKey);

                return(menu2Id);
            }

            return(0);
        }
Exemple #2
0
        /// <summary>
        /// 基础权限管理-写入二级栏目
        /// </summary>
        /// <param name="info">二级栏目信息业务实体</param>
        /// <returns></returns>
        public int InsertSecondMenu(EyouSoft.Model.SysStructure.MSysMenu2Info info)
        {
            DbCommand cmd = _db.GetSqlStringCommand(SQL_INSERT_InsertSecondMenu);

            _db.AddInParameter(cmd, "ParentId", DbType.Int32, info.FirstId);
            _db.AddInParameter(cmd, "Name", DbType.String, info.Name);
            _db.AddInParameter(cmd, "Url", DbType.String, info.Url);
            _db.AddInParameter(cmd, "SortId", DbType.Int32, 0);
            _db.AddInParameter(cmd, "IsEnable", DbType.AnsiStringFixedLength, "1");

            using (IDataReader rdr = DbHelper.ExecuteReader(cmd, _db))
            {
                if (rdr.Read())
                {
                    return(Convert.ToInt32(rdr.GetDecimal(0)));
                }
            }

            return(0);
        }
Exemple #3
0
        /// <summary>
        /// btnAddSecond_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAddSecond_Click(object sender, EventArgs e)
        {
            var info = new EyouSoft.Model.SysStructure.MSysMenu2Info();

            info.Name    = EyouSoft.Common.Utils.GetFormValue("txtSecondName").Trim();
            info.Url     = EyouSoft.Common.Utils.GetFormValue("txtSecondUrl").Trim();
            info.FirstId = EyouSoft.Common.Utils.GetInt(EyouSoft.Common.Utils.GetFormValue("txtSecondFirst"), 0);

            if (info.FirstId < 1)
            {
                this.RegisterAlertAndReloadScript("请选择第一级栏目!");
                return;
            }

            if (string.IsNullOrEmpty(info.Name))
            {
                this.RegisterAlertAndReloadScript("二级栏目名称不能为空!");
                return;
            }

            if (string.IsNullOrEmpty(info.Url))
            {
                this.RegisterAlertAndReloadScript("二级栏目链接不能为空!");
                return;
            }

            int identityId = new EyouSoft.BLL.SysStructure.BSys().InsertSecondMenu(info);

            if (identityId > 0)
            {
                this.RegisterAlertAndReloadScript("二级栏目添加成功!");
                return;
            }
            else
            {
                this.RegisterAlertAndReloadScript("二级栏目添加失败!");
                return;
            }
        }