TreeGrid-无限制树形GUCD (六)

2014-11-24 01:35:52 · 作者: · 浏览: 13
ing System.Web.UI;
using System.Web.UI.WebControls;
using Ext.Net;
using DzPlatForm.Control;
using System.Data;
using DzPlatForm.DBUtility;
namespace DzPlatForm.CRM.Property
{
public partial class Source : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
Session["utype"] = 1;
this.BuildTree(TreeGrid1.Root);

}
}
///


/// 初始化树形列表
///

///
///
private Ext.Net.TreeNodeCollection BuildTree(Ext.Net.TreeNodeCollection nodes)
{

if (Session["utype"] == null)
{
Response.Redirect("Login.aspx");
return null;
}
else
{

string sql = "SELECT [Id],[ParentId],[Name] FROM [OA].[dbo].[CustomerSource] ";

TreeTableControl treeTable = new TreeTableControl();

DataTable dt = DbHelperSQL.ExecuteDT(sql, null);
Ext.Net.TreeNode tvn = treeTable.BindTableTree(dt);
nodes.Add(tvn);
return nodes;
}

}
///


/// 刷新树形列表
///

///
[DirectMethod]
public string RefreshMenu()
{
TreeGrid1.Root.Clear();
Ext.Net.TreeNodeCollection nodes = this.BuildTree(TreeGrid1.Root);
return nodes.ToJson();
}
///
/// 操作集合
///

///
///
protected void Menu_Click(object sender, DirectEventArgs e)
{
string item = e.ExtraParams.GetParameter("Item").Value;
string[] strValue = txtValue.Text.Split('|');
switch (item)
{
case "menuAddSubitem":
if (strValue.Length <= 1)

Notification.Show(new NotificationConfig
{
Title = "客户来源管理",
Icon = Icon.Information,
Html = "未选择记录"
});
else
{
txt_Menu_Name_varchar2.Text = "";
this.txt_Menu_ParentID_number.Text = strValue[0];
txtType.Text = "add";
this.winMenuAdd.Title = "新建子客户来源";
this.winMenuAdd.Show();
}
break;
case "menuAdd":
txt_Menu_Name_varchar2.Text = "";


this.txt_Menu_ParentID_number.Text = "-1";
this.winMenuAdd.Title = "新建客户来源";
txtType.Text = "add";
this.winMenuAdd.Show();
break;
case "menuEdit":
if (strValue.Length <= 1)
Notification.Show(new NotificationConfig
{
Title = "客户来源管理",
Icon = Icon.Information,
Html = "未选择记录"
});


else
{
txt_Menu_Name_varchar2.Text = strVa