protected void ASPxTreeList1_VirtualModeCreateChildren(object sender, DevExpress.Web.ASPxTreeList.TreeListVirtualModeCreateChildrenEventArgs e)
 {
     if (e.NodeObject == null)
     {
         using (IDocumentSession session = Global.Store.OpenSession())
         {
             //TODO: Query the list of treelist members to get unique results based on appIds
             if (session.Query <TreeMember>().Any())
             {
                 var allData       = session.Query <TreeMember>().ToList();
                 var processedData = session.Query <TreeMember>().ToList();
                 foreach (var data in allData)
                 {
                     if (processedData.Where(x => x.AppID == data.AppID).Count() > 1)
                     {
                         TreeMember uniqueMember = data;
                         processedData.RemoveAll(x => x.AppID == data.AppID);
                         processedData.Add(data);
                     }
                 }
                 e.Children = processedData;
             }
         }
     }
     else
     {
         TreeMember theMember = e.NodeObject as TreeMember;
         using (IDocumentSession session = Global.Store.OpenSession())
         {
             var theChildren = session.Query <TreeMember>().Where(x => x.ParentComponentId == theMember.AppID).ToList();
             e.Children = theChildren;
         }
     }
 }
示例#2
0
    protected void ASPxTreeList1_VirtualModeCreateChildren(object sender, DevExpress.Web.ASPxTreeList.TreeListVirtualModeCreateChildrenEventArgs e)
    {
        string ids = "";
        int    n   = 0;

        if (e.NodeObject == null)
        {
            this.thesql = "select distinct t.fault_group_code as id,a.fault_group_name as name from rmes_rel_station_faultgroup t left join code_fault_group a on a.fault_group_code = t.fault_group_code where t.company_code='01' order by a.fault_group_name";
        }
        else
        {
            ids = ((string[])e.NodeObject)[0];
            char[]   sep1 = { '_' };
            string[] arr  = ids.Split(sep1);
            n = arr.Length;
            switch (n)
            {
            case 1:
                this.thesql = "select t.fault_place_code as id,a.fault_place_name as name from rmes_rel_group_faultplace t left join code_fault_place a on a.fault_place_code = t.fault_place_code where t.company_code='01' and t.fault_group_code='" + arr[0] + "' order by a.fault_place_name";
                break;

            case 2:
                this.thesql = "select t.fault_part_code as id,a.fault_part_name as name from rmes_rel_faultplace_faultpart t left join code_fault_part a on a.fault_part_code = t.fault_part_code where t.company_code='01' and t.pline_type_code in (select x.pline_type_code from code_fault_group x where x.fault_group_code='" + arr[0] + "') and t.fault_group_code='" + arr[0] + "' and t.fault_place_code='" + arr[1] + "' order by a.fault_part_name";
                break;

            case 3:
                this.thesql = "select t.fault_code as id,a.fault_name as name from rmes_rel_faultpart_fault t left join code_fault a on a.fault_code = t.fault_code where t.company_code='01' and t.pline_type_code in (select x.pline_type_code from code_fault_group x where x.fault_group_code='" + arr[0] + "') and t.fault_group_code='" + arr[0] + "' and t.fault_place_code='" + arr[1] + "' and t.fault_part_code = '" + arr[2] + "' order by a.fault_name";
                break;

            default:
                this.thesql = "";
                break;
            }
        }
        //string retStr = "";
        List <string[]> children = new List <string[]>();

        if (this.thesql != string.Empty)
        {
            dataConn dc = new dataConn();
            dc.OpenConn();
            dc.theComd.CommandType = CommandType.Text;
            dc.theComd.CommandText = thesql;

            OracleDataReader dr     = dc.theComd.ExecuteReader();
            string           prefix = (ids == string.Empty) ? "" : (ids + "_");
            while (dr.Read())
            {
                children.Add(new string[] { prefix + dr["id"].ToString(), dr["name"].ToString() });
            }
            dr.Close();
            e.Children = children;
        }
    }
        protected void ASPxTreeList1_VirtualModeCreateChildren(object sender, DevExpress.Web.ASPxTreeList.TreeListVirtualModeCreateChildrenEventArgs e)
        {
            DataView    children = null;
            DataRowView parent   = e.NodeObject as DataRowView;

            if (parent == null)
            {
                children = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
            }
            else
            {
                SqlDataSource1.SelectParameters["Param"].DefaultValue = parent["EmployeeID"].ToString();
                children = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
            }
            e.Children = children;
        }
    protected void ASPxTreeList1_VirtualModeCreateChildren(object sender, DevExpress.Web.ASPxTreeList.TreeListVirtualModeCreateChildrenEventArgs e)
    {
        string path = (e.NodeObject == null) ? rootPath : e.NodeObject.ToString();

        e.Children = Directory.GetDirectories(path);
    }