コード例 #1
0
ファイル: List.aspx.cs プロジェクト: osoftware/Swarmops
    protected void PopulateGeographies()
    {
        DropGeographies.LoadTree(Geography.Root);
        DropGeographies.Content.expandSubnode("" + _currentUser.Country.GeographyId, true, 1);

        Organization org     = Organization.FromIdentity(Convert.ToInt32(DropOrganizations.SelectedValue));
        Geographies  geoList = _authority.GetGeographiesForOrganization(org);

        geoList = geoList.RemoveRedundant();
        //geoList = geoList.FilterAbove(Geography.FromIdentity(org.AnchorGeographyId));

        List <int> permitted = new List <int>();

        foreach (Geography nodeRoot in geoList)
        {
            Geographies nodeTree = nodeRoot.GetTree();

            foreach (Geography node in nodeTree)
            {
                if (_authority.HasPermission(Permission.CanSeePeople, org.Identity, node.Identity, Authorization.Flag.Default))
                {
                    permitted.Add(node.GeographyId);
                }
            }
        }

        this.DropGeographies.Content.pruneToValues(permitted.ToArray());
        if (permitted.Count > 0)
        {
            this.DropGeographies.Content.expandSubnode("" + permitted[0], true, 2);
            this.DropGeographies.SelectedValue = "" + permitted[0];
        }

        RecalculatePersonCount();
    }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            PersonList.PersonList = new People();
            // Populate list of organizations (initial population)

            DropOrganizations.LoadTree(Organization.Root);
            //DropGeographies.LoadTree(Geography.Root);


            Organizations organizationList = _authority.GetOrganizations(RoleTypes.AllRoleTypes);
            organizationList = organizationList.RemoveRedundant();
            DropOrganizations.Content.pruneToSubtree(organizationList.Identities);
            DropOrganizations.Content.expandLevels(true, 2);
            DropOrganizations.SetValue("-1", "- any -");
            DropGeographies.Content.expandSubnode("" + _currentUser.Country.GeographyId, true, 2);
            DropGeographies.SetValue("-1", "- any -");
        }
        PersonList.JsEditFunction   = "LoadMember"; // Load subframe via javascript
        PersonList.ViewEditCommand += PersonList_onEditCommand;
    }