Ejemplo n.º 1
0
        /// <summary>
        /// 基础权限管理-写入明细权限
        /// </summary>
        /// <param name="info">权限信息业务实体</param>
        /// <returns></returns>
        public int InsertPrivs(EyouSoft.Model.SysStructure.MSysPrivsInfo info)
        {
            if (info == null || string.IsNullOrEmpty(info.Name) || info.SecondId < 1)
            {
                return(0);
            }
            info.Name = info.Name.Trim();
            if (string.IsNullOrEmpty(info.Name))
            {
                return(0);
            }
            if (dal.IsExistsPrivsName(info.SecondId, info.Name))
            {
                return(0);
            }
            if (info.PrivsType != EyouSoft.Model.EnumType.SysStructure.PrivsType.其它 && dal.IsExistsPrivsType(info.SecondId, info.PrivsType))
            {
                return(0);
            }

            int privsId = dal.InsertPrivs(info);

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

                return(privsId);
            }

            return(0);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 基础权限管理-写入明细权限
        /// </summary>
        /// <param name="info">权限信息业务实体</param>
        /// <returns></returns>
        public int InsertPrivs(EyouSoft.Model.SysStructure.MSysPrivsInfo info)
        {
            DbCommand cmd = _db.GetSqlStringCommand(SQL_INSERT_InsertPrivs);

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

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

            return(0);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// btnAddThird_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAddThird_Click(object sender, EventArgs e)
        {
            var info = new EyouSoft.Model.SysStructure.MSysPrivsInfo();

            info.Name     = EyouSoft.Common.Utils.GetFormValue("txtPrivsName").Trim();
            info.SecondId = EyouSoft.Common.Utils.GetInt(EyouSoft.Common.Utils.GetFormValue("txtThirdSecond"));
            int privsType = EyouSoft.Common.Utils.GetInt(EyouSoft.Common.Utils.GetFormValue("txtPrivsType"), -1);

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

            if (string.IsNullOrEmpty(info.Name))
            {
            }

            if (privsType == -1)
            {
                this.RegisterAlertAndReloadScript("请选择权限类别!");
                return;
            }

            info.PrivsType = (EyouSoft.Model.EnumType.SysStructure.PrivsType)privsType;
            int identityId = new EyouSoft.BLL.SysStructure.BSys().InsertPrivs(info);

            if (identityId > 0)
            {
                this.RegisterAlertAndReloadScript("权限添加成功!");
                return;
            }
            else
            {
                this.RegisterAlertAndReloadScript("权限添加失败!");
                return;
            }
        }