diff --git a/Logic/Communications/OutboundComm.cs b/Logic/Communications/OutboundComm.cs
index c65b6fcd..2a4fc032 100644
--- a/Logic/Communications/OutboundComm.cs
+++ b/Logic/Communications/OutboundComm.cs
@@ -263,6 +263,22 @@ namespace Swarmops.Logic.Communications
}
+ public static OutboundComm CreateParticipantNotification (Person concernedPerson, Person actingPerson,
+ Organization organization, NotificationResource notification)
+ {
+ NotificationPayload payload = new NotificationPayload(notification.ToString());
+ payload.Strings[NotificationString.ActingPersonName] = actingPerson.Name;
+ payload.Strings[NotificationString.ConcernedPersonName] = concernedPerson.Name;
+ payload.Strings[NotificationString.OrganizationName] = organization.Name;
+ payload.Strings[NotificationString.GeographyName] = concernedPerson.Geography.Name;
+ payload.Strings[NotificationString.RegularTitle] = organization.RegularLabel.ToString(); // may need fudging later because localization
+ payload.Strings[NotificationString.ActivistTitle] = organization.ActivistLabel.ToString(); // as above
+
+ return CreateSingleRecipientNotification (payload, organization, Person.FromIdentity (1));
+ }
+
+
+
public static OutboundComm CreateSecurityNotification (Person concernedPerson, Person actingPerson, Organization organization, string ticket,
NotificationResource notification)
{
diff --git a/Logic/Communications/Transmission/NotificationPayload.cs b/Logic/Communications/Transmission/NotificationPayload.cs
index 5ff0b5d9..97fdb35e 100644
--- a/Logic/Communications/Transmission/NotificationPayload.cs
+++ b/Logic/Communications/Transmission/NotificationPayload.cs
@@ -127,7 +127,12 @@ namespace Swarmops.Logic.Communications.Transmission
Password_ResetOnRequest,
Password_ResetByCrew,
Password_CannotReset2FA,
- Password_Changed
+ Password_Changed,
+ Participant_Signup,
+ Participant_Volunteer,
+ Participant_Renewed,
+ Participant_Terminated,
+ Participant_Churned
}
// ReSharper restore InconsistentNaming
@@ -149,7 +154,10 @@ namespace Swarmops.Logic.Communications.Transmission
RequestPurpose,
TertiaryPersonName,
TicketCode,
- Supplier
+ Supplier,
+ GeographyName,
+ RegularTitle,
+ ActivistTitle
}
[Serializable]
diff --git a/Logic/Logic.csproj b/Logic/Logic.csproj
index a8c00730..cab841f6 100644
--- a/Logic/Logic.csproj
+++ b/Logic/Logic.csproj
@@ -298,10 +298,11 @@
-
+
+
@@ -309,6 +310,7 @@
+
diff --git a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs
index 3ff2dfea..7e86f260 100644
--- a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs
+++ b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.18444
+// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -99,7 +99,7 @@ namespace Swarmops.Logic.Resources {
}
///
- /// Looks up a localized string similar to Your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat] concerning [RequestPurpose] has been denied. The text below was given as reason for denying it:
+ /// Looks up a localized string similar to Your cash advance with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat] concerning [RequestPurpose] has been denied. The text below was given as reason for denying it:
///
///[EmbeddedPreformattedText]
///.
@@ -401,6 +401,24 @@ namespace Swarmops.Logic.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to A new person has signed up as [RegularTitle] in [OrganizationName]! They are based in [GeographyName]..
+ ///
+ internal static string Participant_Signup_Body {
+ get {
+ return ResourceManager.GetString("Participant_Signup_Body", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to [[OrganizationName]] New [RegularTitle]: [ConcernedPersonName], [GeographyName].
+ ///
+ internal static string Participant_Signup_Subject {
+ get {
+ return ResourceManager.GetString("Participant_Signup_Subject", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Somebody, most likely you, requested a reset of the password associated with this mail address at [InstallationName]. However, two-factor authentication has been enabled for this account for heightened security. Therefore, the password CANNOT be reset by simple means.
///
diff --git a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx
index 5883f08b..a079860c 100644
--- a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx
+++ b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx
@@ -257,6 +257,12 @@ Time spent transmitting: [TransmissionTime].
[[OrganizationName]] Comms transmitted: [GeographyName]
+
+ A new person has signed up as [RegularTitle] in [OrganizationName]! They are based in [GeographyName].
+
+
+ [[OrganizationName]] New [RegularTitle]: [ConcernedPersonName], [GeographyName]
+
Somebody, most likely you, requested a reset of the password associated with this mail address at [InstallationName]. However, two-factor authentication has been enabled for this account for heightened security. Therefore, the password CANNOT be reset by simple means.
@@ -350,4 +356,4 @@ The upgrade will be retried every hour. Some functionality may be disabled until
Swarmops Backend operational
-
+
\ No newline at end of file
diff --git a/Logic/Support/LogEntries/MembershipActionBase.cs b/Logic/Support/LogEntries/ParticipationActionBase.cs
similarity index 73%
rename from Logic/Support/LogEntries/MembershipActionBase.cs
rename to Logic/Support/LogEntries/ParticipationActionBase.cs
index b3a90df6..4ab3361d 100644
--- a/Logic/Support/LogEntries/MembershipActionBase.cs
+++ b/Logic/Support/LogEntries/ParticipationActionBase.cs
@@ -7,14 +7,14 @@ using System.Threading.Tasks;
namespace Swarmops.Logic.Support.LogEntries
{
[Serializable]
- public class MembershipActionBase: LogEntryBase
+ public class ParticipationActionBase: LogEntryBase
{
- public MembershipActionBase()
+ public ParticipationActionBase()
{
// do not call public ctor directly. Intended for serialization only.
}
- public int MembershipId { get; set; }
+ public int ParticipationId { get; set; }
///
/// Always in UTC
///
diff --git a/Logic/Support/LogEntries/PersonAddedLogEntry.cs b/Logic/Support/LogEntries/PersonAddedLogEntry.cs
index 572e4e85..b712f2f5 100644
--- a/Logic/Support/LogEntries/PersonAddedLogEntry.cs
+++ b/Logic/Support/LogEntries/PersonAddedLogEntry.cs
@@ -8,7 +8,7 @@ using Swarmops.Logic.Swarm;
namespace Swarmops.Logic.Support.LogEntries
{
[Serializable]
- public class PersonAddedLogEntry: MembershipActionBase
+ public class PersonAddedLogEntry: ParticipationActionBase
{
[Obsolete("Do not call empty ctor directly. Intended for serialization only.", true)]
public PersonAddedLogEntry()
@@ -19,7 +19,7 @@ namespace Swarmops.Logic.Support.LogEntries
public PersonAddedLogEntry (Participation participation, Person actingPerson)
{
DateTime = System.DateTime.UtcNow;
- MembershipId = participation.Identity;
+ ParticipationId = participation.Identity;
ActingPersonId = actingPerson.Identity;
}
}
diff --git a/Logic/Support/LogEntries/PositionActionBase.cs b/Logic/Support/LogEntries/PositionActionBase.cs
new file mode 100644
index 00000000..e7dfd10e
--- /dev/null
+++ b/Logic/Support/LogEntries/PositionActionBase.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Web.UI.WebControls.Expressions;
+
+namespace Swarmops.Logic.Support.LogEntries
+{
+ [Serializable]
+ public class PositionActionBase : LogEntryBase
+ {
+ public int PositionId { get; set; }
+ public int ActingPersonId { get; set; }
+ public int ConcernedPersonId { get; set; }
+ public DateTime DateTime { get; set; } // Always UTC
+ }
+}
diff --git a/Logic/Support/LogEntries/VolunteerForPositionLogEntry.cs b/Logic/Support/LogEntries/VolunteerForPositionLogEntry.cs
new file mode 100644
index 00000000..37c5204a
--- /dev/null
+++ b/Logic/Support/LogEntries/VolunteerForPositionLogEntry.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Swarmops.Logic.Swarm;
+
+namespace Swarmops.Logic.Support.LogEntries
+{
+ [Serializable]
+ public class VolunteerForPositionLogEntry: PositionActionBase
+ {
+ public VolunteerForPositionLogEntry (Person person, Position position)
+ {
+ this.ActingPersonId = this.ConcernedPersonId = person.Identity;
+ this.PositionId = position.Identity;
+ this.DateTime = DateTime.UtcNow;
+ }
+ }
+}
diff --git a/Site5/Pages/v5/Public/Signup.aspx.cs b/Site5/Pages/v5/Public/Signup.aspx.cs
index f18186e1..8ca71624 100644
--- a/Site5/Pages/v5/Public/Signup.aspx.cs
+++ b/Site5/Pages/v5/Public/Signup.aspx.cs
@@ -9,8 +9,12 @@ using System.Web.UI;
using System.Web.UI.WebControls;
using Resources;
using Swarmops.Common.Enums;
+using Swarmops.Logic.Communications;
+using Swarmops.Logic.Communications.Transmission;
using Swarmops.Logic.Security;
using Swarmops.Logic.Structure;
+using Swarmops.Logic.Support;
+using Swarmops.Logic.Support.LogEntries;
using Swarmops.Logic.Swarm;
namespace Swarmops.Frontend.Pages.Public
@@ -216,10 +220,21 @@ namespace Swarmops.Frontend.Pages.Public
Person newPerson = Person.Create (name, mail, password, phone, street1 + "\n" + street2.Trim(), postalCode,
city, countryCode, parsedDateOfBirth, gender);
- newPerson.AddParticipation (organization, DateTime.UtcNow.AddYears (1)); // TODO: set duration from organization settings of Participantship
+ Participation participation = newPerson.AddParticipation (organization, DateTime.UtcNow.AddYears (1)); // TODO: set duration from organization settings of Participantship
// TODO: SEND NOTIFICATIONS
+ // Log the signup
+
+ SwarmopsLog.CreateEntry (newPerson, new PersonAddedLogEntry (participation, newPerson));
+
+ // Create notification
+
+ OutboundComm.CreateParticipantNotification (newPerson, newPerson, organization,
+ NotificationResource.Participant_Signup);
+
+ // Add the bells and whistles
+
if (activist)
{
newPerson.CreateActivist (false, false);
@@ -230,7 +245,9 @@ namespace Swarmops.Frontend.Pages.Public
Volunteer volunteer = newPerson.CreateVolunteer();
foreach (int positionId in positionIdsVolunteer)
{
- volunteer.AddPosition (Position.FromIdentity (positionId));
+ Position position = Position.FromIdentity (positionId);
+ volunteer.AddPosition (position);
+ SwarmopsLog.CreateEntry (newPerson, new VolunteerForPositionLogEntry (newPerson, position));
}
}