Committing work at EOD

This commit is contained in:
Rick Falkvinge
2013-06-12 23:27:45 +00:00
parent 8a308bad20
commit 59c06c28ee
12 changed files with 177 additions and 4 deletions
+3 -2
View File
@@ -214,11 +214,12 @@ namespace Swarmops.Database
AddParameterWithName(command, "senderPersonId", senderPersonId);
AddParameterWithName(command, "fromPersonId", fromPersonId);
AddParameterWithName(command, "organizationId", organizationId);
AddParameterWithName(command, "resolverClass", resolverClass); // Will be turned into ID by stored procedure
AddParameterWithName(command, "recipientDataXml", recipientDataXml);
AddParameterWithName(command, "resolverClass", String.IsNullOrEmpty(resolverClass)? "0": resolverClass); // Will be turned into ID by stored procedure
AddParameterWithName(command, "recipientDataXml", String.IsNullOrEmpty(recipientDataXml)? string.Empty: recipientDataXml);
AddParameterWithName(command, "transmitterClass", transmitterClass); // Will be turned into ID by stored procedure
AddParameterWithName(command, "payloadXml", payloadXml);
AddParameterWithName(command, "priority", (int) priority); // convert enum to integerized priority; convert back on field read
AddParameterWithName(command, "createdDateTime", DateTime.UtcNow);
return Convert.ToInt32(command.ExecuteScalar());
}
+30
View File
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Swarmops.Logic.Swarm;
namespace Swarmops.Logic.Communications
{
/// <summary>
/// Renders an OutboundComm for one specific type of comm and for the target person.
/// </summary>
public interface ICommsRenderer
{
RenderedComms RenderComm(OutboundComm comm, Person person);
}
public class RenderedComms: Dictionary<CommsRenderPart,string>
{
// typeset for readability
}
public enum CommsRenderPart
{
Unknown = 0,
SenderName,
SenderMail,
Subject,
Body
}
}
+11
View File
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Swarmops.Logic.Communications
{
public interface ICommsResolver
{
}
}
+18
View File
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Swarmops.Logic.Swarm;
namespace Swarmops.Logic.Communications
{
public interface ICommsTransmitter
{
/// <summary>
/// This function transmits an outbound comm. If it fails, it must throw an OutboundCommTransmitException. It is expected to block until complete.
/// </summary>
/// <param name="comm">The piece of communications to send.</param>
/// <param name="person">The person to send to.</param>
void Transmit(OutboundComm comm, Person person);
}
}
+36
View File
@@ -3,6 +3,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using Swarmops.Basic.Types.Communications;
using Swarmops.Database;
using Swarmops.Logic.Structure;
using Swarmops.Logic.Swarm;
namespace Swarmops.Logic.Communications
{
@@ -12,5 +15,38 @@ namespace Swarmops.Logic.Communications
{
// private ctor
}
public static OutboundComm FromBasic (BasicOutboundComm basic)
{
return new OutboundComm(basic);
}
public static OutboundComm FromIdentity (int outboundCommId)
{
return FromBasic(SwarmDb.GetDatabaseForReading().GetOutboundComm(outboundCommId));
}
public static OutboundComm Create(Person sender, Person from, Organization organization)
{
return null;
}
}
public enum CommResolverClasses
{
Unknown = 0,
Test_Foo_Bar
}
public enum CommTransmitterClasses
{
Unknown = 0,
}
}
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Swarmops.Logic.Communications
{
/// <summary>
/// This exception is thrown if transmission of an OutboundComm fails (for a specific person). The description should NOT contain personal data or anything that varies with person/time.
/// </summary>
public class OutboundCommTransmitException: Exception
{
public OutboundCommTransmitException (string description) : base (description)
{
Description = description;
}
public OutboundCommTransmitException (string description, Exception innerException): base (description, innerException)
{
Description = description;
}
public string Description { get; set; }
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Swarmops.Logic.Communications.Transmission
{
public interface IPayload
{
string ToXml();
}
}
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Swarmops.Logic.Communications.Transmission
{
[Serializable]
public class MailMetaPayload: PayloadBase<MailMetaPayload>
{
public string PayloadClass { get; set; }
public string PayloadXml { get; set; }
}
}
@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace Swarmops.Logic.Communications.Transmission
{
[Serializable]
public class PayloadBase<T>
public class PayloadBase<T>: IPayload
{
public string ToXml()
{
+6
View File
@@ -64,10 +64,16 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Communications\ICommsRenderer.cs" />
<Compile Include="Communications\ICommsResolver.cs" />
<Compile Include="Communications\ICommsTransmitter.cs" />
<Compile Include="Communications\OutboundComm.cs" />
<Compile Include="Communications\OutboundCommRecipient.cs" />
<Compile Include="Communications\OutboundCommRecipients.cs" />
<Compile Include="Communications\OutboundComms.cs" />
<Compile Include="Communications\OutboundCommTransmitException.cs" />
<Compile Include="Communications\Transmission\IPayload.cs" />
<Compile Include="Communications\Transmission\MailMetaPayload.cs" />
<Compile Include="Communications\Transmission\NotificationPayload.cs" />
<Compile Include="Communications\Transmission\PayloadBase.cs" />
<Compile Include="Financial\CashAdvance.cs" />
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Swarmops.Logic.Communications;
using Swarmops.Logic.Swarm;
namespace Swarmops.Utility.Communications
{
public class CommsTransmitterMail: ICommsTransmitter
{
// To be implemented
public void Transmit(OutboundComm comm, Person person)
{
throw new NotImplementedException();
}
}
}
+1 -1
View File
@@ -95,6 +95,7 @@
<Compile Include="BotCode\SchulzeProcessor.cs" />
<Compile Include="BotCode\TurnaroundTracker.cs" />
<Compile Include="BotCode\UpdateStatsCache.cs" />
<Compile Include="Communications\CommsTransmitterMail.cs" />
<Compile Include="ExceptionMail.cs" />
<Compile Include="Financial\PaymentGroupMapper.cs" />
<Compile Include="Financial\PaysonImporter.cs" />
@@ -145,7 +146,6 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Communications\" />
<Folder Include="Rss\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />