public static OutboundComm CreateNotificationAttestationNeeded(FinancialAccount budget, Person concernedPerson, string supplier, double amountRequested, string purpose, NotificationResource notification) { NotificationPayload payload = new NotificationPayload(notification.ToString()); payload.Strings[NotificationString.CurrencyCode] = budget.Organization.Currency.Code; payload.Strings[NotificationString.OrganizationName] = budget.Organization.Name; payload.Strings[NotificationString.BudgetAmountFloat] = amountRequested.ToString(CultureInfo.InvariantCulture); payload.Strings[NotificationString.RequestPurpose] = purpose; payload.Strings[NotificationString.Description] = purpose; payload.Strings[NotificationString.Supplier] = supplier; payload.Strings[NotificationString.BudgetName] = budget.Name; payload.Strings[NotificationString.ConcernedPersonName] = concernedPerson.Canonical; OutboundComm comm = OutboundComm.Create(null, null, budget.Organization, CommResolverClass.Unknown, null, CommTransmitterClass.CommsTransmitterMail, new PayloadEnvelope(payload).ToXml(), OutboundCommPriority.Low); if (budget.OwnerPersonId == 0) { comm.AddRecipient(Person.FromIdentity(1)); // Add admin - not good, should be org admins // HACK // TODO } else { comm.AddRecipient(budget.Owner); } comm.Resolved = true; return(comm); }
public static OutboundComm CreateNotificationFinancialValidationNeeded(Organization organization, double amountRequested, NotificationResource notification) { NotificationPayload payload = new NotificationPayload(notification.ToString()); payload.Strings[NotificationString.CurrencyCode] = organization.Currency.DisplayCode; payload.Strings[NotificationString.OrganizationName] = organization.Name; payload.Strings[NotificationString.BudgetAmountFloat] = amountRequested.ToString("N2"); OutboundComm comm = OutboundComm.Create(null, null, organization, null, null, CommTransmitterClass.CommsTransmitterMail, new PayloadEnvelope(payload).ToXml(), OutboundCommPriority.Low); People validators = organization.ValidatingPeople; foreach (Person validator in validators) { comm.AddRecipient(validator); } comm.Resolved = true; return(comm); }
public static OutboundComm CreateNotificationOfFinancialValidation(FinancialAccount budget, Person concernedPerson, double amountRequested, string purpose, NotificationResource notification, string reasonGiven = "") { NotificationPayload payload = new NotificationPayload(notification.ToString()); payload.Strings[NotificationString.CurrencyCode] = budget.Organization.Currency.DisplayCode; payload.Strings[NotificationString.OrganizationName] = budget.Organization.Name; payload.Strings[NotificationString.BudgetAmountFloat] = amountRequested.ToString("N2"); payload.Strings[NotificationString.RequestPurpose] = purpose; payload.Strings[NotificationString.BudgetName] = budget.Name; payload.Strings[NotificationString.ConcernedPersonName] = concernedPerson.Canonical; payload.Strings[NotificationString.EmbeddedPreformattedText] = reasonGiven; OutboundComm comm = OutboundComm.Create(null, null, budget.Organization, null, null, CommTransmitterClass.CommsTransmitterMail, new PayloadEnvelope(payload).ToXml(), OutboundCommPriority.Low); comm.AddRecipient(concernedPerson); comm.Resolved = true; return(comm); }
public static OutboundComm CreateNotification(Organization organization, string notificationResourceString, NotificationStrings strings, NotificationCustomStrings customStrings, People recipients = null) { if (recipients == null) { recipients = People.FromSingle(Person.FromIdentity(1)); // Initial Admin recipient } if (organization != null) { strings[NotificationString.OrganizationName] = organization.Name; //strings[NotificationString.OrganizationMailPrefix] = organization.MailPrefix; // TODO // TODO: Change to org admins } OutboundComm comm = OutboundComm.Create(null, null, organization, null, null, CommTransmitterClass.CommsTransmitterMail, new PayloadEnvelope(new NotificationPayload(notificationResourceString, strings, customStrings)).ToXml(), OutboundCommPriority.Low); foreach (Person person in recipients) { comm.AddRecipient(person); } comm.Resolved = true; return(comm); }
private static OutboundComm CreateSingleRecipientNotification(NotificationPayload payload, Organization organization, Person addressee) { OutboundComm comm = OutboundComm.Create(null, null, organization, null, null, CommTransmitterClass.CommsTransmitterMail, new PayloadEnvelope(payload).ToXml(), OutboundCommPriority.Low); comm.AddRecipient(addressee); comm.Resolved = true; return(comm); }
public static OutboundComm CreateParticipantMail(string customSubject, string customBody, Person sender, Person from, Organization organization, Geography geography) { ParticipantResolver resolver = new ParticipantResolver(organization, geography); OutboundComm comm = OutboundComm.Create(sender, from, organization, resolver, null /*recipientdata*/, CommTransmitterClass.CommsTransmitterMail, new PayloadEnvelope(new ParticipantMailPayload(customSubject, customBody, organization, sender)).ToXml(), OutboundCommPriority.Low); return(comm); }
/// <summary> /// This special function is only used when Sandbox sends a test mail, and needs a nonstandard mail address. /// </summary> public static OutboundComm CreateSandboxMail(string customSubject, string customBody, string sandboxMailAddress) { List <Person> recipients = People.FromSingle(Person.FromIdentity(1)); OutboundComm comm = OutboundComm.Create(null, null, Organization.Sandbox, null /* resolver */, null, CommTransmitterClass.CommsTransmitterMail, new PayloadEnvelope(new ParticipantMailPayload(customSubject + "|" + sandboxMailAddress, customBody, recipients[0].GetParticipations()[0], recipients[0])).ToXml(), OutboundCommPriority.Low); foreach (Person person in recipients) { comm.AddRecipient(person); // needed for pickup } comm.Resolved = true; return(comm); }
public static OutboundComm CreateParticipantMail(string customSubject, string customBody, Participation participation, Person actingPerson) { List <Person> recipients = People.FromSingle(participation.Person); OutboundComm comm = OutboundComm.Create(null, null, participation.Organization, null /* resolver */, null, CommTransmitterClass.CommsTransmitterMail, new PayloadEnvelope(new ParticipantMailPayload(customSubject, customBody, participation, actingPerson)).ToXml(), OutboundCommPriority.Low); foreach (Person person in recipients) { comm.AddRecipient(person); } comm.Resolved = true; return(comm); }
public static OutboundComm CreateMembershipLetter(ParticipantMailType mailType, Membership membership, Person actingPerson) { List <Person> recipients = People.FromSingle(membership.Person); OutboundComm comm = OutboundComm.Create(null, null, membership.Organization, CommResolverClass.Unknown, null, CommTransmitterClass.CommsTransmitterMail, new PayloadEnvelope(new ParticipantMailPayload(mailType, membership, actingPerson)).ToXml(), OutboundCommPriority.Low); foreach (Person person in recipients) { comm.AddRecipient(person); } comm.Resolved = true; return(comm); }
public static OutboundComm CreateNotification(Organization organization, string notificationResourceString) { List <Person> recipients = People.FromSingle(Person.FromIdentity(1)); // Initial Admin recipient if (organization != null) { // TODO: Change to org admins } OutboundComm comm = OutboundComm.Create(null, null, organization, CommResolverClass.Unknown, null, CommTransmitterClass.CommsTransmitterMail, new PayloadEnvelope(new NotificationPayload(notificationResourceString)).ToXml(), OutboundCommPriority.Low); foreach (Person person in recipients) { comm.AddRecipient(person); } comm.Resolved = true; return(comm); }
public static OutboundCommRecipients ForOutboundComm(OutboundComm comm) { return(FromArray(SwarmDb.GetDatabaseForReading().GetOutboundCommRecipients(comm))); }
public static OutboundCommRecipients ForOutboundCommLimited(OutboundComm comm, int limit) { return(FromArray(SwarmDb.GetDatabaseForReading().GetOutboundCommRecipients(comm, DatabaseCondition.OpenTrue, new RecordLimit(limit)))); }