📄 chapternode.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ExaminationSystem.BLL.Domain;
using ExaminationSystem.BLL.Service;
using System.Collections.Generic;
/// <summary>
/// ChapterNode 的摘要说明
/// </summary>
public class ChapterNode:ITreeNode
{
private Chapter chapter;
private long subjectId=0;
public ChapterNode(long subjectId)
{
this.subjectId=subjectId;
}
public ChapterNode(Chapter chapter)
{
this.chapter=chapter;
}
public ITreeNode Parent
{
get { return new ChapterNode(this.chapter.Parent);}
}
public IList<ITreeNode> Children
{
get
{
IList<ITreeNode> children=new List<ITreeNode>();
foreach (Chapter childChapter in chapter.Children)
{
children.Add(new ChapterNode(childChapter));
}
return children;
}
}
public string Name
{
get { return this.chapter.Name; }
}
public long ID
{
get { return this.chapter.ID; }
}
public IList<ITreeNode> GetTopNodes()
{
Subject subject = new SubjectService().GetById(subjectId);
IList<Chapter> chapters = subject.Chapters;
IList<ITreeNode> topChapterNodes = new List<ITreeNode>();
foreach (Chapter chapter in chapters)
{
if (chapter.Parent == null)
topChapterNodes.Add(new ChapterNode(chapter));
}
return topChapterNodes;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -