Пример #1
0
        /// <summary>
        /// 获取菜单树
        /// </summary>
        /// <returns></returns>
        public List <Tree> GetMenuTree()
        {
            List <Tree> Menus = new List <Tree>();


            TbSysSubSystemDefine        tb   = new TbSysSubSystemDefine();
            List <TbSysSubSystemDefine> list = tb.FetchAll();

            foreach (var item in list)
            {
                Tree head = new Tree()
                {
                    Level = 0, Name = item.SubSystemName, Code = ""
                };
                Menus.Add(head);


                TbSysMenu   child  = new TbSysMenu();
                List <Tree> level2 = child.FindNext(item.SubSystemId);
                head.Childs = level2;

                foreach (var item2 in head.Childs)
                {
                    item2.Childs = GetChildren(item2);
                }
            }
            return(Menus);
        }
Пример #2
0
        /// <summary>
        /// 以主键为参数删除一条数据
        /// </summary>
        static public void DeleteBy(string subSystemId)
        {
            TbSysSubSystemDefine tbl;

            tbl = new TbSysSubSystemDefine();

            tbl.SubSystemId = subSystemId;

            tbl.Delete();
        }
Пример #3
0
        /// <summary>
        /// 以主键为参数获取数据,并创建类的实例
        /// </summary>
        /// <returns>类的实例</returns>
        static public TbSysSubSystemDefine CreateBy(string subSystemId)
        {
            TbSysSubSystemDefine tbl;
            bool hasData;

            tbl     = new TbSysSubSystemDefine();
            hasData = tbl.FetchBy(subSystemId);

            if (!hasData)
            {
                return(null);
            }
            else
            {
                return(tbl);
            }
        }
Пример #4
0
        public List <TbSysSubSystemDefine> FetchAll()
        {
            List <TbSysSubSystemDefine> list = new List <TbSysSubSystemDefine>();
            string sSQL = "select *  from sbt_sys_sub_system_define";

            //======= 2. 运行SQL语句 ========
            DataSet dataSet = DataHelper.GetInstance("CenterCord").ExecuteDataSet(sSQL);


            //======= 3. 读取记录 ========
            for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
            {
                TbSysSubSystemDefine tb = new TbSysSubSystemDefine();
                tb.AssignByDataRow(dataSet.Tables[0].Rows[i]);
                list.Add(tb);
            }

            return(list);
        }