using System;
using System.Data;
using System.Configuration;
using System.Collections;
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 PubDataMgr;
namespace his
{
public partial class Frame_LEFT : System.Web.UI.Page
{
PublicClass pc = new PublicClass();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
try
{
string sUC = Convert.ToString(Session["UserCode"]);
DataManage dmc = new DataManage();
string selStr = "";
if (sUC.ToLower() != "0")
selStr = "select distinct func_id,func_desc,menu_id,object_name,order_no from menu_function";
//a,user_function b where a.func_id=b.func_id " +
// "and (b.f_login_id='" + sUC + "') ";
else
selStr = "select distinct func_id,func_desc,menu_id,object_name,order_no from menu_function ";
selStr += " order by mf_order_no";
DataSet dsTemp;
dsTemp = dmc.GetDataSet("TableInfo", selStr);
ViewState["TreeDS"] = dsTemp;
Treeview1.Nodes.Clear();
InitNavigationTree(Treeview1.Nodes, "ROOT");
Treeview1.ExpandAll();
}
catch (Exception error)
{
Response.Write("<script> alert('" + error.Message + "');</script>");
Response.End();
}
}
}
DataView dvw = new DataView();
TreeNode nodTemp;
DataSet ds;
private void InitNavigationTree(TreeNodeCollection tncCurrent, string sParentID)
{
ds = (DataSet)ViewState["TreeDS"];
dvw.Table = ds.Tables[0];
dvw.RowFilter = "menu_id='" + sParentID + "'";
foreach (DataRowView drv in dvw)
{
nodTemp = new TreeNode();
nodTemp.Text = drv[1].ToString().Trim();
nodTemp.Value = drv[0].ToString().Trim();
nodTemp.Target = "Content";
string eee = drv[3].ToString().Trim();
if (eee != "")
{
nodTemp.ImageUrl = "images/mini03.gif";
//nodTemp.ImageUrl = "images/mini03_down.gif";
if (eee.IndexOf("?") > 0)
nodTemp.NavigateUrl = eee + "&MMDLID=" + drv[0].ToString().Trim();
else
nodTemp.NavigateUrl = eee + "?MMDLID=" + drv[0].ToString().Trim();
}
else
{
nodTemp.ImageUrl = "images/folder_01.gif";
//nodTemp.SelectedImageUrl = "images/foldernew.gif";
}
tncCurrent.Add(nodTemp);
//***************** 判断是否有子节点 ************ //
DataView dv = ds.Tables[0].DefaultView;
dv.RowFilter = "menu_id='" + drv[0].ToString().Trim() + "'";
if (dv.Count > 0)
{
InitNavigationTree(nodTemp.ChildNodes, nodTemp.Value);
}
}
}
}
}