Пример #1
0
    protected People GetVicesAndAdmins()
    {
        People result = new People();


        foreach (BasicPersonRole role in _authority.LocalPersonRoles)
        {
            if (role.Type == RoleType.LocalLead)
            {
                People localPeople = new People();

                RoleLookup allRoles = RoleLookup.FromGeographyAndOrganization(role.GeographyId, role.OrganizationId);

                Roles viceRoles  = allRoles[RoleType.LocalDeputy];
                Roles adminRoles = allRoles[RoleType.LocalAdmin];

                foreach (PersonRole localRole in viceRoles)
                {
                    localPeople.Add(localRole.Person);
                }

                foreach (PersonRole localRole in adminRoles)
                {
                    localPeople.Add(localRole.Person);
                }

                result = result.LogicalOr(localPeople);
            }
        }

        return(result);
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Geography geography = this.person.Geography;
        Person    lead      = null;

        if (!person.MemberOf(Organization.PPSE))
        {
            // PPSE only atm

            return;
        }

        while (lead == null)
        {
            try
            {
                lead = Roles.GetLocalLead(Organization.PPSE, geography);
            }
            catch (ArgumentException)
            {
                geography = geography.Parent;
            }
        }

        People deputies = Roles.GetLocalDeputies(Organization.PPSE, geography);

        string literal =
            "<span style=\"line-height:150%\">";

        literal += FormatPerson("lead", lead) + " (" + Server.HtmlEncode(geography.Name) + ")<br/>";

        foreach (Person deputy in deputies)
        {
            literal += FormatPerson("deputy", deputy);
        }

        literal += "</span>";

        /*
         * literal +=
         *  "<br/><img src=\"/Images/Public/Fugue/icons-shadowless/pwcustom/orglevel-2-male.png\" style=\"position:relative;top:3px\" />&nbsp;&nbsp;" +
         *  "<a href=\"mailto:[email protected]\">Party Secretary</a>, <a href=\"callto:+46-10-3333-404\">010-3333-404</a>";*/

        this.LiteralContacts.Text = literal;
    }
Пример #3
0
    private void LoadMail()
    {
        int organizationId = Convert.ToInt32(this.DropOrganizations.SelectedValue);
        int geographyId    = 0;

        if (this.DropGeographies.SelectedIndex > -1)
        {
            geographyId = Convert.ToInt32(this.DropGeographies.SelectedValue);

            AutoMail mail = AutoMail.FromTypeOrganizationAndGeography(
                AutoMailType.Welcome, Organization.FromIdentity(organizationId), Geography.FromIdentity(geographyId));

            HttpContext.Current.Session["AutoMail"] = mail;

            this.PanelMailContents.Visible = true;

            if (mail != null)
            {
                this.TextBody.Text = mail.Body;
            }
            else
            {
                this.TextBody.Text = string.Empty;
            }
        }
        else
        {
            this.LabelSelectedGeography.Text           = string.Empty;
            this.LabelOrganizationsInGeographies2.Text = string.Empty;
        }

        try
        {
            Person localLead = Roles.GetLocalLead(organizationId, geographyId);
            this.LabelSender.Text     = localLead.Name;
            this.LabelSender.CssClass = string.Empty;
        }
        catch (Exception)
        {
            this.LabelSender.Text     = "No Local Lead";
            this.LabelSender.CssClass = "ErrorMessage";
        }

        CreatePreview();
    }
Пример #4
0
    protected People GetDirectReports()
    {
        People result = new People();

        foreach (BasicPersonRole role in _authority.LocalPersonRoles)
        {
            if (role.Type == RoleType.LocalLead || role.Type == RoleType.LocalDeputy || role.Type == RoleType.LocalAdmin)
            {
                Geographies geographies = Geography.FromIdentity(role.GeographyId).Children;

                // HACK: Compensate for current bad tree structure

                if (role.GeographyId == 34)
                { //Lägg till Skåne till Södra
                    geographies = geographies.LogicalOr(Geography.FromIdentity(36).Children);
                }

                if (role.GeographyId == 32)
                { //Lägg till Västra Götaland till Västra
                    geographies = geographies.LogicalOr(Geography.FromIdentity(355).Children);
                }

                foreach (Geography geography in geographies)
                {
                    People     localLead = new People();
                    RoleLookup allRoles  = RoleLookup.FromGeographyAndOrganization(geography.Identity,
                                                                                   role.OrganizationId);

                    Roles leadRoles = allRoles[RoleType.LocalLead];

                    foreach (PersonRole leadRole in leadRoles)
                    {
                        localLead.Add(leadRole.Person);
                    }

                    result = result.LogicalOr(localLead);
                }
            }
        }

        return(result);
    }
Пример #5
0
    private string GenerateActivists(Organization org, Geography geo)
    {
        People activists = Roles.GetActivists(org, geo);

        StringBuilder result = new StringBuilder("<b>Activists at this level or below:</b><br/>");

        if (activists.Count > 0)
        {
            result.Append(GeneratePerson(activists[0]));

            for (int index = 1; index < activists.Count; index++)
            {
                result.Append(", ").Append(GeneratePerson(activists[index]));
            }
        }
        else
        {
            result.Append("none");
        }

        result.Append("<br/>");
        return(result.ToString());
    }