/// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public StringBuilder GetRoleTree()
        {
            var str    = new StringBuilder();
            var role   = new Role();
            var dtRoot = _roleBll.Query(role);

            str.Append("[");
            if (dtRoot.Rows.Count > 0)
            {
                for (var i = 0; i < dtRoot.Rows.Count; i++)
                {
                    var rId   = dtRoot.Rows[i]["roleid"].ToString();
                    var rName = dtRoot.Rows[i]["rolename"].ToString();
                    if (i > 0)
                    {
                        str.Append(",");
                    }
                    str.Append("{id:'" + rId + "',pId:'0' ,name:'" + rName + "',icon:'../../images/renyuan.png',open:true }");
                }
            }
            str.Append("]");
            return(str);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string GetRole(HttpContext context)
        {
            var rolebll = new RoleBll();
            var role    = new Role();
            var jss     = new JavaScriptSerializer();

            string str;

            try
            {
                var dt   = rolebll.Query(role);
                var list = ConvertHelper <Role> .ConvertToList(dt);

                str  = jss.Serialize(list);
                str += "|";
            }
            catch (Exception e)
            {
                Log.Error(e);
                str = "0|false";
                return(str);
            }
            return(str);
        }
Example #3
0
        public virtual JsonResult Query()
        {
            var m = _bll.Query(new Entities.Query.RolesQuery());

            return(JsonsResult(m));
        }