コード例 #1
0
 public PermissionItem(JToken node) : base(node)
 {
     if (node["id"] != null)
     {
         this._Id = ParseInt(node["id"].Value <string>());
     }
     if (node["type"] != null)
     {
         this._Type = (PermissionItemType)StringEnum.Parse(typeof(PermissionItemType), node["type"].Value <string>());
     }
     if (node["partnerId"] != null)
     {
         this._PartnerId = ParseInt(node["partnerId"].Value <string>());
     }
     if (node["tags"] != null)
     {
         this._Tags = node["tags"].Value <string>();
     }
     if (node["createdAt"] != null)
     {
         this._CreatedAt = ParseInt(node["createdAt"].Value <string>());
     }
     if (node["updatedAt"] != null)
     {
         this._UpdatedAt = ParseInt(node["updatedAt"].Value <string>());
     }
 }
コード例 #2
0
        public PermissionItem(XmlElement node) : base(node)
        {
            foreach (XmlElement propertyNode in node.ChildNodes)
            {
                switch (propertyNode.Name)
                {
                case "id":
                    this._Id = ParseInt(propertyNode.InnerText);
                    continue;

                case "type":
                    this._Type = (PermissionItemType)StringEnum.Parse(typeof(PermissionItemType), propertyNode.InnerText);
                    continue;

                case "partnerId":
                    this._PartnerId = ParseInt(propertyNode.InnerText);
                    continue;

                case "tags":
                    this._Tags = propertyNode.InnerText;
                    continue;

                case "createdAt":
                    this._CreatedAt = ParseInt(propertyNode.InnerText);
                    continue;

                case "updatedAt":
                    this._UpdatedAt = ParseInt(propertyNode.InnerText);
                    continue;
                }
            }
        }
コード例 #3
0
 private void GetChildren(IList <PermissionItemType> objList, PermissionItemType item)
 {
     foreach (PermissionItemType k in item.children)
     {
         List <PermissionItemType> kList = objList.Where(p => p.ParentId == k.Id).OrderByDescending(p => p.SortCode).ToList();
         k.children = kList;
         GetChildren(objList, k);
     }
 }
コード例 #4
0
        public PermissionItemBaseFilter(XmlElement node) : base(node)
        {
            foreach (XmlElement propertyNode in node.ChildNodes)
            {
                switch (propertyNode.Name)
                {
                case "idEqual":
                    this._IdEqual = ParseInt(propertyNode.InnerText);
                    continue;

                case "idIn":
                    this._IdIn = propertyNode.InnerText;
                    continue;

                case "typeEqual":
                    this._TypeEqual = (PermissionItemType)StringEnum.Parse(typeof(PermissionItemType), propertyNode.InnerText);
                    continue;

                case "typeIn":
                    this._TypeIn = propertyNode.InnerText;
                    continue;

                case "partnerIdEqual":
                    this._PartnerIdEqual = ParseInt(propertyNode.InnerText);
                    continue;

                case "partnerIdIn":
                    this._PartnerIdIn = propertyNode.InnerText;
                    continue;

                case "tagsMultiLikeOr":
                    this._TagsMultiLikeOr = propertyNode.InnerText;
                    continue;

                case "tagsMultiLikeAnd":
                    this._TagsMultiLikeAnd = propertyNode.InnerText;
                    continue;

                case "createdAtGreaterThanOrEqual":
                    this._CreatedAtGreaterThanOrEqual = ParseInt(propertyNode.InnerText);
                    continue;

                case "createdAtLessThanOrEqual":
                    this._CreatedAtLessThanOrEqual = ParseInt(propertyNode.InnerText);
                    continue;

                case "updatedAtGreaterThanOrEqual":
                    this._UpdatedAtGreaterThanOrEqual = ParseInt(propertyNode.InnerText);
                    continue;

                case "updatedAtLessThanOrEqual":
                    this._UpdatedAtLessThanOrEqual = ParseInt(propertyNode.InnerText);
                    continue;
                }
            }
        }
コード例 #5
0
 private void GetChildren(IList <PermissionItemType> objList, PermissionItemType item, List <SystemTree> trees)
 {
     foreach (PermissionItemType k in item.children)
     {
         SystemTree tree = trees.Find(p => p.id == k.Id.ToString());
         List <PermissionItemType> kList = objList.Where(p => p.ParentId == k.Id).OrderByDescending(p => p.SortCode).ToList();
         k.children = kList;
         List <SystemTree> mlist = ConvertToTree(kList);
         tree.children = mlist;
         GetChildren(objList, k, mlist);
     }
 }
コード例 #6
0
 public ActionResult Edit(PermissionItemType obj)
 {
     try
     {
         NSession.Update(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
コード例 #7
0
        /// <summary>
        /// 根据Id获取
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public PermissionItemType GetById(int Id)
        {
            PermissionItemType obj = NSession.Get <PermissionItemType>(Id);

            if (obj == null)
            {
                throw new Exception("返回实体为空");
            }
            else
            {
                return(obj);
            }
        }
コード例 #8
0
 public PermissionItemBaseFilter(JToken node) : base(node)
 {
     if (node["idEqual"] != null)
     {
         this._IdEqual = ParseInt(node["idEqual"].Value <string>());
     }
     if (node["idIn"] != null)
     {
         this._IdIn = node["idIn"].Value <string>();
     }
     if (node["typeEqual"] != null)
     {
         this._TypeEqual = (PermissionItemType)StringEnum.Parse(typeof(PermissionItemType), node["typeEqual"].Value <string>());
     }
     if (node["typeIn"] != null)
     {
         this._TypeIn = node["typeIn"].Value <string>();
     }
     if (node["partnerIdEqual"] != null)
     {
         this._PartnerIdEqual = ParseInt(node["partnerIdEqual"].Value <string>());
     }
     if (node["partnerIdIn"] != null)
     {
         this._PartnerIdIn = node["partnerIdIn"].Value <string>();
     }
     if (node["tagsMultiLikeOr"] != null)
     {
         this._TagsMultiLikeOr = node["tagsMultiLikeOr"].Value <string>();
     }
     if (node["tagsMultiLikeAnd"] != null)
     {
         this._TagsMultiLikeAnd = node["tagsMultiLikeAnd"].Value <string>();
     }
     if (node["createdAtGreaterThanOrEqual"] != null)
     {
         this._CreatedAtGreaterThanOrEqual = ParseInt(node["createdAtGreaterThanOrEqual"].Value <string>());
     }
     if (node["createdAtLessThanOrEqual"] != null)
     {
         this._CreatedAtLessThanOrEqual = ParseInt(node["createdAtLessThanOrEqual"].Value <string>());
     }
     if (node["updatedAtGreaterThanOrEqual"] != null)
     {
         this._UpdatedAtGreaterThanOrEqual = ParseInt(node["updatedAtGreaterThanOrEqual"].Value <string>());
     }
     if (node["updatedAtLessThanOrEqual"] != null)
     {
         this._UpdatedAtLessThanOrEqual = ParseInt(node["updatedAtLessThanOrEqual"].Value <string>());
     }
 }
コード例 #9
0
 public JsonResult DeleteConfirmed(int id)
 {
     try
     {
         PermissionItemType obj = GetById(id);
         NSession.Delete(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
コード例 #10
0
        public ActionResult Edit(int id)
        {
            PermissionItemType obj = GetById(id);

            return(View(obj));
        }