樹後台資料存放區(採用webmethod),資料存放區webmethod

來源:互聯網
上載者:User

樹後台資料存放區(採用webmethod),資料存放區webmethod
樹集合篇:

第六篇:樹後台資料存放區:

TODO:

關於後台資料存放區將集中在此篇講解:

/* *作者:方浩然 *日期:2015-05-26 *版本:1.0 */using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using BF.IBLL.MedicalTreatmentCombination;using Base.Core.UnityFactory;using System.Collections;using BF.Model;using LitJson;using System.Web.Services;using System.Linq.Expressions;namespace BF.Web.pages.MedicalTreatmentCombination{    public partial class ZtreeForm : BasePage    {        protected void Page_Load(object sender, EventArgs e)        {        }        private static readonly Isys_OrganizeBLL iORGBLL = IOCFactory.GetIOCResolve<Isys_OrganizeBLL>();        private static readonly string iconOpen = HttpUtility.UrlEncode(@"zTree-zTree_v3-master/zTree_v3/css/zTreeStyle/img/diy/1_open.png");        private static readonly string iconClose = HttpUtility.UrlEncode(@"zTree-zTree_v3-master/zTree_v3/css/zTreeStyle/img/diy/1_close.png");        /// <summary>        /// 節點類        /// </summary>        public class Node        {            /// <summary>            /// 子節點            /// </summary>            public List<Node> children;            /// <summary>            /// 展開表徵圖            /// </summary>            public string iconOpen;            /// <summary>            /// 收縮表徵圖            /// </summary>            public string iconClose;            /// <summary>            /// 是否是父級節點            /// </summary>            public bool isParent;            /// <summary>            /// 地區gID            /// </summary>            public Guid? gID;            /// <summary>            /// 地區父gPID            /// </summary>            public Guid? gPID;            /// <summary>            /// 地區編碼            /// </summary>            public string sAreaCode;            /// <summary>            /// 地區層級            /// </summary>            public int? iJB;            /// <summary>            /// 地區名稱            /// </summary>            public string name;            /// <summary>            /// 刪除標識            /// </summary>            public int? iDeleteMark;            /// <summary>            /// 建立日期            /// </summary>            public DateTime? dCreateDate;            /// <summary>            /// 建立人編碼            /// </summary>            public Guid? gCreateUserId;            /// <summary>            /// 建立人姓名            /// </summary>            public string sCreateUserRealname;            /// <summary>            /// 修改日期            /// </summary>            public DateTime? dModifyDate;            /// <summary>            /// 修改人編碼            /// </summary>            public Guid? gModifyUserId;            /// <summary>            /// 修改人姓名            /// </summary>            public string sModifyUserRealname;        }        /// <summary>        /// 節點類--【僅供EasyUITree使用:標識id text state checked attributes children】        /// </summary>        public class NodeTree        {            /// <summary>            /// 子節點            /// </summary>            public List<NodeTree> children;            /// <summary>            /// 表徵圖            /// </summary>            public string iconCls;            /// <summary>            /// 是否是父級節點 預設為'open'. 當為‘closed’時說明此節點下有子節點否則此節點為葉子節點            /// </summary>            public string state;            /// <summary>            /// 地區gID            /// </summary>            public Guid? id;            /// <summary>            /// 地區父gPID            /// </summary>            public Guid? gPID;            /// <summary>            /// 地區編碼            /// </summary>            public string sAreaCode;            /// <summary>            /// 地區層級            /// </summary>            public int? iJB;            /// <summary>            /// 地區名稱            /// </summary>            public string text;            /// <summary>            /// 刪除標識            /// </summary>            public int? iDeleteMark;            /// <summary>            /// 建立日期            /// </summary>            public DateTime? dCreateDate;            /// <summary>            /// 建立人編碼            /// </summary>            public Guid? gCreateUserId;            /// <summary>            /// 建立人姓名            /// </summary>            public string sCreateUserRealname;            /// <summary>            /// 修改日期            /// </summary>            public DateTime? dModifyDate;            /// <summary>            /// 修改人編碼            /// </summary>            public Guid? gModifyUserId;            /// <summary>            /// 修改人姓名            /// </summary>            public string sModifyUserRealname;        }        public class attributes        {        }        /// <summary>        /// 讀取地區列表【EasyUITree】--青海省民政廳下面一級        /// </summary>        /// <returns></returns>        [WebMethod]        public static string GetEasyUITreeRootList()        {            List<NodeTree> list = new List<NodeTree>();//所有節點            list = GetTreeGenNode();//將所有一級節點放到list中            GetTreeThirdChilds(ref list);            return JsonHelper<NodeTree>.ListToJsonString(list);        }        /// <summary>        /// 讀取地區列表--青海省民政廳下面一級        /// </summary>        /// <returns></returns>        [WebMethod]        public static string GetZtreeRootList()        {            List<Node> list = new List<Node>();//所有節點            list = GetGenNode();//將所有一級節點放到list中            GetThirdChilds(ref list);            return JsonHelper<Node>.ListToJsonString(list);        }        /// <summary>        ///  讀取地區列表【EasyUITree】        /// </summary>        /// <returns></returns>        [WebMethod]        public static string GetTreeList()        {            List<NodeTree> list = new List<NodeTree>();//所有節點            list = GetTreeGenNode();//將所有一級節點放到list中            GetTreeChilds(ref list);            return JsonHelper<NodeTree>.ListToJsonString(list);        }        /// <summary>        ///  讀取地區列表        /// </summary>        /// <returns></returns>        [WebMethod]        public static string GetZtreeList()        {            List<Node> list = new List<Node>();//所有節點            list = GetGenNode();//將所有一級節點放到list中            GetChilds(ref list);            return JsonHelper<Node>.ListToJsonString(list);        }        /// <summary>        /// 讀取子集節點【EasyUITree】--青海省民政廳下面一級        /// </summary>        /// <param name="list"></param>        [WebMethod]        public static void GetTreeThirdChilds(ref List<NodeTree> list)        {            foreach (NodeTree node in list)            {                List<NodeTree> nodeList = GetTreeThirdChildsID(node.id);                if (nodeList.Count > 0)                {                    if (node.iJB <= 0)                        node.children = nodeList;                    GetTreeThirdChilds(ref nodeList);                }                break;            }        }        /// <summary>        /// 讀取子集節點--青海省民政廳下面一級        /// </summary>        /// <param name="list"></param>        [WebMethod]        public static void GetThirdChilds(ref List<Node> list)        {            foreach (Node node in list)            {                List<Node> nodeList = GetThirdChildsID(node.gID);                if (nodeList.Count > 0)                {                    if (node.iJB <= 0)                        node.children = nodeList;                    GetThirdChilds(ref nodeList);                }                break;            }        }        /// <summary>        /// 獲所有的一級節點【EasyUITree】        /// </summary>        /// <param name="nodeList"></param>        /// <returns></returns>        [WebMethod]        public static List<NodeTree> GetTreeGenNode()        {            List<NodeTree> nodeList = new List<NodeTree>();            List<NodeTree> childrenList = new List<NodeTree>();            NodeTree node = new NodeTree();            NodeTree children = new NodeTree();            List<sys_Organize> genList = iORGBLL.GetList(P => P.iJB == -1 && P.iDeleteMark == 0);            if (genList != null && genList.Count > 0)            {                foreach (sys_Organize genItem in genList)                {                    //根節點 node                    node.id = genItem.gID;                    node.gPID = genItem.gPID;                    node.sAreaCode = genItem.sAreaCode;                    node.iJB = genItem.iJB;                    node.text = genItem.sFullName;                    node.iDeleteMark = genItem.iDeleteMark;                    node.dCreateDate = genItem.dCreateDate;                    node.gCreateUserId = genItem.gCreateUserId;                    node.sCreateUserRealname = genItem.sCreateUserRealname;                    node.dModifyDate = genItem.dModifyDate;                    node.gModifyUserId = genItem.gModifyUserId;                    node.sModifyUserRealname = genItem.sModifyUserRealname;                    if (iORGBLL.GetList(P => P.gPID == genItem.gID && P.iDeleteMark == 0).Count > 0)                    {                        node.state = "closed";                        node.iconCls = iconOpen;                    }                    childrenList.Add(children);                }                if (childrenList.Count > 0)                    node.children = childrenList;                nodeList.Add(node);            }            return nodeList;        }        /// <summary>        /// 獲所有的一級節點        /// </summary>        /// <param name="nodeList"></param>        /// <returns></returns>        [WebMethod]        public static List<Node> GetGenNode()        {            List<Node> nodeList = new List<Node>();            List<Node> childrenList = new List<Node>();            Node node = new Node();            Node children = new Node();            List<sys_Organize> genList = iORGBLL.GetList(P => P.iJB == -1 && P.iDeleteMark == 0);            if (genList != null && genList.Count > 0)            {                foreach (sys_Organize genItem in genList)                {                    //根節點 node                    node.gID = genItem.gID;                    node.gPID = genItem.gPID;                    node.sAreaCode = genItem.sAreaCode;                    node.iJB = genItem.iJB;                    node.name = genItem.sFullName;                    node.iDeleteMark = genItem.iDeleteMark;                    node.dCreateDate = genItem.dCreateDate;                    node.gCreateUserId = genItem.gCreateUserId;                    node.sCreateUserRealname = genItem.sCreateUserRealname;                    node.dModifyDate = genItem.dModifyDate;                    node.gModifyUserId = genItem.gModifyUserId;                    node.sModifyUserRealname = genItem.sModifyUserRealname;                    if (iORGBLL.GetList(P => P.gPID == genItem.gID && P.iDeleteMark == 0).Count > 0)                    {                        node.isParent = true;                        node.iconOpen = iconOpen;                        node.iconClose = iconClose;                    }                    childrenList.Add(children);                }                if (childrenList.Count > 0)                    node.children = childrenList;                nodeList.Add(node);            }            return nodeList;        }        /// <summary>        /// 將擷取的所有的子節點放到list中【EasyUITree】        /// </summary>        /// <param name="list">按引用傳值,當控制權傳遞迴調用方法時,在方法中對參數所做的任何更改都將反映在該變數中</param>        /// <returns></returns>        [WebMethod]        public static void GetTreeChilds(ref List<NodeTree> list)        {            foreach (NodeTree node in list)            {                List<NodeTree> nodeList = GetTreeThirdChildsID(node.id);                if (nodeList.Count > 0)                {                    node.children = nodeList;//載入子節點                    //採用遞迴的形式                    GetTreeChilds(ref nodeList);                }            }        }        /// <summary>        /// 將擷取的所有的子節點放到list中        /// </summary>        /// <param name="list">按引用傳值,當控制權傳遞迴調用方法時,在方法中對參數所做的任何更改都將反映在該變數中</param>        /// <returns></returns>        [WebMethod]        public static void GetChilds(ref List<Node> list)        {            foreach (Node node in list)            {                List<Node> nodeList = GetChildsID(node.gID);                if (nodeList.Count > 0)                {                    node.children = nodeList;//載入子節點                    //採用遞迴的形式                    GetChilds(ref nodeList);                }            }        }        /// <summary>        /// 根據父節點的id擷取子節點        /// </summary>        /// <param name="list">父節點id</param>        /// <returns>非同步呼叫返回List<Node></returns>        [WebMethod]        public static string GetRootByChildsID(string gid)        {            Guid id = new Guid();            Guid.TryParse(gid, out id);            List<Node> list = GetThirdChildsID(id);            return JsonHelper<Node>.ListToJsonString(list);        }        /// <summary>        /// 根據父節點的id擷取子節點        /// </summary>        /// <param name="list">父節點id</param>        /// <returns></returns>        [WebMethod]        public static List<NodeTree> GetTreeThirdChildsID(Guid? gid)        {            List<NodeTree> childrenList = new List<NodeTree>();            foreach (sys_Organize childrenItem in iORGBLL.GetList(P => P.gPID == gid && P.iDeleteMark == 0))            {                NodeTree children = new NodeTree();                //仿造子節點【child】屬性                //判斷葉子節點是否含有子節點並設定屬性                if (iORGBLL.GetList(P => P.gPID == childrenItem.gID && P.iDeleteMark == 0).Count > 0)                {                    children.state = "closed";//預設 true                    children.iconCls = iconOpen;//預設表徵圖                }                children.id = childrenItem.gID;                children.gPID = childrenItem.gPID;                children.sAreaCode = childrenItem.sAreaCode;                children.iJB = childrenItem.iJB;                children.text = childrenItem.sFullName;                children.iDeleteMark = childrenItem.iDeleteMark;                children.dCreateDate = childrenItem.dCreateDate;                children.gCreateUserId = childrenItem.gCreateUserId;                children.sCreateUserRealname = childrenItem.sCreateUserRealname;                children.dModifyDate = childrenItem.dModifyDate;                children.gModifyUserId = childrenItem.gModifyUserId;                children.sModifyUserRealname = childrenItem.sModifyUserRealname;                childrenList.Add(children);            }            return childrenList;        }        /// <summary>        /// 根據父節點的id擷取子節點        /// </summary>        /// <param name="list">父節點id</param>        /// <returns></returns>        [WebMethod]        public static List<Node> GetThirdChildsID(Guid? gid)        {            List<Node> childrenList = new List<Node>();            foreach (sys_Organize childrenItem in iORGBLL.GetList(P => P.gPID == gid && P.iDeleteMark == 0))            {                Node children = new Node();                //仿造子節點【child】屬性                //判斷葉子節點是否含有子節點並設定屬性                if (iORGBLL.GetList(P => P.gPID == childrenItem.gID && P.iDeleteMark == 0).Count > 0)                {                    children.isParent = true;//預設 true                    children.iconOpen = iconOpen;//預設 展開屬性                    children.iconClose = iconClose;//預設 收縮屬性                }                children.gID = childrenItem.gID;                children.gPID = childrenItem.gPID;                children.sAreaCode = childrenItem.sAreaCode;                children.iJB = childrenItem.iJB;                children.name = childrenItem.sFullName;                children.iDeleteMark = childrenItem.iDeleteMark;                children.dCreateDate = childrenItem.dCreateDate;                children.gCreateUserId = childrenItem.gCreateUserId;                children.sCreateUserRealname = childrenItem.sCreateUserRealname;                children.dModifyDate = childrenItem.dModifyDate;                children.gModifyUserId = childrenItem.gModifyUserId;                children.sModifyUserRealname = childrenItem.sModifyUserRealname;                childrenList.Add(children);            }            return childrenList;        }        /// <summary>        /// 根據父節點的id擷取子節點        /// </summary>        /// <param name="list">父節點id</param>        /// <returns></returns>        [WebMethod]        public static List<Node> GetChildsID(Guid? gid)        {            List<Node> childrenList = new List<Node>();            foreach (sys_Organize childrenItem in iORGBLL.GetList(P => P.gPID == gid && P.iDeleteMark == 0))            {                Node children = new Node();                //仿造子節點【child】屬性                //判斷葉子節點是否含有子節點並設定屬性                if (iORGBLL.GetList(P => P.gPID == childrenItem.gID && P.iDeleteMark == 0).Count > 0)                {                    children.isParent = true;//預設 true                    children.iconOpen = iconOpen;//預設 展開屬性                    children.iconClose = iconClose;//預設 收縮屬性                }                children.gID = childrenItem.gID;                children.gPID = childrenItem.gPID;                children.sAreaCode = childrenItem.sAreaCode;                children.iJB = childrenItem.iJB;                children.name = childrenItem.sFullName;                children.iDeleteMark = childrenItem.iDeleteMark;                children.dCreateDate = childrenItem.dCreateDate;                children.gCreateUserId = childrenItem.gCreateUserId;                children.sCreateUserRealname = childrenItem.sCreateUserRealname;                children.dModifyDate = childrenItem.dModifyDate;                children.gModifyUserId = childrenItem.gModifyUserId;                children.sModifyUserRealname = childrenItem.sModifyUserRealname;                childrenList.Add(children);            }            return childrenList;        }    }}


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.