Ejemplo n.º 1
0
        /// <summary>
        /// 根据Id获取
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IEnumerable <RightsView> GetRightsIsLeafView(int id)
        {
            RightsView model = this.GetRights(id).ConvertToRightsView();

            if (model == null)
            {
                throw new EntityIsInvalidException <string>(id.ToString());
            }
            return(ForeachChild(model, true));
        }
Ejemplo n.º 2
0
        /// <summary>修改组织
        /// 修改组织
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <returns></returns>
        public JsonResult UpdateRights(int id, string name, string url, string description, string isshow)
        {
            bool show = false;

            if (isshow == "1")
            {
                show = true;
            }
            RightsView rights = this._rightsService.UpdateRights(id, name, url, description, show);

            return(Json(rights, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public JsonResult AddRightsChild(string id, string name, string url, string description, string isshow)
        {
            bool show = false;

            if (isshow == "1")
            {
                show = true;
            }
            RightsView rights = this._rightsService.AddRightsChild(Convert.ToInt32(id), name, url, description, show);

            return(Json(rights, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 4
0
        private IList <RightsView> ForeachChild(RightsView model, bool isleaf)
        {
            IList <RightsView> reslut = new List <RightsView>();

            foreach (RightsView item in model.Child)
            {
                if (item.IsLeaf)
                {
                    reslut.Add(item);
                }
                else
                {
                    IList <RightsView> child = ForeachChild(item, isleaf);
                    foreach (RightsView childitem in child)
                    {
                        reslut.Add(childitem);
                    }
                }
            }
            return(reslut);
        }
Ejemplo n.º 5
0
        /// <summary>修改组织
        /// 修改组织
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <returns></returns>
        public JsonResult UpdateRights(AddRightsRequest request)
        {
            RightsView rights = this._rightsService.UpdateRights(request);

            return(Json(rights, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 6
0
        public JsonResult AddRightsChild(string id, string name, string url, string description, string isshow)
        {
            RightsView rights = this._rightsService.AddRights(null);

            return(Json(rights, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 7
0
        /// <summary>获取权限列表
        /// </summary>
        /// <returns></returns>
        public JsonResult GetRights()
        {
            RightsView rights = this._rightsService.GetRightsView(0);

            return(Json(rights, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 8
0
        public HttpResponseMessage UpdateRights([FromUri] AddRightsRequest request)
        {
            RightsView rights = this._rightsService.UpdateRights(request);

            return(ToJson(rights));
        }
Ejemplo n.º 9
0
        public HttpResponseMessage GetRightsView(int id)
        {
            RightsView rights = this._rightsService.GetRightsView(id);

            return(ToJson(rights));
        }