Exemplo n.º 1
0
        public JsonResult addGroup(string name, string memo)
        {
            PowerGroup en = new PowerGroup();
            en.name = name;
            en.memo = memo;

            DaPowerGroup dal = new DaPowerGroup();
            var result = new CustomJsonResult();
            result.Data = dal.add(en);
            return result;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加权限组
        /// </summary>
        /// <param name="en">权限组</param>
        /// <returns></returns>
        public int add(PowerGroup en)
        {
            string strSql = "insert into PowerGroup (name, memo) values (@name, @memo)";

            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@name", en.name),
                new SqlParameter("@memo", en.memo)
            };

            return SqlHelper.ExecuteNonQuery(BaseHelper.DBConnStr, CommandType.Text, strSql, param);
        }
Exemplo n.º 3
0
        public JsonResult updateGroup(string id, string name, string memo)
        {
            PowerGroup en = new PowerGroup();
            en.id = Convert.ToInt32(id);
            en.name = name;
            en.memo = memo;

            DaPowerGroup dal = new DaPowerGroup();
            var result = new CustomJsonResult();
            result.Data = dal.update(en);
            return result;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 更新权限组
        /// </summary>
        /// <param name="en">权限组</param>
        /// <returns></returns>
        public int update(PowerGroup en)
        {
            string strSql = "update PowerGroup set name=@name, memo=@memo where id=@id";

            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@id", en.id),
                new SqlParameter("@name", en.name),
                new SqlParameter("@memo", en.memo)
            };

            return SqlHelper.ExecuteNonQuery(BaseHelper.DBConnStr, CommandType.Text, strSql, param);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 删除权限组
        /// </summary>
        /// <param name="en">权限组</param>
        /// <returns></returns>
        public int delete(PowerGroup en)
        {
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@id", en.id)
            };

            string strSql = "select count(id) from UserInfo where powergroupID=@id";
            DataTable dt = SqlHelper.ExecuteDataset(BaseHelper.DBConnStr, CommandType.Text, strSql, param).Tables[0];

            //还有用户在使用权限组,就不能删除
            if (dt != null && Convert.ToInt32(dt.Rows[0][0]) > 0)
                return 0;

            strSql = "delete from PowerGroup where id=@id ";
            strSql += "delete from PowerGroupPower where groupID=@id ";
            return SqlHelper.ExecuteNonQuery(BaseHelper.DBConnStr, CommandType.Text, strSql, param);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 删除操作岗位
        /// </summary>
        /// <param name="id">权限组ID</param>
        /// <returns></returns>
        public JsonResult Group_remove(string id)
        {
            PowerGroup en = new PowerGroup();
            en.id = Convert.ToInt32(id);

            DaPowerGroup dal = new DaPowerGroup();
            var result = new CustomJsonResult();
            result.Data = dal.delete(en);
            return result;
        }