Пример #1
0
    public void PopulateNode(Object sender, TreeNodeEventArgs e)
    {
        // Call the appropriate method to populate a node at a particular level.
        switch (e.Node.Depth)
        {
        case 0:
            // Populate the first-level nodes.
            List <profile> profiles = BusinessRule.GetProfiles(0);

            PopulateLevel(e.Node, profiles);
            break;

        case 1:
            // Populate the second-level nodes.
            //          PopulateProducts(e.Node);
            int    result = 0;
            string value  = e.Node.Value;
            string name   = e.Node.Text;
            int.TryParse(value, out result);
            profiles = BusinessRule.GetProfileParentid(result, name);
            PopulateLevel(e.Node, profiles);
            break;

        default:
            // Do nothing.
            break;
        }
    }
Пример #2
0
        static int GetRootProfile(string fieldname, ref string childrenuri, ref int parentid)
        {
            List <profile> profiles = BusinessRule.GetProfiles(0, fieldname);

            if (profiles.Count != 1)
            {
                throw new System.Exception(string.Format("Treelevel: 0  fieldname: {0} profile count: {1} should return only one profile ", fieldname, profiles.Count));
            }
            childrenuri = profiles[0].childrenuri;
            parentid    = profiles[0].parentid;
            return(profiles[0].childcount);
        }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        StringBuilder  sb       = new StringBuilder();
        List <profile> profiles = BusinessRule.GetProfiles(1, "Lang");

        if (profiles.Count == 1)
        {
            sb.Append(string.Format("Name {0} id: {1} </br>", profiles[0].fieldname, profiles[0].id));
            //    profiles = BusinessRule.GetProfiles()
            profiles = BusinessRule.GetProfiles(3, 4000015);
            foreach (profile p in profiles)
            {
                sb.Append(string.Format("Level: {0} Name: {1} id:{2} real id: {3} </br>", p.treelevel, p.fieldname, p.id, p.realid));
            }
            area.InnerHtml = sb.ToString();
        }
    }
Пример #4
0
 static List <profile> GetProfiles(int treelevel, int rootid)
 {
     return(BusinessRule.GetProfiles(treelevel, rootid));
 }