using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using SysCore;
using SysCore.Control;
using SysCore.Model;
using SysCore.DAL;

public partial class Base_IOType_IOType_Tree : System.Web.UI.Page
{
    public AuthUI auth = new AuthUI();
    public Hashtable xview = new Hashtable();
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!Page.IsPostBack)
        {
            CreateTree();
        }
    }
    /// <summary>
    /// 绑定控件数据源
    /// </summary>
    public void CreateTree()
    {
        DataTable tb = new IOTypeDAL().GetListAll("");

        DTree dt = new DTree("dt");
        dt.AddChildNode("0", "-1", "收发类型", "javascript:SelectCategory(\\'0\\')", "", "", "../../Scripts/dtree/images/folder.gif");
        foreach (DataRow dr in tb.Rows)
        {
            string iot_id = dr["iot_id"].ToString();
            string parent_id = dr["parent_id"].ToString();
            string iot_code = dr["iot_code"].ToString(); 
            string iot_name = dr["iot_name"].ToString();
            dt.AddChildNode(iot_id, parent_id, iot_code + " " + iot_name, "javascript:SelectCategory(\\'" + iot_id + "\\')", "", "", "../../Scripts/dtree/images/folder.gif");
        }

        xview.Add("dtree", dt.GetTree());
    }
}
