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_CustomerClass_CustomerClass_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 CustomerClassDAL().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 cc_id = dr["cc_id"].ToString();
            string parent_id = dr["parent_id"].ToString();
            string cc_code = dr["cc_code"].ToString(); 
            string cc_name = dr["cc_name"].ToString();
            dt.AddChildNode(cc_id, parent_id, cc_code + " " + cc_name, "javascript:SelectCategory(\\'" + cc_id + "\\')", "", "", "../../Scripts/dtree/images/folder.gif");
        }
        xview.Add("dtree", dt.GetTree());
    }
}
