From 24d75fa23b24b87edf63be27a97df8d0cc330a11 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Mon, 8 Dec 2014 01:10:52 +0100 Subject: [PATCH] Add Person almost finished --- Logic/Communications/OutboundComm.cs | 2 +- Site5/App_GlobalResources/Pages.Swarm.resx | 2 +- Site5/Pages/v5/Swarm/AddPerson.aspx.cs | 19 ++++--------------- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/Logic/Communications/OutboundComm.cs b/Logic/Communications/OutboundComm.cs index f82ab185..b4a112da 100644 --- a/Logic/Communications/OutboundComm.cs +++ b/Logic/Communications/OutboundComm.cs @@ -120,7 +120,7 @@ namespace Swarmops.Logic.Communications OutboundComm comm = OutboundComm.Create (null, null, membership.Organization, CommResolverClass.Unknown, null, CommTransmitterClass.CommsTransmitterMail, - new ParticipantMailPayload (mailType, membership, actingPerson).ToXml(), + new PayloadEnvelope (new ParticipantMailPayload (mailType, membership, actingPerson)).ToXml(), OutboundCommPriority.Low); foreach (Person person in recipients) diff --git a/Site5/App_GlobalResources/Pages.Swarm.resx b/Site5/App_GlobalResources/Pages.Swarm.resx index acf415fd..b43f6955 100644 --- a/Site5/App_GlobalResources/Pages.Swarm.resx +++ b/Site5/App_GlobalResources/Pages.Swarm.resx @@ -141,7 +141,7 @@ "Legal" to cut short discussions on 50 different genders for the time being - The person was successfully added to the organization. + The person was successfully added to the organization. A welcome mail has been sent. Statistical Data diff --git a/Site5/Pages/v5/Swarm/AddPerson.aspx.cs b/Site5/Pages/v5/Swarm/AddPerson.aspx.cs index 94acb4b5..9348a291 100644 --- a/Site5/Pages/v5/Swarm/AddPerson.aspx.cs +++ b/Site5/Pages/v5/Swarm/AddPerson.aspx.cs @@ -100,27 +100,16 @@ namespace Swarmops.Frontend.Pages.v5.Swarm protected void ButtonSubmit_Click (object sender, EventArgs e) { - /* + // TODO: Parse birthdate + Person newPerson = Person.Create (this.TextName.Text, this.TextMail.Text, string.Empty, this.TextPhone.Text, this.TextStreet1.Text + this.TextStreet2.Text, this.TextPostal.Text, this.TextCity.Text, this.DropCountries.SelectedValue, DateTime.UtcNow, - PersonGender.Unknown); + (PersonGender)Enum.Parse(typeof(PersonGender), this.DropGenders.SelectedValue)); Membership newMembership = Membership.Create (newPerson, CurrentOrganization, DateTime.Today.AddYears (1)); - PayloadEnvelope envelope = new PayloadEnvelope(); - ParticipantMailPayload payload = new ParticipantMailPayload(ParticipantMailType.MemberAddedWelcome, newMembership, CurrentUser); - envelope.PayloadXml = payload.ToXml(); - envelope.PayloadClass = payload.GetType().ToString(); - - Assembly assembly = typeof (PayloadEnvelope).Assembly; - - Type payloadType = assembly.GetType (envelope.PayloadClass); - var methodInfo = payloadType.GetMethod("FromXml", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy); - - ICommsRenderer renderer = (ICommsRenderer)(methodInfo.Invoke (null, new object[] { envelope.PayloadXml })); - - */ + OutboundComm.CreateMembershipLetter (ParticipantMailType.MemberAddedWelcome, newMembership, CurrentUser); // Person.Create()