Signup appears complete. Deploying.
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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]
|
||||
|
||||
+3
-1
@@ -298,10 +298,11 @@
|
||||
<Compile Include="Support\Imagery.cs" />
|
||||
<Compile Include="Support\IXmlPayload.cs" />
|
||||
<Compile Include="Support\LogEntries\CashAdvanceRequestedLogEntry.cs" />
|
||||
<Compile Include="Support\LogEntries\MembershipActionBase.cs" />
|
||||
<Compile Include="Support\LogEntries\ParticipationActionBase.cs" />
|
||||
<Compile Include="Support\LogEntries\PasswordResetLogEntry.cs" />
|
||||
<Compile Include="Support\LogEntries\PasswordResetRequestLogEntry.cs" />
|
||||
<Compile Include="Support\LogEntries\PersonAddedLogEntry.cs" />
|
||||
<Compile Include="Support\LogEntries\PositionActionBase.cs" />
|
||||
<Compile Include="Support\LogEntries\SalaryCreatedLogEntry.cs" />
|
||||
<Compile Include="Support\LogEntries\InboundInvoiceCreatedLogEntry.cs" />
|
||||
<Compile Include="Support\LogEntries\ExpenseClaimFiledLogEntry.cs" />
|
||||
@@ -309,6 +310,7 @@
|
||||
<Compile Include="Support\LogEntries\LogEntryBase.cs" />
|
||||
<Compile Include="Support\LogEntries\PayoutCreatedLogEntry.cs" />
|
||||
<Compile Include="Support\LogEntries\SecurityActionBase.cs" />
|
||||
<Compile Include="Support\LogEntries\VolunteerForPositionLogEntry.cs" />
|
||||
<Compile Include="Support\ObjectOptionalData.cs" />
|
||||
<Compile Include="Support\PilotInstallationIds.cs" />
|
||||
<Compile Include="Support\PluralBase.cs" />
|
||||
|
||||
+20
-2
@@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 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 {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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 {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to A new person has signed up as [RegularTitle] in [OrganizationName]! They are based in [GeographyName]..
|
||||
/// </summary>
|
||||
internal static string Participant_Signup_Body {
|
||||
get {
|
||||
return ResourceManager.GetString("Participant_Signup_Body", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to [[OrganizationName]] New [RegularTitle]: [ConcernedPersonName], [GeographyName].
|
||||
/// </summary>
|
||||
internal static string Participant_Signup_Subject {
|
||||
get {
|
||||
return ResourceManager.GetString("Participant_Signup_Subject", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
///
|
||||
|
||||
@@ -257,6 +257,12 @@ Time spent transmitting: [TransmissionTime].</value>
|
||||
<data name="OutboundComm_Sent_Subject" xml:space="preserve">
|
||||
<value>[[OrganizationName]] Comms transmitted: [GeographyName]</value>
|
||||
</data>
|
||||
<data name="Participant_Signup_Body" xml:space="preserve">
|
||||
<value>A new person has signed up as [RegularTitle] in [OrganizationName]! They are based in [GeographyName].</value>
|
||||
</data>
|
||||
<data name="Participant_Signup_Subject" xml:space="preserve">
|
||||
<value>[[OrganizationName]] New [RegularTitle]: [ConcernedPersonName], [GeographyName]</value>
|
||||
</data>
|
||||
<data name="Password_CannotReset2FA_Body" xml:space="preserve">
|
||||
<value>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
|
||||
<data name="System_Startup_Subject" xml:space="preserve">
|
||||
<value>Swarmops Backend operational</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
||||
+3
-3
@@ -7,14 +7,14 @@ using System.Threading.Tasks;
|
||||
namespace Swarmops.Logic.Support.LogEntries
|
||||
{
|
||||
[Serializable]
|
||||
public class MembershipActionBase: LogEntryBase<MembershipActionBase>
|
||||
public class ParticipationActionBase: LogEntryBase<ParticipationActionBase>
|
||||
{
|
||||
public MembershipActionBase()
|
||||
public ParticipationActionBase()
|
||||
{
|
||||
// do not call public ctor directly. Intended for serialization only.
|
||||
}
|
||||
|
||||
public int MembershipId { get; set; }
|
||||
public int ParticipationId { get; set; }
|
||||
/// <summary>
|
||||
/// Always in UTC
|
||||
/// </summary>
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<PositionActionBase>
|
||||
{
|
||||
public int PositionId { get; set; }
|
||||
public int ActingPersonId { get; set; }
|
||||
public int ConcernedPersonId { get; set; }
|
||||
public DateTime DateTime { get; set; } // Always UTC
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user