Work on Add Person - checkpoint commit to Sandbox Backend
This commit is contained in:
Generated
+91
@@ -0,0 +1,91 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18444
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Swarmops.Logic.App_GlobalResources {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Logic_Communications_Transmission_DefaultCommTemplates {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Logic_Communications_Transmission_DefaultCommTemplates() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Swarmops.Logic.App_GlobalResources.Logic.Communications.Transmission.DefaultCommT" +
|
||||
"emplates", typeof(Logic_Communications_Transmission_DefaultCommTemplates).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Welcome to [OrganizationName]!
|
||||
///
|
||||
///You have been granted a [Regularship] by [ActingPerson]. It expires on [MembershipExpiry], so there's plenty of time to get acquainted with the organization.
|
||||
///
|
||||
///You should already have been contacted by people from [OrganizationName] for more information on how to get active. If not, then expect correspondence soon.
|
||||
///
|
||||
///Your initial and randomly generated password to Swarmops, the software used as a back-end system, is as follows:
|
||||
///[RandomPassword]
|
||||
///
|
||||
///(Unfortunately, you ca [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string ParticipantManualAddWelcome_Body {
|
||||
get {
|
||||
return ResourceManager.GetString("ParticipantManualAddWelcome_Body", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to [[OrganizationName]] Welcome to [OrganizationName]!.
|
||||
/// </summary>
|
||||
internal static string ParticipantManualAddWelcome_Subject {
|
||||
get {
|
||||
return ResourceManager.GetString("ParticipantManualAddWelcome_Subject", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="ParticipantManualAddWelcome_Body" xml:space="preserve">
|
||||
<value>Welcome to [OrganizationName]!
|
||||
|
||||
You have been granted a [Regularship] by [ActingPerson]. It expires on [MembershipExpiry], so there's plenty of time to get acquainted with the organization.
|
||||
|
||||
You should already have been contacted by people from [OrganizationName] for more information on how to get active. If not, then expect correspondence soon.
|
||||
|
||||
Your initial and randomly generated password to Swarmops, the software used as a back-end system, is as follows:
|
||||
[RandomPassword]
|
||||
|
||||
(Unfortunately, you can't change it yet. That functionality is expected early 2015. Swarmops is still in an early alpha; that's one of the drawbacks of pioneering new software: things can be a little half-baked as they come online.)
|
||||
|
||||
Welcome aboard!</value>
|
||||
</data>
|
||||
<data name="ParticipantManualAddWelcome_Subject" xml:space="preserve">
|
||||
<value>[[OrganizationName]] Welcome to [OrganizationName]!</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -11,7 +11,7 @@ namespace Swarmops.Logic.Communications
|
||||
RenderedComm RenderComm (Person person);
|
||||
}
|
||||
|
||||
public class RenderedComm : Dictionary<CommRenderPart, string>
|
||||
public class RenderedComm : Dictionary<CommRenderPart, object>
|
||||
{
|
||||
// typeset for readability
|
||||
}
|
||||
|
||||
@@ -112,6 +112,28 @@ namespace Swarmops.Logic.Communications
|
||||
}
|
||||
|
||||
|
||||
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 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
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MySql.Data.MySqlClient.Properties;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Swarm;
|
||||
|
||||
namespace Swarmops.Logic.Communications.Transmission
|
||||
{
|
||||
[Serializable]
|
||||
public class ParticipantMailPayload: PayloadBase<ParticipantMailPayload>, ICommsRenderer
|
||||
{
|
||||
[Obsolete("Do not call this constructor - doing so will generate this compile-time error. For serialization only.", true)]
|
||||
public ParticipantMailPayload()
|
||||
{
|
||||
// do not use - for serialization only
|
||||
}
|
||||
|
||||
public SerializableDictionary<MailPayloadString, string> Strings{ get; set; }
|
||||
public string SubjectTemplate { get; set; }
|
||||
public string BodyTemplate { get; set; }
|
||||
|
||||
|
||||
public ParticipantMailPayload (ParticipantMailType mailType, Membership membership, Person actingPerson)
|
||||
{
|
||||
Strings = new SerializableDictionary<MailPayloadString, string>();
|
||||
|
||||
switch (mailType)
|
||||
{
|
||||
case ParticipantMailType.MemberAddedWelcome:
|
||||
Strings[MailPayloadString.ActingPerson] = actingPerson.Name;
|
||||
Strings[MailPayloadString.MembershipExpiry] = membership.Expires.ToLongDateString();
|
||||
Strings[MailPayloadString.OrganizationName] = membership.Organization.Name;
|
||||
Strings[MailPayloadString.Regularship] =
|
||||
Participant.Localized (membership.Organization.RegularLabel, TitleVariant.Ship);
|
||||
|
||||
BodyTemplate =
|
||||
App_GlobalResources.Logic_Communications_Transmission_DefaultCommTemplates
|
||||
.ParticipantManualAddWelcome_Body;
|
||||
|
||||
SubjectTemplate =
|
||||
App_GlobalResources.Logic_Communications_Transmission_DefaultCommTemplates
|
||||
.ParticipantManualAddWelcome_Subject;
|
||||
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException("Unknown mailType: " + mailType.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public RenderedComm RenderComm (Person person)
|
||||
{
|
||||
string body = BodyTemplate;
|
||||
string subject = SubjectTemplate;
|
||||
|
||||
// If the template contains "[RandomPassword]", set the person's pwd to random and replace macro
|
||||
|
||||
if (body.Contains ("[RandomPassword]"))
|
||||
{
|
||||
string randomPassword = Authentication.CreateRandomPassword (24);
|
||||
person.SetPassword (randomPassword);
|
||||
body = body.Replace ("[RandomPassword]", randomPassword);
|
||||
}
|
||||
|
||||
// Replace each and every marker in template from lookup table
|
||||
|
||||
foreach (
|
||||
MailPayloadString replacementString in (MailPayloadString[])Enum.GetValues(typeof(MailPayloadString))
|
||||
)
|
||||
{
|
||||
if (Strings.ContainsKey (replacementString))
|
||||
{
|
||||
body = body.Replace ("[" + replacementString.ToString() + "]",
|
||||
Strings[replacementString]);
|
||||
subject = subject.Replace ("[" + replacementString.ToString() + "]",
|
||||
Strings[replacementString]);
|
||||
}
|
||||
}
|
||||
|
||||
RenderedComm result = new RenderedComm();
|
||||
result[CommRenderPart.BodyText] = body;
|
||||
result[CommRenderPart.Subject] = subject;
|
||||
result[CommRenderPart.SenderMail] = "admin@swarmops.com"; // TODO: FIX FIX FIX HACK
|
||||
result[CommRenderPart.SenderName] = "Swarmops Administrative";
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public enum OrganizationMailSender
|
||||
{
|
||||
Unknown = 0,
|
||||
HumanResources,
|
||||
Accounting,
|
||||
OrganizationName,
|
||||
SystemNotifier,
|
||||
HighestExecutive
|
||||
}
|
||||
|
||||
public enum ParticipantMailType
|
||||
{
|
||||
Unknown = 0,
|
||||
MemberAddedWelcome
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public enum MailPayloadString
|
||||
{
|
||||
// will likely need much more here
|
||||
|
||||
Unknown = 0,
|
||||
MembershipExpiry,
|
||||
Regularship,
|
||||
ActingPerson,
|
||||
OrganizationName
|
||||
}
|
||||
|
||||
}
|
||||
@@ -70,6 +70,11 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App_GlobalResources\Logic.Communications.Transmission.DefaultCommTemplates.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Logic.Communications.Transmission.DefaultCommTemplates.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="App_GlobalResources\Logic.Financial.FinancialTransactionTagSetTypesStock.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
@@ -104,6 +109,7 @@
|
||||
<Compile Include="Communications\OutboundCommRecipients.cs" />
|
||||
<Compile Include="Communications\OutboundComms.cs" />
|
||||
<Compile Include="Communications\OutboundCommTransmitException.cs" />
|
||||
<Compile Include="Communications\Transmission\ParticipantMailPayload.cs" />
|
||||
<Compile Include="Communications\Transmission\PayloadEnvelope.cs" />
|
||||
<Compile Include="Communications\Transmission\NotificationPayload.cs" />
|
||||
<Compile Include="Communications\Transmission\PayloadBase.cs" />
|
||||
@@ -369,6 +375,10 @@
|
||||
<EmbeddedResource Include="App_GlobalResources\it-IT\Logic.Communications.Transmission.NotificationPayload.it-IT.resx" />
|
||||
<EmbeddedResource Include="App_GlobalResources\it-IT\Logic.Financial.FinancialTransactionTagSetTypesStock.it-IT.resx" />
|
||||
<EmbeddedResource Include="App_GlobalResources\it-IT\Logic.Swarm.DashboardTodos.it-IT.resx" />
|
||||
<EmbeddedResource Include="App_GlobalResources\Logic.Communications.Transmission.DefaultCommTemplates.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Logic.Communications.Transmission.DefaultCommTemplates.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="App_GlobalResources\Logic.Financial.FinancialTransactionTagSetTypesStock.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Logic.Financial.FinancialTransactionTagSetTypesStock.Designer.cs</LastGenOutput>
|
||||
|
||||
@@ -80,8 +80,6 @@ namespace Swarmops.Controls.Base
|
||||
{
|
||||
// TODO: More types here, and check with the CSS. Some work to get good looking
|
||||
|
||||
// MEH forcing build
|
||||
|
||||
case MenuItemType.Link:
|
||||
output.Write (
|
||||
"<a href=\"{1}\"><img src=\"/Images/PageIcons/{0}-{3}.png\" height=\"20\" width=\"20\" />{2}</a>",
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Resources;
|
||||
using Swarmops.Basic.Enums;
|
||||
using Swarmops.Logic.Communications;
|
||||
using Swarmops.Logic.Communications.Transmission;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Structure;
|
||||
using Swarmops.Logic.Swarm;
|
||||
@@ -80,6 +84,7 @@ namespace Swarmops.Frontend.Pages.v5.Swarm
|
||||
this.LabelStreet2.Text = Resources.Pages.Swarm.AddPerson_Street2;
|
||||
this.LabelPostalCode.Text = Resources.Global.Global_PostalCode;
|
||||
this.LabelCity.Text = Resources.Global.Global_City;
|
||||
this.LabelGeographyDetected.Text = Resources.Pages.Swarm.AddPerson_GeographyDetected;
|
||||
this.LabelHeaderStatData.Text = Resources.Pages.Swarm.AddPerson_StatisticalData;
|
||||
this.LabelDateOfBirth.Text = Resources.Global.Global_DateOfBirth;
|
||||
this.LabelLegalGender.Text = Resources.Pages.Swarm.AddPerson_LegalGender;
|
||||
@@ -95,8 +100,27 @@ namespace Swarmops.Frontend.Pages.v5.Swarm
|
||||
|
||||
protected void ButtonSubmit_Click (object sender, EventArgs e)
|
||||
{
|
||||
string randomPassword = Authentication.CreateRandomPassword (24);
|
||||
/*
|
||||
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);
|
||||
|
||||
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 }));
|
||||
|
||||
*/
|
||||
|
||||
// Person.Create()
|
||||
|
||||
|
||||
@@ -144,8 +144,6 @@
|
||||
</div>
|
||||
|
||||
<div class="mainbar">
|
||||
<div id="page-icon-encaps"><asp:Image ID="IconPage" runat="server" ImageUrl="~/Security/Images/iconshock-fingerprint-scanner-40px.png" /></div><h1><asp:Label ID="LabelPageTitle" Text="Login" runat="server" /></h1>
|
||||
|
||||
<div class="box">
|
||||
<div class="content">
|
||||
|
||||
|
||||
@@ -271,7 +271,6 @@ namespace Swarmops.Pages.Security
|
||||
{
|
||||
this.LabelCurrentOrganizationName.Text = Global.Global_Organization;
|
||||
this.LabelCurrentUserName.Text = Participant.Localized (ParticipantTitle.Person, TitleVariant.Generic);
|
||||
this.LabelPageTitle.Text = Resources.Pages.Security.Login_PageTitle;
|
||||
this.LabelPreferences.Text = Global.Global_NA;
|
||||
this.LabelSidebarInfoHeader.Text = Global.Sidebar_Information;
|
||||
this.LabelSidebarHelpHeader.Text = Global.Sidebar_Help;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Net.Mail;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Swarmops.Logic.Communications;
|
||||
using Swarmops.Logic.Communications.Transmission;
|
||||
@@ -10,20 +11,21 @@ namespace Swarmops.Utility.Communications
|
||||
{
|
||||
public class CommsTransmitterMail : ICommsTransmitter
|
||||
{
|
||||
// To be implemented
|
||||
// To be implemented better
|
||||
|
||||
private static string _smtpServerCache = string.Empty;
|
||||
private static DateTime _cacheReloadTime = DateTime.MinValue;
|
||||
|
||||
public void Transmit (PayloadEnvelope envelope, Person person)
|
||||
{
|
||||
if (envelope.PayloadClass != "Swarmops.Logic.Communications.Transmission.NotificationPayload")
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
// Create the renderer via reflection of the static FromXml method
|
||||
|
||||
ICommsRenderer renderer = NotificationPayload.FromXml (envelope.PayloadXml);
|
||||
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 }));
|
||||
RenderedComm comm = renderer.RenderComm (person);
|
||||
|
||||
MailMessage mail = new MailMessage();
|
||||
@@ -32,7 +34,7 @@ namespace Swarmops.Utility.Communications
|
||||
|
||||
try
|
||||
{
|
||||
mail.From = new MailAddress (comm[CommRenderPart.SenderMail], comm[CommRenderPart.SenderName],
|
||||
mail.From = new MailAddress ((string) comm[CommRenderPart.SenderMail], (string) comm[CommRenderPart.SenderName],
|
||||
Encoding.UTF8);
|
||||
mail.To.Add (new MailAddress (person.Mail, person.Name));
|
||||
}
|
||||
@@ -44,8 +46,8 @@ namespace Swarmops.Utility.Communications
|
||||
throw new OutboundCommTransmitException ("Cannot send mail to " + person.Mail, e);
|
||||
}
|
||||
|
||||
mail.Subject = comm[CommRenderPart.Subject];
|
||||
mail.Body = comm[CommRenderPart.BodyText];
|
||||
mail.Subject = (string) comm[CommRenderPart.Subject];
|
||||
mail.Body = (string) comm[CommRenderPart.BodyText];
|
||||
mail.SubjectEncoding = Encoding.UTF8;
|
||||
mail.BodyEncoding = Encoding.UTF8;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user