Beispiel #1
0
    private void loadMenu()
    {
        ClientScriptManager jsCode = Page.ClientScript;
        Type jsType = Page.GetType();

        //构造JS函数
        StringBuilder strBuild = new StringBuilder();
        strBuild.Append("function init(){");
        strBuild.Append("var obj = new WTree();");

        //访问WebServices访问数据
        Power.PowerService powService = new Power.PowerService();
        DataSet ds = powService.Department_GetbyParent(0);

        if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
        {
            string strTarget = String.Empty;
            string strUrl = String.Empty;
            if (Request.QueryString["target"] != null)
            {
                strTarget = Request.QueryString["target"].ToString();
                strUrl = "../../Power/Account/Account.aspx";
                if (Request.QueryString["Admin"] != null)
                    strUrl = "../../Power/Account/Account_User.aspx";
            }
            else
            {
                strTarget = "_DeptMain";
                strUrl = "New.aspx";
            }

            string strUnitName = ds.Tables[1].Rows[0][0].ToString();
            strUnitName = ConfigurationManager.AppSettings["SysName"].ToString();
            strBuild.Append("obj.add(0,-1,'" + strUnitName + "', '" + strUrl + "?DeptParentID=0&DeptName=" + Server.UrlEncode(strUnitName) + "', '" + strUnitName + "', '" + strTarget + "', '../../Images/Power/sys_config.gif', '../../Images/Power/system.gif', true);");
            foreach (System.Data.DataRow dr in ds.Tables[0].Rows)
            {
                strBuild.Append("obj.add(" + dr["DEPT_ID"].ToString() + "," + dr["DEPT_PARENT"].ToString() + ",'"
        + dr["DEPT_NAME"].ToString() + "','" + strUrl + "?DeptID=" + dr["DEPT_ID"].ToString() + "&DeptName=" + Server.UrlEncode(dr["DEPT_NAME"].ToString()) + "', '" + dr["DEPT_NAME"].ToString()
        + "', '" + strTarget + "', '../../Images/Power/dept.gif', '../../Images/Power/dept.gif', 'true','');");

            }
        }

        strBuild.Append("obj.Show(); if(parent.document.all('_deptList')!=null)  parent.document.all('_deptList').style.height=document.body.scrollHeight+5; }");

        if (!jsCode.IsClientScriptBlockRegistered(jsType, "init"))
        {
            jsCode.RegisterClientScriptBlock(jsType, "init", strBuild.ToString(), true);
        }
    }
Beispiel #2
0
    private void loadMenu()
    {
        ClientScriptManager jsCode = Page.ClientScript;
        Type jsType = Page.GetType();

        //构造JS函数
        StringBuilder strBuild = new StringBuilder();
        strBuild.Append("function init(){");
        strBuild.Append("var obj = new WTree();");

        //访问WebServices访问数据
        Power.PowerService powService = new Power.PowerService();
        DataSet ds = powService.Department_GetbyParent(0);

        if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
        {
            string strUrl;
            string strParentUrl=String.Empty;
            if (Request.QueryString["Dept"] != null)
            {
                strUrl = "../Dept/Dept.aspx?"; strParentUrl = "../Dept/Dept.aspx?DEPT_ID=0";
            }
            else strUrl = "User.aspx?";

            string strUnitName = ds.Tables[1].Rows[0][0].ToString();
            strBuild.Append("obj.add(0,-1,'" + strUnitName + "', '" + strParentUrl + "', '" + strUnitName
                + "', '" + (Request.QueryString["Dept"] != null ? "user" : "") + "', '../../../Images/Power/sys_config.gif', '../../../Images/Power/system.gif', true);");
            foreach (System.Data.DataRow dr in ds.Tables[0].Rows)
            {
                strBuild.Append("obj.add(" + dr["DEPT_ID"].ToString() + "," + dr["DEPT_PARENT"].ToString() + ",'"
                    + dr["DEPT_NAME"].ToString() + "','" + strUrl + "DEPT_ID=" + dr["DEPT_ID"].ToString() + "&DeptName="+ Server.UrlEncode(dr["DEPT_NAME"].ToString()) +"', '" + dr["DEPT_NAME"].ToString()
                    + "', 'user', '../../../Images/Power/node_dept.gif', '../../../Images/Power/node_dept.gif', 'true','');");

            }
        }

        strBuild.Append("obj.Show(); if(parent.document.all('_SetDeptList')!=null)  parent.document.all('_SetDeptList').style.height=document.body.scrollHeight+5;if(parent.document.all('menu_2')!=null) parent.document.all('menu_2').style.display='none'; }");

        if (!jsCode.IsClientScriptBlockRegistered(jsType, "init"))
        {
            jsCode.RegisterClientScriptBlock(jsType, "init", strBuild.ToString(), true);
        }
    }
Beispiel #3
0
    public void LoadDeptList()
    {
        Power.PowerService powerservice = new Power.PowerService();
        DataSet ds = powerservice.Department_GetbyParent(int.Parse(Request.QueryString["DEPT_ID"].ToString()));
        if (ds != null)
        {
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                if (dr["DEPT_ID"].ToString().Equals(Request.QueryString["DEPT_ID"].ToString()) || dr["DEPT_PARENT"].ToString().Equals("0"))
                {
                    strBuilder.Append("<tr class='TableControl'>");
                    string strID = dr["DEPT_ID"].ToString();
                    strBuilder.Append("<td class='menulines' name='" + dr["DEPT_NAME"].ToString() + "' id='" + strID + "'  onclick=javascript:click_dept('" + strID + "') style=cursor:hand>" + "├" + dr["DEPT_NAME"].ToString());
                    strBuilder.Append("</td></tr>");

                    BoundDDL(dr["DEPT_ID"].ToString(), ds.Tables[0], " ");
                }
            }
            Response.Write(strBuilder.ToString());

        }
    }