Added Resolved=true to OutboundComm.CreateNotification

This commit is contained in:
Rick Falkvinge
2013-07-06 14:10:59 +00:00
parent 7bcc53eb9e
commit 7d46e59222
3 changed files with 36 additions and 4 deletions
+19 -3
View File
@@ -214,17 +214,33 @@ namespace Swarmops.Database
AddParameterWithName(command, "senderPersonId", senderPersonId);
AddParameterWithName(command, "fromPersonId", fromPersonId);
AddParameterWithName(command, "organizationId", organizationId);
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, "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, "priority", (int)priority); // convert enum to integerized priority; convert back on field read
AddParameterWithName(command, "createdDateTime", DateTime.UtcNow);
return Convert.ToInt32(command.ExecuteScalar());
}
}
public void SetOutboundCommResolved(int outboundCommId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command = GetDbCommand("SetOutboundCommResolved", connection);
command.CommandType = CommandType.StoredProcedure;
AddParameterWithName(command, "outboundCommId", outboundCommId);
AddParameterWithName(command, "dateTime", DateTime.UtcNow);
command.ExecuteNonQuery();
}
}
#endregion
+17
View File
@@ -95,6 +95,23 @@ namespace Swarmops.Logic.Communications
// public static OutboundComm CreateNotification (FinancialAccount budget, string notificationResource)
public new bool Resolved
{
get { return base.Resolved; }
set
{
if (!base.Resolved && value == true)
{
SwarmDb.GetDatabaseForWriting().SetOutboundCommResolved(this.Identity);
base.Resolved = true;
}
else
{
throw new InvalidOperationException("Can only set OutboundComms.Resolved from false to true");
}
}
}
public void AddRecipient (Person person)
{
-1
View File
@@ -37,7 +37,6 @@ namespace Swarmops
_authority = _currentUser.GetAuthority();
_currentOrganization = Organization.FromIdentity(currentOrganizationId);
// OutboundComm.CreateNotification(null, NotificationResource.System_Startup);
}
protected void Page_Load(object sender, EventArgs e)