$(function() {var selected = $('#depttree').tree('getSelected');
$('#depttree').tree({
checkbox:false,
animate:true,
url:'/Provider/HandlerCommon.ashx?method=getsessiontree',
onClick:function(node) {
}, onSelect:function(node) {//deptid = node.id;
},
onExpand:function(node) {//expandid = node.id;
},
onLoadSuccess:function(row, data) {
}
});
});
private string GetSessionTree(HttpContext context)
{
string parentid = context.Request["id"] == null ? "000" : context.Request["id"];
StringBuilder sb = new StringBuilder();
sb.Append("[");
if (parentid.Length == 9)
{
DataCondition conditsequencedepartment = new DataCondition();
conditsequencedepartment.Add("{0}='" + parentid + "'",EntitySequenceDepartment.Field.Sequence_Cur);
IList SequenceDepartmentList = DbSequenceDepartment .ListView(conditsequencedepartment);
for (int i = 0; i < SequenceDepartmentList.Count; i++)
{
sb.Append("{\"id\":\"" + SequenceDepartmentList[i].Sequence_Cur + "\",");
sb.Append("\"text\":\"" + SequenceDepartmentList[i].DepartmentName + "\",");
sb.Append("\"attributes\":\"" + SequenceDepartmentList[i].SeDepartment_Id + "\",");
sb.Append("\"state\":\"open\" },");
}
}
else
{
DataCondition conditionchild = new DataCondition();
conditionchild.Add("{0}='" + parentid + "'", EntitySequence.Field.Sequence_Parent);
IList SequenceList = DbSequence.ListView(conditionchild);
for (int i = 0; i < SequenceList.Count; i++)
{
sb.Append("{\"id\":\"" + SequenceList[i].Sequence_Cur + "\",");
sb.Append("\"text\":\"" + SequenceList[i].Sequence_Name + "\",");
sb.Append("\"attributes\":\"" + SequenceList[i].Sequence_Id + "\",");
if (CheckSequence(SequenceList[i].Sequence_Cur))
{
sb.Append("\"state\":\"closed\" },");
}
else
{
if (CheckSequenceDepartment(SequenceList[i].Sequence_Cur))
{
sb.Append("\"state\":\"closed\" },");
}
else
{
sb.Append("\"state\":\"open\" },");
}
}
}
}
sb.Remove(sb.Length - 1, 1);
sb.Append("]");
return sb.ToString();
}