本文整理汇总了C#中People.LogicalOr方法的典型用法代码示例。如果您正苦于以下问题:C# People.LogicalOr方法的具体用法?C# People.LogicalOr怎么用?C# People.LogicalOr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类People
的用法示例。
在下文中一共展示了People.LogicalOr方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLeadsVicesAndAdmins
/* Fix for Ticket #64 - Vice på distrikt- och valkretsnivå bör kunna assigna användare
* som är tilldelade Lead, för att avlasta varandra och undvika flaskhalsar. */
protected People GetLeadsVicesAndAdmins ()
{
People result = new People();
foreach (BasicPersonRole role in _authority.LocalPersonRoles)
{
if (role.Type == RoleType.LocalLead || role.Type == RoleType.LocalDeputy)
{
People localPeople = new People();
RoleLookup allRoles = RoleLookup.FromGeographyAndOrganization(role.GeographyId, role.OrganizationId);
Roles leadRoles = allRoles[RoleType.LocalLead];
Roles viceRoles = allRoles[RoleType.LocalDeputy];
Roles adminRoles = allRoles[RoleType.LocalAdmin];
foreach (PersonRole localRole in leadRoles)
{
localPeople.Add(localRole.Person);
}
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: ProcessLostMember
internal static void ProcessLostMember (BasicPWEvent newPwEvent)
{
// This function handles the case when a member was purged from the database. Several things are hardcoded
// for UP at this point.
Person victim = Person.FromIdentity(newPwEvent.AffectedPersonId);
Organizations orgs = new Organizations();
Geography geography = Geography.FromIdentity(newPwEvent.GeographyId);
string[] orgStrings = newPwEvent.ParameterText.Split(' ');
foreach (string orgString in orgStrings)
{
int orgId = Int32.Parse(orgString);
orgs.Add(Organization.FromIdentity(orgId));
}
People concernedPeople = new People();
bool showName = true;
foreach (Organization org in orgs)
{
concernedPeople =
concernedPeople.LogicalOr(
People.FromIdentities(Roles.GetAllUpwardRoles(org.Identity, newPwEvent.GeographyId)));
//Only show name if all orgs allow it
if (org.ShowNamesInNotificationsInh == false)
showName = false;
}
concernedPeople = ApplySubscription(concernedPeople, NewsletterFeed.TypeID.OfficerNewMembers);
string body = "A member was lost within your area of authority.\r\n\r\n";
if (showName)
{
body += "Person: " + victim.Name + "\r\n";
}
foreach (Organization org in orgs)
{
body += "Organization: " + org.Name + "\r\n";
}
body +=
"Geography: " + geography.Name + "\r\n\r\n" +
"Event source: " + newPwEvent.EventSource.ToString() + "\r\n\r\n";
string orgSubjectLine = string.Empty;
foreach (Organization org in orgs)
{
orgSubjectLine += ", " + org.NameShort;
}
orgSubjectLine = orgSubjectLine.Substring(2);
new MailTransmitter(Strings.MailSenderName, Strings.MailSenderAddress,
"Member Lost: " + (showName ? "[" + victim.Name + "] - " : "") + "[" + orgSubjectLine +
"], [" + geography.Name + "]",
body, concernedPeople, true).Send();
}
示例3: GetDirectReports
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;
}
示例4: ProcessAddedMember
internal static void ProcessAddedMember (BasicPWEvent newPwEvent)
{
// This function handles the case when a new member has been added. Several things are hardcoded
// for UP at this point.
Person victim = Person.FromIdentity(newPwEvent.AffectedPersonId);
Person perpetrator = Person.FromIdentity(newPwEvent.ActingPersonId);
Organizations orgs = new Organizations();
Geography geography = Geography.FromIdentity(newPwEvent.GeographyId);
string referrerString = string.Empty;
if (newPwEvent.ParameterText.Contains(","))
{
string[] eventParts = newPwEvent.ParameterText.Split(',');
string[] orgStrings = eventParts[0].Split(' ');
foreach (string orgString in orgStrings)
{
int orgId = 0;
if (int.TryParse(orgString, out orgId))
{
orgs.Add(Organization.FromIdentity(orgId));
}
}
if (eventParts.Length > 2)
{
referrerString = eventParts[2];
}
}
else
{
orgs.Add(Organization.FromIdentity(newPwEvent.OrganizationId));
}
People concernedPeople = new People();
bool showName = true;
foreach (Organization org in orgs)
{
concernedPeople =
concernedPeople.LogicalOr(
People.FromIdentities(Roles.GetAllUpwardRoles(org.Identity, newPwEvent.GeographyId)));
//Only show name if all orgs allow it
if (org.ShowNamesInNotificationsInh == false)
showName = false;
}
//Filter to only get the interested people in this event
concernedPeople = ApplySubscription(concernedPeople, NewsletterFeed.TypeID.OfficerNewMembers);
string body = "A new member has appeared within your area of authority.\r\n\r\n";
if (showName)
{
body += "Person: " + victim.Name + "\r\n";
}
foreach (Organization org in orgs)
{
body += "Organization: " + org.Name + "\r\n";
}
body +=
"Geography: " + geography.Name + "\r\n\r\n" +
"Event source: " + newPwEvent.EventSource.ToString() + "\r\n";
if (newPwEvent.EventSource == EventSource.SignupPage && referrerString.Length > 0)
{
body += "Referrer: " + referrerString + "\r\n";
}
body += "\r\n";
if (newPwEvent.EventSource == EventSource.PirateWeb)
{
body += "This member was added manually";
body += " by " + perpetrator.Name + ".\r\n\r\n";
}
// Send welcoming mails
string mailsSent = MailResolver.CreateWelcomeMail(victim, Organization.FromIdentity(newPwEvent.OrganizationId));
// HACK - should be for all orgs
body += "Welcoming automails sent:\r\n" + mailsSent +
"\r\nTo add an automatic welcome mail for your organization and geography, " +
"go to PirateWeb, Communications, Triggered Automails, Automail type \"Welcome\".\r\n\r\n";
// Add some hardcoded things for UP
/*
if (organization.Inherits(2))
{
int membersTotal = Organization.FromIdentity(2).GetTree().GetMemberCount();
int membersHere = organization.GetMemberCount();
//.........这里部分代码省略.........