diff --git a/Backend/CommsTransmitter.cs b/Backend/CommsTransmitter.cs
index 835e1b97..ef4ada4b 100644
--- a/Backend/CommsTransmitter.cs
+++ b/Backend/CommsTransmitter.cs
@@ -1,12 +1,13 @@
using System;
using Swarmops.Logic.Communications;
using Swarmops.Logic.Communications.Transmission;
+using Swarmops.Utility.Communications;
namespace Swarmops.Backend
{
internal class CommsTransmitter
{
- static internal void Run()
+ internal static void Run()
{
OutboundComms comms = OutboundComms.GetOpen();
@@ -24,7 +25,7 @@ namespace Swarmops.Backend
throw new NotImplementedException();
}
- ICommsTransmitter transmitter = new Swarmops.Utility.Communications.CommsTransmitterMail();
+ ICommsTransmitter transmitter = new CommsTransmitterMail();
OutboundCommRecipients recipients = comm.Recipients;
PayloadEnvelope envelope = PayloadEnvelope.FromXml(comm.PayloadXml);
@@ -48,4 +49,4 @@ namespace Swarmops.Backend
}
}
}
-}
+}
\ No newline at end of file
diff --git a/Backend/Program.cs b/Backend/Program.cs
index 52cf3f59..b3e51845 100644
--- a/Backend/Program.cs
+++ b/Backend/Program.cs
@@ -9,6 +9,7 @@ using Swarmops.Logic.Financial;
using Swarmops.Logic.Support;
using Swarmops.Utility;
using Swarmops.Utility.BotCode;
+using Swarmops.Utility.Communications;
using Swarmops.Utility.Mail;
namespace Swarmops.Backend
@@ -16,14 +17,16 @@ namespace Swarmops.Backend
internal class Program
{
private const string heartbeatFile = "/var/run/swarmops/backend/heartbeat.txt";
+ private static bool testMode;
- private static void Main (string[] args)
+ private static void Main(string[] args)
{
testMode = false;
- UnixSignal[] killSignals = new UnixSignal[]{
- new UnixSignal (Signum.SIGINT),
- new UnixSignal (Signum.SIGTERM),
+ UnixSignal[] killSignals =
+ {
+ new UnixSignal(Signum.SIGINT),
+ new UnixSignal(Signum.SIGTERM)
};
BotLog.Write(0, "MainCycle", string.Empty);
@@ -33,7 +36,8 @@ namespace Swarmops.Backend
if (args.Length > 0)
{
if (args[0].ToLower() == "test")
- {/*
+ {
+/*
BotLog.Write(0, "MainCycle", "Running self-tests");
HeartBeater.Instance.Beat(heartbeatFile); // Otherwise Heartbeater.Beat() will fail in various places
@@ -77,7 +81,7 @@ namespace Swarmops.Backend
throw new NotImplementedException();
}
- ICommsTransmitter transmitter = new Swarmops.Utility.Communications.CommsTransmitterMail();
+ ICommsTransmitter transmitter = new CommsTransmitterMail();
OutboundCommRecipients recipients = comm.Recipients;
PayloadEnvelope envelope = PayloadEnvelope.FromXml(comm.PayloadXml);
@@ -92,7 +96,7 @@ namespace Swarmops.Backend
Console.Write("\r\nAll tests run. Waiting for mail queue to flush... ");
while (!MailTransmitter.CanExit)
{
- System.Threading.Thread.Sleep(50);
+ Thread.Sleep(50);
}
Console.WriteLine("done.");
@@ -110,12 +114,12 @@ namespace Swarmops.Backend
// ----------------------- INSERT ANY ONE-OFF ACTIONS HERE -------------------------
-
+
Console.Write("\r\nWaiting for mail queue to flush... ");
while (!MailTransmitter.CanExit)
{
- System.Threading.Thread.Sleep(50);
+ Thread.Sleep(50);
}
Console.WriteLine("done.");
@@ -168,7 +172,7 @@ namespace Swarmops.Backend
bool exitFlag = false;
- while (!exitFlag) // exit is handled by signals handling at end of loop
+ while (!exitFlag) // exit is handled by signals handling at end of loop
{
BotLog.Write(0, "MainCycle", "Cycle Start");
@@ -182,7 +186,7 @@ namespace Swarmops.Backend
{
OnEveryMinute();
- if (cycleStartTime.Minute % 5 == 0)
+ if (cycleStartTime.Minute%5 == 0)
{
OnEveryFiveMinutes();
}
@@ -232,8 +236,9 @@ namespace Swarmops.Backend
if (signalIndex < 1000)
{
exitFlag = true;
- Console.WriteLine("Caught signal " + killSignals[signalIndex].Signum.ToString() + ", exiting");
- BotLog.Write(0, "MainCycle", "EXIT SIGNAL (" + killSignals[signalIndex].Signum.ToString() + "), terminating backend");
+ Console.WriteLine("Caught signal " + killSignals[signalIndex].Signum + ", exiting");
+ BotLog.Write(0, "MainCycle",
+ "EXIT SIGNAL (" + killSignals[signalIndex].Signum + "), terminating backend");
}
}
}
@@ -249,7 +254,7 @@ namespace Swarmops.Backend
}*/
BotLog.Write(0, "MainCycle", "...done");
-
+
/*
while (!MailTransmitter.CanExit)
{
@@ -259,7 +264,7 @@ namespace Swarmops.Backend
Thread.Sleep(2000);
}
- private static void OnEveryTenSeconds ()
+ private static void OnEveryTenSeconds()
{
try
{
@@ -301,7 +306,6 @@ namespace Swarmops.Backend
}
BotLog.Write(0, "MainCycle", "Ten-second exit");
-
}
catch (Exception e)
{
@@ -309,7 +313,7 @@ namespace Swarmops.Backend
}
}
- private static void OnEveryMinute ()
+ private static void OnEveryMinute()
{
try
{
@@ -323,7 +327,7 @@ namespace Swarmops.Backend
}
- private static void OnEveryFiveMinutes ()
+ private static void OnEveryFiveMinutes()
{
try
{
@@ -374,7 +378,6 @@ namespace Swarmops.Backend
// Added during election rush 2010: clean up support database every five minutes instead of once a day
// SMS notifications for bounces are turned off, so people don't get SMS notifications in the middle of the night
-
}
catch (Exception e)
{
@@ -428,7 +431,7 @@ namespace Swarmops.Backend
}
- private static void OnEveryHour ()
+ private static void OnEveryHour()
{
DateTime startTime = DateTime.Now;
try
@@ -456,7 +459,7 @@ namespace Swarmops.Backend
{
TraceAndReport(e);
}
-
+
try
{
/*TestTrace("Running PaymentGroupMapper.Run()...");
@@ -509,7 +512,7 @@ namespace Swarmops.Backend
}
}
- private static void OnMidnight ()
+ private static void OnMidnight()
{
try
{
@@ -604,7 +607,7 @@ namespace Swarmops.Backend
}
}
- private static void OnNoon ()
+ private static void OnNoon()
{
BotLog.Write(0, "MainCycle", "Noon entry");
@@ -638,7 +641,6 @@ namespace Swarmops.Backend
SupportDatabase.NotifyBouncingEmails();
TestTrace(" done.\r\n");*/
}
-
}
catch (Exception e)
{
@@ -671,7 +673,7 @@ namespace Swarmops.Backend
BotLog.Write(0, "MainCycle", "Noon exit");
}
- private static void OnTuesdayMorning ()
+ private static void OnTuesdayMorning()
{
try
{
@@ -689,22 +691,19 @@ namespace Swarmops.Backend
}
}
- private static void TraceAndReport (Exception e)
+ private static void TraceAndReport(Exception e)
{
TestTrace(" failed.\r\n");
ExceptionMail.Send(e, true);
TestTrace(e.ToString());
}
- private static void TestTrace (string message)
+ private static void TestTrace(string message)
{
if (testMode)
{
Console.Write(message);
}
}
-
-
- private static bool testMode;
}
}
\ No newline at end of file
diff --git a/Backend/Properties/AssemblyInfo.cs b/Backend/Properties/AssemblyInfo.cs
index 7dd20906..4b0d447e 100644
--- a/Backend/Properties/AssemblyInfo.cs
+++ b/Backend/Properties/AssemblyInfo.cs
@@ -6,23 +6,23 @@ using System.Runtime.InteropServices;
// associated with an assembly.
[assembly: AssemblyTitle("Swarmops Backend")]
-[assembly: AssemblyDescription ("")]
-[assembly: AssemblyConfiguration ("")]
-[assembly: AssemblyCompany ("Disorganized")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Disorganized")]
[assembly: AssemblyProduct("Swarmops")]
[assembly: AssemblyCopyright("In Public Domain")]
-[assembly: AssemblyTrademark ("")]
-[assembly: AssemblyCulture ("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible (false)]
+[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid ("948b695d-d8cc-442c-93a1-1e8928c1a5e8")]
+[assembly: Guid("948b695d-d8cc-442c-93a1-1e8928c1a5e8")]
// Version information for an assembly consists of the following four values:
//
@@ -35,5 +35,5 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion ("1.0.0.0")]
-[assembly: AssemblyFileVersion ("1.0.0.0")]
\ No newline at end of file
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
diff --git a/Basic/Config.cs b/Basic/Config.cs
index 5b35e4e0..8fc48a31 100644
--- a/Basic/Config.cs
+++ b/Basic/Config.cs
@@ -5,7 +5,7 @@ namespace Swarmops.Basic
{
public class Config
{
- static public int SmtpPort
+ public static int SmtpPort
{
get
{
@@ -20,7 +20,7 @@ namespace Swarmops.Basic
}
}
- static public string SmtpHost
+ public static string SmtpHost
{
get
{
@@ -35,4 +35,4 @@ namespace Swarmops.Basic
}
}
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Diagnostics/Logging.cs b/Basic/Diagnostics/Logging.cs
index 6953ec64..d7b7cccc 100644
--- a/Basic/Diagnostics/Logging.cs
+++ b/Basic/Diagnostics/Logging.cs
@@ -3,41 +3,41 @@ using System.Diagnostics;
namespace Swarmops.Basic.Diagnostics
{
- public class Logging
- {
- static public void LogError(LogSource source, string message)
- {
- EventLog eventLog = new EventLog();
- eventLog.Source = source.ToString();
- eventLog.WriteEntry(message, EventLogEntryType.Error);
- }
+ public class Logging
+ {
+ public static void LogError(LogSource source, string message)
+ {
+ EventLog eventLog = new EventLog();
+ eventLog.Source = source.ToString();
+ eventLog.WriteEntry(message, EventLogEntryType.Error);
+ }
- static public void LogException(LogSource source, Exception exception)
- {
- LogError(source, exception.ToString());
- }
+ public static void LogException(LogSource source, Exception exception)
+ {
+ LogError(source, exception.ToString());
+ }
- static public void LogWarning(LogSource source, string message)
- {
- EventLog eventLog = new EventLog();
- eventLog.Source = source.ToString();
- eventLog.WriteEntry(message, EventLogEntryType.Warning);
- }
+ public static void LogWarning(LogSource source, string message)
+ {
+ EventLog eventLog = new EventLog();
+ eventLog.Source = source.ToString();
+ eventLog.WriteEntry(message, EventLogEntryType.Warning);
+ }
- static public void LogInformation(LogSource source, string message)
- {
- EventLog eventLog = new EventLog();
- eventLog.Source = source.ToString();
- eventLog.WriteEntry(message, EventLogEntryType.Information);
- }
- }
+ public static void LogInformation(LogSource source, string message)
+ {
+ EventLog eventLog = new EventLog();
+ eventLog.Source = source.ToString();
+ eventLog.WriteEntry(message, EventLogEntryType.Information);
+ }
+ }
- public enum LogSource
- {
- Unknown = 0,
- PirateDb,
- PirateBot,
- PirateWeb,
- PirateLogic
- }
-}
+ public enum LogSource
+ {
+ Unknown = 0,
+ PirateDb,
+ PirateBot,
+ PirateWeb,
+ PirateLogic
+ }
+}
\ No newline at end of file
diff --git a/Basic/Enums/AddressValidationResult.cs b/Basic/Enums/AddressValidationResult.cs
index 39ab7036..bf1165f3 100644
--- a/Basic/Enums/AddressValidationResult.cs
+++ b/Basic/Enums/AddressValidationResult.cs
@@ -1,26 +1,30 @@
namespace Swarmops.Basic
{
- public enum AddressValidationResult
- {
- ///
- /// Unknown or undefined result.
- ///
- Unknown = 0,
- ///
- /// Confirmed valid by remote server.
- ///
- Valid = 1,
- ///
- /// Confirmed invalid by remote server.
- ///
- AccountInvalid = 2,
- ///
- /// Remote server does not respond or exist.
- ///
- ServerInvalid = 3,
- ///
- /// Email address syntax is invalid.
- ///
- BadSyntax = 4
- }
+ public enum AddressValidationResult
+ {
+ ///
+ /// Unknown or undefined result.
+ ///
+ Unknown = 0,
+
+ ///
+ /// Confirmed valid by remote server.
+ ///
+ Valid = 1,
+
+ ///
+ /// Confirmed invalid by remote server.
+ ///
+ AccountInvalid = 2,
+
+ ///
+ /// Remote server does not respond or exist.
+ ///
+ ServerInvalid = 3,
+
+ ///
+ /// Email address syntax is invalid.
+ ///
+ BadSyntax = 4
+ }
}
\ No newline at end of file
diff --git a/Basic/Enums/AutoMailType.cs b/Basic/Enums/AutoMailType.cs
index e8cbad1a..09c65acd 100644
--- a/Basic/Enums/AutoMailType.cs
+++ b/Basic/Enums/AutoMailType.cs
@@ -1,9 +1,9 @@
namespace Swarmops.Basic.Enums
{
- public enum AutoMailType
- {
- Unknown = 0,
- Welcome,
+ public enum AutoMailType
+ {
+ Unknown = 0,
+ Welcome,
MemberMail,
OfficerMail,
Reminder,
@@ -11,6 +11,6 @@ namespace Swarmops.Basic.Enums
Expired,
Newsletter,
PressRelease,
- WelcomeTimeLimitedContent=100 //Not implemented yet..
- }
-}
+ WelcomeTimeLimitedContent = 100 //Not implemented yet..
+ }
+}
\ No newline at end of file
diff --git a/Basic/Enums/CommunicationType.cs b/Basic/Enums/CommunicationType.cs
index 2a322634..d6afa7bb 100644
--- a/Basic/Enums/CommunicationType.cs
+++ b/Basic/Enums/CommunicationType.cs
@@ -3,13 +3,15 @@ namespace Swarmops.Basic.Enums
public enum CommunicationType
{
Unknown = 0,
+
///
- /// Mail to the Press Office for an org
+ /// Mail to the Press Office for an org
///
PressMail,
+
///
- /// General information inquiry
+ /// General information inquiry
///
InformationMail
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Enums/DocumentType.cs b/Basic/Enums/DocumentType.cs
index 4bf8c85c..2c65c3ab 100644
--- a/Basic/Enums/DocumentType.cs
+++ b/Basic/Enums/DocumentType.cs
@@ -3,37 +3,45 @@ namespace Swarmops.Basic.Enums
public enum DocumentType
{
Unknown = 0,
+
///
- /// A photo that can be used to generate on-the-fly stuff, or for press images.
+ /// A photo that can be used to generate on-the-fly stuff, or for press images.
///
PersonPhoto,
+
///
- /// A receipt for an expense. Filed by the expenser.
+ /// A receipt for an expense. Filed by the expenser.
///
ExpenseClaim,
+
///
- /// A document supporting a transaction where assets decrease (invoice, etc).
+ /// A document supporting a transaction where assets decrease (invoice, etc).
///
FinancialTransaction,
+
///
- /// A temporary identity, used while the basis of the document is still being created.
+ /// A temporary identity, used while the basis of the document is still being created.
///
Temporary,
+
///
- /// An inbound invoice, going into accounts payable.
+ /// An inbound invoice, going into accounts payable.
///
InboundInvoice,
+
///
- /// Something physical received in the mail
+ /// Something physical received in the mail
///
PaperLetter,
+
///
- /// A document (contract or else) that creates or modifies the payroll
+ /// A document (contract or else) that creates or modifies the payroll
///
PayrollItem,
+
///
- /// Photo documenting an external activity
+ /// Photo documenting an external activity
///
ExternalActivityPhoto
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Enums/ExternalActivityType.cs b/Basic/Enums/ExternalActivityType.cs
index d4541973..9f36a950 100644
--- a/Basic/Enums/ExternalActivityType.cs
+++ b/Basic/Enums/ExternalActivityType.cs
@@ -12,5 +12,4 @@ namespace Swarmops.Basic.Enums
PressCoverage,
Other
}
-}
-
+}
\ No newline at end of file
diff --git a/Basic/Enums/ExternalIdentityType.cs b/Basic/Enums/ExternalIdentityType.cs
index d2e6efae..94aad90d 100644
--- a/Basic/Enums/ExternalIdentityType.cs
+++ b/Basic/Enums/ExternalIdentityType.cs
@@ -3,18 +3,18 @@ namespace Swarmops.Basic.Enums
public enum ExternalIdentityType
{
///
- /// Unknown
+ /// Unknown
///
- Unknown=0,
- ///
- /// JID on the Pirate Party XMPPServer
- ///
- PPXMPPAccount=1,
- ///
- /// JID on other XMPP
- ///
- ExternalXMPPAccount=2
- }
+ Unknown = 0,
-
-}
+ ///
+ /// JID on the Pirate Party XMPPServer
+ ///
+ PPXMPPAccount = 1,
+
+ ///
+ /// JID on other XMPP
+ ///
+ ExternalXMPPAccount = 2
+ }
+}
\ No newline at end of file
diff --git a/Basic/Enums/FinancialAccountType.cs b/Basic/Enums/FinancialAccountType.cs
index ed35c211..c787ef25 100644
--- a/Basic/Enums/FinancialAccountType.cs
+++ b/Basic/Enums/FinancialAccountType.cs
@@ -3,35 +3,42 @@ namespace Swarmops.Basic.Enums
public enum FinancialAccountType
{
///
- /// Unknown account type.
+ /// Unknown account type.
///
Unknown = 0,
+
///
- /// An asset, such as a bank account. Balance account.
+ /// An asset, such as a bank account. Balance account.
///
Asset = 1,
+
///
- /// A debt, such as unprocessed activist expenses. Balance account.
+ /// A debt, such as unprocessed activist expenses. Balance account.
///
Debt = 2,
+
///
- /// An income, any income. Result account. Received money is negative (sign reversed account).
+ /// An income, any income. Result account. Received money is negative (sign reversed account).
///
Income = 3,
+
///
- /// A cost, any cost. Result account. Spent money is positive (sign reversed account).
+ /// A cost, any cost. Result account. Spent money is positive (sign reversed account).
///
Cost = 4,
+
///
- /// Assets and debts - accounts that keep accumulating over years.
+ /// Assets and debts - accounts that keep accumulating over years.
///
Balance = 5,
+
///
- /// Incomes and costs - accounts that are zeroed at year end. Sign reversed.
+ /// Incomes and costs - accounts that are zeroed at year end. Sign reversed.
///
Result = 6,
+
///
- /// Meta-type which includes all accounts and group labels where applicable
+ /// Meta-type which includes all accounts and group labels where applicable
///
All = 7
}
diff --git a/Basic/Enums/FinancialDependencyType.cs b/Basic/Enums/FinancialDependencyType.cs
index 02be686b..52d15556 100644
--- a/Basic/Enums/FinancialDependencyType.cs
+++ b/Basic/Enums/FinancialDependencyType.cs
@@ -3,47 +3,57 @@ namespace Swarmops.Basic.Enums
public enum FinancialDependencyType
{
///
- /// Unknown dependency
+ /// Unknown dependency
///
Unknown = 0,
+
///
- /// An expense claim, filed by an activist or officer
+ /// An expense claim, filed by an activist or officer
///
ExpenseClaim,
+
///
- /// An invoice, received in the mail
+ /// An invoice, received in the mail
///
InboundInvoice,
+
///
- /// Money leaving the organization, documented after processes
+ /// Money leaving the organization, documented after processes
///
Payout,
+
///
- /// Salary paid to somebody employed or otherwise monthly compensated
+ /// Salary paid to somebody employed or otherwise monthly compensated
///
Salary,
+
///
- /// An outbound invoice, requesting money from another organization
+ /// An outbound invoice, requesting money from another organization
///
OutboundInvoice,
+
///
- /// A group of inbound payments
+ /// A group of inbound payments
///
PaymentGroup,
+
///
- /// A dependency on (another) financial transaction - used for chaining across fiscal years
+ /// A dependency on (another) financial transaction - used for chaining across fiscal years
///
FinancialTransaction,
+
///
- /// A conference or similar event (called 'parley' in lingo)
+ /// A conference or similar event (called 'parley' in lingo)
///
Parley,
+
///
- /// A cash advance (prior payment, rather than doing an expense claim post purchase)
+ /// A cash advance (prior payment, rather than doing an expense claim post purchase)
///
CashAdvance,
+
///
- /// A payback for a previous cash advance
+ /// A payback for a previous cash advance
///
CashAdvancePayback
}
diff --git a/Basic/Enums/FinancialValidationType.cs b/Basic/Enums/FinancialValidationType.cs
index 6319107b..86ab0d38 100644
--- a/Basic/Enums/FinancialValidationType.cs
+++ b/Basic/Enums/FinancialValidationType.cs
@@ -3,27 +3,32 @@ namespace Swarmops.Basic.Enums
public enum FinancialValidationType
{
///
- /// Unknown type.
+ /// Unknown type.
///
Unknown = 0,
+
///
- /// An attestation of an expenditure from a budget.
+ /// An attestation of an expenditure from a budget.
///
Attestation,
+
///
- /// Removal of attested status.
+ /// Removal of attested status.
///
Deattestation,
+
///
- /// Validation of expenditure documents.
+ /// Validation of expenditure documents.
///
Validation,
+
///
- /// Devalidation - removal of validated status.
+ /// Devalidation - removal of validated status.
///
Devalidation,
+
///
- /// Kill: close this financial doc as not valid.
+ /// Kill: close this financial doc as not valid.
///
Kill
}
diff --git a/Basic/Enums/GeographyLevel.cs b/Basic/Enums/GeographyLevel.cs
index 53502ff7..91bda839 100644
--- a/Basic/Enums/GeographyLevel.cs
+++ b/Basic/Enums/GeographyLevel.cs
@@ -3,27 +3,32 @@ namespace Swarmops.Basic.Enums
public enum GeographyLevel
{
///
- /// Unknown level
+ /// Unknown level
///
Unknown = 0,
+
///
- /// Municipality or city level
+ /// Municipality or city level
///
Municipality = 1,
+
///
- /// Electoral circuit - usually 5-15 cities
+ /// Electoral circuit - usually 5-15 cities
///
ElectoralCircuit = 2,
+
///
- /// County - usually same as electoral circuit
+ /// County - usually same as electoral circuit
///
County = 3,
+
///
- /// District - 4-7 districts per state
+ /// District - 4-7 districts per state
///
District = 4,
+
///
- /// State - not necessary for small countries
+ /// State - not necessary for small countries
///
State = 5
}
diff --git a/Basic/Enums/InvalidMembershipType.cs b/Basic/Enums/InvalidMembershipType.cs
index c36fc033..b967ccaf 100644
--- a/Basic/Enums/InvalidMembershipType.cs
+++ b/Basic/Enums/InvalidMembershipType.cs
@@ -3,15 +3,17 @@ namespace Swarmops.Basic.Enums
public enum InvalidMembershipType
{
///
- /// This membership was closed normally.
+ /// This membership was closed normally.
///
Valid = 0,
+
///
- /// This membership was closed because it was a duplicate.
+ /// This membership was closed because it was a duplicate.
///
DuplicateMember = 1,
+
///
- /// This membership was closed because the personae were bogus (like "Mickey Mouse").
+ /// This membership was closed because the personae were bogus (like "Mickey Mouse").
///
PersonDoesNotExist = 2
}
diff --git a/Basic/Enums/MailAuthorType.cs b/Basic/Enums/MailAuthorType.cs
index 3a0989ed..c17cdb30 100644
--- a/Basic/Enums/MailAuthorType.cs
+++ b/Basic/Enums/MailAuthorType.cs
@@ -16,44 +16,43 @@ namespace Swarmops.Basic.Enums
public class FunctionalMail
{
+ public static Dictionary Address = initList();
+
+ public static Dictionary initList()
+ {
+ Dictionary retval = new Dictionary();
+ retval.Add(MailAuthorType.MemberService,
+ new AddressItem("medlemsservice@piratpartiet.se", "Piratpartiet Medlemsservice"));
+ retval.Add(MailAuthorType.PirateWeb, new AddressItem("noreply@pirateweb.net", "PirateWeb"));
+ retval.Add(MailAuthorType.ActivistService,
+ new AddressItem("aktivistservice@piratpartiet.se", "Piratpartiet Aktivistservice"));
+ retval.Add(MailAuthorType.Service, new AddressItem("service@piratpartiet.se", "Piratpartiet Service"));
+ retval.Add(MailAuthorType.PressService, new AddressItem("press@piratpartiet.se", "Piratpartiet Press"));
+ retval.Add(MailAuthorType.Accounting,
+ new AddressItem("accounting@piratpartiet.se", "Piratpartiet Accounting"));
+ return retval;
+ }
+
public class AddressItem
{
- public AddressItem (string email, string name)
+ private readonly string email;
+ private readonly string name;
+
+ public AddressItem(string email, string name)
{
this.email = email;
this.name = name;
}
- private string email;
- private string name;
+
public string Email
{
- get
- {
- return email;
- }
+ get { return this.email; }
}
+
public string Name
{
- get
- {
- return name;
- }
+ get { return this.name; }
}
}
-
- static public Dictionary Address = initList();
- public static Dictionary initList ()
- {
- Dictionary retval = new Dictionary();
- retval.Add(MailAuthorType.MemberService, new AddressItem("medlemsservice@piratpartiet.se", "Piratpartiet Medlemsservice"));
- retval.Add(MailAuthorType.PirateWeb, new AddressItem("noreply@pirateweb.net", "PirateWeb"));
- retval.Add(MailAuthorType.ActivistService, new AddressItem("aktivistservice@piratpartiet.se", "Piratpartiet Aktivistservice"));
- retval.Add(MailAuthorType.Service, new AddressItem("service@piratpartiet.se", "Piratpartiet Service"));
- retval.Add(MailAuthorType.PressService, new AddressItem("press@piratpartiet.se", "Piratpartiet Press"));
- retval.Add(MailAuthorType.Accounting, new AddressItem("accounting@piratpartiet.se", "Piratpartiet Accounting"));
- return retval;
- }
-
-
}
}
\ No newline at end of file
diff --git a/Basic/Enums/MembershipPaymentStatus.cs b/Basic/Enums/MembershipPaymentStatus.cs
index 9092f0cb..9aa44386 100644
--- a/Basic/Enums/MembershipPaymentStatus.cs
+++ b/Basic/Enums/MembershipPaymentStatus.cs
@@ -1,41 +1,46 @@
namespace Swarmops.Basic.Enums
{
///
- /// For handling of membership fee payment
- /// Also used for marking of accepted memberships for PPFI
+ /// For handling of membership fee payment
+ /// Also used for marking of accepted memberships for PPFI
///
public enum MembershipPaymentStatus
{
///
- /// Undefined
+ /// Undefined
///
Unknown = 0,
+
///
- /// Newly registered
+ /// Newly registered
///
NewlyRegistered = 1,
+
///
- /// Membership accepted, used as bit flag
+ /// Membership accepted, used as bit flag
///
MembershipAccepted = 2,
+
///
- /// Due for payment, to be used if payments are
+ /// Due for payment, to be used if payments are
///
DueForNewPayment = 3,
+
///
- /// Has been listed to receive notice of payment
- /// to be used if the sending out of payments is a manual process
- /// just to stop them being listed as Due for payment again
+ /// Has been listed to receive notice of payment
+ /// to be used if the sending out of payments is a manual process
+ /// just to stop them being listed as Due for payment again
///
ListedForPayment = 4,
+
///
- /// Notice of payment have been sent
+ /// Notice of payment have been sent
///
PaymentRequested = 5,
+
///
- /// Payment have been recieved
+ /// Payment have been recieved
///
PaymentRecieved = 6
-
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Enums/ObjectOptionalDataType.cs b/Basic/Enums/ObjectOptionalDataType.cs
index 91d9aa91..c50ab4d9 100644
--- a/Basic/Enums/ObjectOptionalDataType.cs
+++ b/Basic/Enums/ObjectOptionalDataType.cs
@@ -1,6 +1,5 @@
namespace Swarmops.Basic.Enums
{
-
public enum ObjectType
{
Unknown = 0,
@@ -14,227 +13,277 @@ namespace Swarmops.Basic.Enums
public enum ObjectOptionalDataType
{
Unknown = 0,
+
///
- /// The personal number (or equivalent) of somebody. In SE, this is a ten digit number.
+ /// The personal number (or equivalent) of somebody. In SE, this is a ten digit number.
///
PersonalNumber,
+
///
- /// If a particular person is invisible to all officers.
+ /// If a particular person is invisible to all officers.
///
Anonymous,
+
///
- /// ?
+ /// ?
///
CustomEmail,
+
///
- /// If somebody should never ever be mailed for any reason.
+ /// If somebody should never ever be mailed for any reason.
///
NeverMail,
+
///
- /// The account id of the (currently just Swedish) forum.
+ /// The account id of the (currently just Swedish) forum.
///
ForumAccountId,
+
///
- /// Name of a bank.
+ /// Name of a bank.
///
BankName,
+
///
- /// Clearing number of a bank, usually four digits.
+ /// Clearing number of a bank, usually four digits.
///
BankClearing,
+
///
- /// Account number of a bank. Does NOT include clearing number.
+ /// Account number of a bank. Does NOT include clearing number.
///
BankAccount,
+
///
- /// The party email account of a person.
+ /// The party email account of a person.
///
PartyEmail,
+
///
- /// Whether this entity is unreachable by mail.
+ /// Whether this entity is unreachable by mail.
///
MailUnreachable,
+
///
- /// Whether this entity wants mail in text-only format.
+ /// Whether this entity wants mail in text-only format.
///
LimitMailToText,
+
///
- /// Whether this entity wants mail in ISO-8859-1 (as opposed to UTF-8).
+ /// Whether this entity wants mail in ISO-8859-1 (as opposed to UTF-8).
///
LimitMailToLatin1,
+
///
- /// ?
+ /// ?
///
ResetPasswordTicket,
+
///
- /// Not sure how this is used
+ /// Not sure how this is used
///
EMailIsInvalid,
+
///
- /// The name of the photographer, if the person has a photo (Document type)
+ /// The name of the photographer, if the person has a photo (Document type)
///
PortraitPhotographer,
+
///
- /// A flag that this Person should be manually inspected
+ /// A flag that this Person should be manually inspected
///
AccountDetailsSuspect,
// ReSharper disable InconsistentNaming
///
- /// T-shirt size as indicated by Person
+ /// T-shirt size as indicated by Person
///
TShirtSize,
// ReSharper restore InconsistentNaming
///
- /// Name of a blog in cleartext
+ /// Name of a blog in cleartext
///
BlogName,
+
///
- /// Url of a blog, including preceding http://
+ /// Url of a blog, including preceding http://
///
BlogUrl,
+
///
- /// Public key in PGP Armor format.
+ /// Public key in PGP Armor format.
///
CryptoPublicKey,
+
///
- /// Secret AND public keypair in PGP Armor format.
+ /// Secret AND public keypair in PGP Armor format.
///
CryptoSecretKey,
+
///
- /// Revocation certificate for a public key. Do not use until time for revocation.
+ /// Revocation certificate for a public key. Do not use until time for revocation.
///
CryptoRevocation,
+
///
- /// Fingerprint of a crypto key, in format "ABCD 0123 4567..."
+ /// Fingerprint of a crypto key, in format "ABCD 0123 4567..."
///
CryptoFingerprint,
+
///
- /// Geography of an account
+ /// Geography of an account
///
GeographyId,
+
///
- /// Transaction tag for a donation to go to a particular account
+ /// Transaction tag for a donation to go to a particular account
///
BankTransactionTag,
+
///
- /// The account name of the (currently just Swedish) forum.
+ /// The account name of the (currently just Swedish) forum.
///
ForumAccountName,
+
///
- /// The preferred culture (for translations etc) eg. sv-SE
+ /// The preferred culture (for translations etc) eg. sv-SE
///
PreferredCulture,
+
///
- /// List of functional mail addresses for organization
+ /// List of functional mail addresses for organization
///
OrgFunctionalMail,
+
///
- /// A temporary place to store password hash until membership confirmed (for PPFI)
+ /// A temporary place to store password hash until membership confirmed (for PPFI)
///
PersonTempPasswordStore,
+
///
- /// Flag to indicate if officer notifications are allowed to contain member names (for PPFI)
+ /// Flag to indicate if officer notifications are allowed to contain member names (for PPFI)
///
OrgShowNamesInNotifications,
+
///
- /// Flag to indicate if organisation is using PaymentStatus (for PPFI)
+ /// Flag to indicate if organisation is using PaymentStatus (for PPFI)
///
OrgUsePaymentStatus,
+
///
- /// Organizations: If the org has PW do bookkeeping
+ /// Organizations: If the org has PW do bookkeeping
///
OrgEconomyEnabled,
+
///
- /// The highest year for which fiscal books are closed, or 0 for never
+ /// The highest year for which fiscal books are closed, or 0 for never
///
OrgBooksClosedForYear,
+
///
- /// The last year for which fiscal books have been audited, or 0 for never
+ /// The last year for which fiscal books have been audited, or 0 for never
///
OrgBooksAuditedForYear,
+
///
- /// Bank account for an organization's tax payments
+ /// Bank account for an organization's tax payments
///
OrgTaxAccount,
+
///
- /// OCR sequence on tax payments (to the tax account) for an organization
+ /// OCR sequence on tax payments (to the tax account) for an organization
///
OrgTaxOcr,
+
///
- /// True if the organization declares inbound/outbound Value Added Tax
+ /// True if the organization declares inbound/outbound Value Added Tax
///
OrgValueAddedTaxEnabled,
OrgFinancialMailName,
OrgFinancialMailAddress,
+
///
- /// If invoice is credited, this is the credit invoice id (normative)
+ /// If invoice is credited, this is the credit invoice id (normative)
///
OutboundInvoiceCreditedWithInvoice,
+
///
- /// This is a credit invoice, crediting this other invoice (informative)
+ /// This is a credit invoice, crediting this other invoice (informative)
///
OutboundInvoiceCreditsInvoice,
+
///
- /// If invoice is to a person id, this is the person id
+ /// If invoice is to a person id, this is the person id
///
OutboundInvoiceToPersonId,
+
///
- /// If "1", this financial account may be charged for conferences
+ /// If "1", this financial account may be charged for conferences
///
FinancialAccountEnabledForConferences,
+
///
- /// If "1", this financial account may be charged with expenses
+ /// If "1", this financial account may be charged with expenses
///
FinancialAccountEnabledForExpensing,
+
///
- /// If "1", this financial account may be charged with invoices
+ /// If "1", this financial account may be charged with invoices
///
FinancialAccountEnabledForInvoicing,
+
///
- /// Organization's operations currency, stored as currency code
+ /// Organization's operations currency, stored as currency code
///
OrgCurrency,
+
///
- /// First bookkeeping year of org in Swarmops (can set inbound balances for this year only)
+ /// First bookkeeping year of org in Swarmops (can set inbound balances for this year only)
///
OrgFirstFiscalYear,
+
///
- /// Temporary mechanism for the Swarmops Red release: a coarse access list (read/write access)
+ /// Temporary mechanism for the Swarmops Red release: a coarse access list (read/write access)
///
OrgTemporaryAccessListWrite,
+
///
- /// Temporary mechanism for the Swarmops Red release: a coarse access list (read-only access)
+ /// Temporary mechanism for the Swarmops Red release: a coarse access list (read-only access)
///
OrgTemporaryAccessListRead,
+
///
- /// Free-text description of an inbound invoice (what's it for?)
+ /// Free-text description of an inbound invoice (what's it for?)
///
InboundInvoiceDescription,
+
///
- /// Geopos - longitude. Float in degrees. Positive is north.
+ /// Geopos - longitude. Float in degrees. Positive is north.
///
Longitude,
+
///
- /// Geopos - latitude. Float in degrees. Positive is east.
+ /// Geopos - latitude. Float in degrees. Positive is east.
///
Latitude,
+
///
- /// A National ID number, if any. Like US SSN.
+ /// A National ID number, if any. Like US SSN.
///
NationalIdNumber,
+
///
- /// What are ordinary people called in this org?
+ /// What are ordinary people called in this org?
///
OrgRegularLabel,
+
///
- /// What are activists called in this org?
+ /// What are activists called in this org?
///
OrgActivistLabel,
+
///
- /// For a person, the BitId address they use to login
+ /// For a person, the BitId address they use to login
///
BitIdLoginAddress
}
-
-}
-
+}
\ No newline at end of file
diff --git a/Basic/Enums/OrganizationFinancialAccountType.cs b/Basic/Enums/OrganizationFinancialAccountType.cs
index 260edce1..75c14af9 100644
--- a/Basic/Enums/OrganizationFinancialAccountType.cs
+++ b/Basic/Enums/OrganizationFinancialAccountType.cs
@@ -3,116 +3,143 @@
public enum OrganizationFinancialAccountType
{
///
- /// Undefined
+ /// Undefined
///
Unknown,
+
///
- /// Main bank transaction account - not a savings account or similar
+ /// Main bank transaction account - not a savings account or similar
///
AssetsBankAccountMain,
+
///
- /// The account where outbound invoices are kept
+ /// The account where outbound invoices are kept
///
AssetsOutboundInvoices,
+
///
- /// If org has a PayPal account, this is where is goes
+ /// If org has a PayPal account, this is where is goes
///
AssetsPaypal,
+
///
- /// Assets held in bitcoin (if any), immediately accessible.
+ /// Assets held in bitcoin (if any), immediately accessible.
///
AssetsBitcoinHot,
+
///
- /// Assets held in bitcoin cold storage (if any).
+ /// Assets held in bitcoin cold storage (if any).
///
AssetsBitcoinCold,
+
///
- /// Any outstanding cash advances that have been paid out and not cleared against receipts or paid back
+ /// Any outstanding cash advances that have been paid out and not cleared against receipts or paid back
///
AssetsOutstandingCashAdvances,
+
///
- /// Value Added Tax (inbound) that hasn't been declared yet and put on overall tax balance
+ /// Value Added Tax (inbound) that hasn't been declared yet and put on overall tax balance
///
AssetsVatInbound,
+
///
- /// If virtual banking is enabled, this is where the virtual assets go
+ /// If virtual banking is enabled, this is where the virtual assets go
///
AssetsVirtualBanking,
+
///
- /// Any expense claims on the organization that have not been paid back
+ /// Any expense claims on the organization that have not been paid back
///
DebtsExpenseClaims,
+
///
- /// Invoices sent to the organization until paid against bank account
+ /// Invoices sent to the organization until paid against bank account
///
DebtsInboundInvoices,
+
///
- /// Salaries due for payout until cleared against bank account
+ /// Salaries due for payout until cleared against bank account
///
DebtsSalary,
+
///
- /// Taxes due for payout until cleared against bank account
+ /// Taxes due for payout until cleared against bank account
///
DebtsTax,
+
///
- /// Equity - the difference between debt and assets
+ /// Equity - the difference between debt and assets
///
DebtsEquity,
+
///
- /// Undeclared Value Added Tax (outbound) before putting it on tax balance
+ /// Undeclared Value Added Tax (outbound) before putting it on tax balance
///
DebtsVatOutbound,
+
///
- /// If virtual banking is enabled, this is the central debt to local assets
+ /// If virtual banking is enabled, this is the central debt to local assets
///
DebtsEarmarkedVirtualBanking,
+
///
- /// Earmarked assets in other ways
+ /// Earmarked assets in other ways
///
DebtsEarmarkedOtherAssets,
+
///
- /// Other debts in general
+ /// Other debts in general
///
DebtsOther,
+
///
- /// Income from sales - default outbound invoices to this acct
+ /// Income from sales - default outbound invoices to this acct
///
IncomeSales,
+
///
- /// Income from donations - default autodonates here
+ /// Income from donations - default autodonates here
///
IncomeDonations,
+
///
- /// Bank fees - default small minus posts on bank statements here
+ /// Bank fees - default small minus posts on bank statements here
///
CostsBankFees,
+
///
- /// Gains from currency fluctuation (typically bitcoin or altcoins).
+ /// Gains from currency fluctuation (typically bitcoin or altcoins).
///
IncomeCurrencyFluctuations,
+
///
- /// IT and such - default SMS charges, etc, here
+ /// IT and such - default SMS charges, etc, here
///
CostsInfrastructure,
+
///
- /// If virtual banking is enabled, this is a counterbalance account
+ /// If virtual banking is enabled, this is a counterbalance account
///
CostsLocalDonationTransfers,
+
///
- /// No description
+ /// No description
///
CostsAllocatedFunds,
+
///
- /// Losses from currency fluctuation (typically bitcoin or altcoins).
+ /// Losses from currency fluctuation (typically bitcoin or altcoins).
///
CostsCurrencyFluctuations,
+
///
- /// Various bookkeeping errors
+ /// Various bookkeeping errors
///
CostsMiscalculations,
+
///
- /// When closing books, this is the yearly result (balanced against DebtsEquity)
+ /// When closing books, this is the yearly result (balanced against DebtsEquity)
///
CostsYearlyResult, // multi-account type
};
-}
+}
\ No newline at end of file
diff --git a/Basic/Enums/OutboundCommPriority.cs b/Basic/Enums/OutboundCommPriority.cs
index 45d57f84..36f843a6 100644
--- a/Basic/Enums/OutboundCommPriority.cs
+++ b/Basic/Enums/OutboundCommPriority.cs
@@ -3,33 +3,40 @@
public enum OutboundCommPriority
{
Unknown = 0,
+
///
- /// Priority 1 of 7 (highest).
+ /// Priority 1 of 7 (highest).
///
Highest = 32,
+
///
- /// Priority 2 of 7 (second highest).
+ /// Priority 2 of 7 (second highest).
///
High = 64,
+
///
- /// Priority 3 of 7 (just above normal priority).
+ /// Priority 3 of 7 (just above normal priority).
///
Elevated = 96,
+
///
- /// Priority 4 of 7 (normal and default).
+ /// Priority 4 of 7 (normal and default).
///
Normal = 128,
+
///
- /// Priority 5 of 7 (just below normal priority).
+ /// Priority 5 of 7 (just below normal priority).
///
Lowered = 160,
+
///
- /// Priority 6 of 7 (second lowest).
+ /// Priority 6 of 7 (second lowest).
///
Low = 192,
+
///
- /// Priority 7 of 7 (lowest).
+ /// Priority 7 of 7 (lowest).
///
Lowest = 224
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Enums/PermissionEnum.cs b/Basic/Enums/PermissionEnum.cs
index 1648e7a6..f233ed63 100644
--- a/Basic/Enums/PermissionEnum.cs
+++ b/Basic/Enums/PermissionEnum.cs
@@ -3,7 +3,7 @@ namespace Swarmops.Basic.Enums
public enum Permission
{
///
- /// Undefined.
+ /// Undefined.
///
Undefined = 0,
CanSeeSelf,
diff --git a/Basic/Enums/PersonOptionalDataKey.cs b/Basic/Enums/PersonOptionalDataKey.cs
index 30adb12f..f2f8f549 100644
--- a/Basic/Enums/PersonOptionalDataKey.cs
+++ b/Basic/Enums/PersonOptionalDataKey.cs
@@ -25,6 +25,5 @@ namespace Swarmops.Basic.Enums
CryptoSecret,
CryptoRevocation,
CryptoFingerprint
-
}
}
\ No newline at end of file
diff --git a/Basic/Enums/RoleTypeClass.cs b/Basic/Enums/RoleTypeClass.cs
index 3fb75335..59d96bf8 100644
--- a/Basic/Enums/RoleTypeClass.cs
+++ b/Basic/Enums/RoleTypeClass.cs
@@ -4,118 +4,142 @@ using System.Collections.Generic;
namespace Swarmops.Basic.Enums
{
///
- /// RoleTypes.
- /// Important that the number corresponds
- /// to RoleTypeId in database since roles are stored referencing
- /// id rather than name.
- ///
- /// Add new roles at the end, and create corresponding record in db.
+ /// RoleTypes.
+ /// Important that the number corresponds
+ /// to RoleTypeId in database since roles are stored referencing
+ /// id rather than name.
+ /// Add new roles at the end, and create corresponding record in db.
///
public enum RoleType
{
///
- /// Undefined
+ /// Undefined
///
Unknown = 0,
+
///
- /// The primary contact for a geographical node in an organization
+ /// The primary contact for a geographical node in an organization
///
LocalLead = 1,
+
///
- /// The secondary contact for a geographical node in an organization
+ /// The secondary contact for a geographical node in an organization
///
LocalDeputy = 2,
+
///
- /// OBSOLETE - DO NOT USE
+ /// OBSOLETE - DO NOT USE
///
LocalActive = 3,
+
///
- /// Non-public role - full access to organization's node
+ /// Non-public role - full access to organization's node
///
LocalAdmin = 4,
+
///
- /// Public role - PoC for org and can perform any task on the org in the system
+ /// Public role - PoC for org and can perform any task on the org in the system
///
OrganizationChairman = 5,
+
///
- /// Treasurers in an org can approve and manage expenses
+ /// Treasurers in an org can approve and manage expenses
///
OrganizationTreasurer = 6,
+
///
- /// Public role - for display / PoC purposes only
+ /// Public role - for display / PoC purposes only
///
OrganizationBoardMember = 7,
+
///
- /// Public role - for display / PoC purposes only
+ /// Public role - for display / PoC purposes only
///
OrganizationSecretary = 8,
+
///
- /// Non-public role for people who do administrative work
+ /// Non-public role for people who do administrative work
///
OrganizationAdmin = 9,
+
///
- /// Non-public role - full access to entire PirateWeb
+ /// Non-public role - full access to entire PirateWeb
///
SystemAdmin = 10,
+
///
- /// Non-public role - editor of the geography tree (at a certain geo and below)
+ /// Non-public role - editor of the geography tree (at a certain geo and below)
///
SystemGeographyEditor = 11,
+
///
- /// Non-public role - a member/nonmember who has full access to the organization
+ /// Non-public role - a member/nonmember who has full access to the organization
///
OrganizationAuditor = 12,
+
///
- /// A deputy board member of an org
+ /// A deputy board member of an org
///
OrganizationBoardDeputy = 13,
+
///
- /// First vice chairman
+ /// First vice chairman
///
OrganizationVice1 = 14,
+
///
- /// Second vice chairman
+ /// Second vice chairman
///
OrganizationVice2 = 15,
+
///
- /// This Role is assigned to Memberservice administrators
+ /// This Role is assigned to Memberservice administrators
///
OrganizationMemberService = 17,
+
///
- /// This Role is assigned to Memberservice administrators, extra permissions
+ /// This Role is assigned to Memberservice administrators, extra permissions
///
OrganizationMemberServiceLead = 18,
+
///
- /// Role assigned to elected representatives, mostly for admin purposes. No intrinsic rights.
+ /// Role assigned to elected representatives, mostly for admin purposes. No intrinsic rights.
///
OrganizationElectedRepresentative = 19,
+
///
- /// A role that everybody has, although it is not set in the database on every person.
- /// Letters may be sent to people in this role, in which case they are private. No intrinsic rights.
+ /// A role that everybody has, although it is not set in the database on every person.
+ /// Letters may be sent to people in this role, in which case they are private. No intrinsic rights.
///
PrivateIndividual = 20,
+
///
- /// A person who can upload paper documents, like letters/invoices, but not access members.
+ /// A person who can upload paper documents, like letters/invoices, but not access members.
///
OrganizationClerk = 21,
+
///
- /// A person who can see and manage all of the economy, but not member registry.
+ /// A person who can see and manage all of the economy, but not member registry.
///
OrganizationEconomyAssistant = 22,
+
///
- /// An elected meeting official, to be assigned temporarily during a meeting
+ /// An elected meeting official, to be assigned temporarily during a meeting
///
OrganizationMeetingOfficial = 23,
+
///
- /// The board's secretary. Not the same as the org's secretary.
+ /// The board's secretary. Not the same as the org's secretary.
///
OrganizationBoardSecretary = 24,
+
///
- /// Role for non officers helping with ballot distribution etc
+ /// Role for non officers helping with ballot distribution etc
///
LocalElectionSupport = 25,
+
///
- /// Temporary - Jörgen added this; the whole enum is deprecated anyway; added for compatibility with v4
+ /// Temporary - Jörgen added this; the whole enum is deprecated anyway; added for compatibility with v4
///
OrganizationMailSender
}
@@ -124,67 +148,77 @@ namespace Swarmops.Basic.Enums
public enum RoleClass
{
///
- /// Undefined
+ /// Undefined
///
Undefined = 0,
+
///
- /// System-wide privileges and responsibilities
+ /// System-wide privileges and responsibilities
///
System,
+
///
- /// Roles for an entire organization
+ /// Roles for an entire organization
///
Organization,
+
///
- /// Roles and responsibilities to a node in an organization
+ /// Roles and responsibilities to a node in an organization
///
Local,
+
///
- /// Roles that are org-agnostic but are tied to a geo node
+ /// Roles that are org-agnostic but are tied to a geo node
///
Geographic
}
public class RoleTypes
{
- static public readonly RoleType[] AllLocalRoleTypes = new RoleType[]
- { RoleType.LocalLead,
- RoleType.LocalDeputy,
- RoleType.LocalActive,
- RoleType.LocalAdmin,
- RoleType.LocalElectionSupport };
-
- static public readonly RoleType[] AllOrganizationalRoleTypes = new RoleType[]
- { RoleType.OrganizationChairman,
- RoleType.OrganizationVice1,
- RoleType.OrganizationVice2,
- RoleType.OrganizationTreasurer,
- RoleType.OrganizationSecretary,
- RoleType.OrganizationBoardMember,
- RoleType.OrganizationBoardDeputy,
- RoleType.OrganizationAdmin,
- RoleType.OrganizationClerk,
- RoleType.OrganizationAuditor,
- RoleType.OrganizationMemberService,
- RoleType.OrganizationMemberServiceLead,
- RoleType.OrganizationElectedRepresentative,
- RoleType.OrganizationEconomyAssistant,
- RoleType.OrganizationMeetingOfficial,
- RoleType.OrganizationBoardSecretary };
-
- static public readonly RoleType[] AllSystemRoleTypes = new RoleType[]
- { RoleType.SystemAdmin,
- RoleType.SystemGeographyEditor };
-
- static public readonly RoleType[] AllRoleTypes = CreateAllRoleTypes();
-
- private static RoleType[] CreateAllRoleTypes ()
+ public static readonly RoleType[] AllLocalRoleTypes =
{
- List retList=new List();
+ RoleType.LocalLead,
+ RoleType.LocalDeputy,
+ RoleType.LocalActive,
+ RoleType.LocalAdmin,
+ RoleType.LocalElectionSupport
+ };
+
+ public static readonly RoleType[] AllOrganizationalRoleTypes =
+ {
+ RoleType.OrganizationChairman,
+ RoleType.OrganizationVice1,
+ RoleType.OrganizationVice2,
+ RoleType.OrganizationTreasurer,
+ RoleType.OrganizationSecretary,
+ RoleType.OrganizationBoardMember,
+ RoleType.OrganizationBoardDeputy,
+ RoleType.OrganizationAdmin,
+ RoleType.OrganizationClerk,
+ RoleType.OrganizationAuditor,
+ RoleType.OrganizationMemberService,
+ RoleType.OrganizationMemberServiceLead,
+ RoleType.OrganizationElectedRepresentative,
+ RoleType.OrganizationEconomyAssistant,
+ RoleType.OrganizationMeetingOfficial,
+ RoleType.OrganizationBoardSecretary
+ };
+
+ public static readonly RoleType[] AllSystemRoleTypes =
+ {
+ RoleType.SystemAdmin,
+ RoleType.SystemGeographyEditor
+ };
+
+ public static readonly RoleType[] AllRoleTypes = CreateAllRoleTypes();
+
+ private static RoleType[] CreateAllRoleTypes()
+ {
+ List retList = new List();
retList.AddRange(AllOrganizationalRoleTypes);
retList.AddRange(AllSystemRoleTypes);
retList.AddRange(AllLocalRoleTypes);
- foreach(RoleType rt in Enum.GetValues(typeof(RoleType)))
+ foreach (RoleType rt in Enum.GetValues(typeof (RoleType)))
{
if (!retList.Contains(rt))
retList.Add(rt);
@@ -193,7 +227,7 @@ namespace Swarmops.Basic.Enums
return retList.ToArray();
}
- static public RoleClass ClassOfRole (RoleType r)
+ public static RoleClass ClassOfRole(RoleType r)
{
if (Array.IndexOf(AllLocalRoleTypes, r) > -1)
return RoleClass.Local;
diff --git a/Basic/Interfaces/IHandleProvider.cs b/Basic/Interfaces/IHandleProvider.cs
index 465bbf97..02cad426 100644
--- a/Basic/Interfaces/IHandleProvider.cs
+++ b/Basic/Interfaces/IHandleProvider.cs
@@ -5,11 +5,11 @@ namespace Swarmops.Basic.Interfaces
{
public interface IHandleProvider
{
- string GetPersonHandle (int personId);
- void SetPersonHandle (int personId, string newHandle);
- HandleErrorType CanSetHandle (string newHandle);
+ string GetPersonHandle(int personId);
+ void SetPersonHandle(int personId, string newHandle);
+ HandleErrorType CanSetHandle(string newHandle);
- int GetPersonByHandle (string handle);
+ int GetPersonByHandle(string handle);
}
}
@@ -28,26 +28,24 @@ namespace Swarmops.Basic.Exceptions
{
public class HandleException : Exception
{
- public HandleException (string attemptedHandle, HandleErrorType errorType)
+ private readonly string attemptedHandle;
+ private readonly HandleErrorType errorType;
+
+ public HandleException(string attemptedHandle, HandleErrorType errorType)
{
this.attemptedHandle = attemptedHandle;
this.errorType = errorType;
}
+ public HandleErrorType ErrorType
+ {
+ get { return this.errorType; }
+ }
public override string ToString()
{
- return "HandleException: Handle '" + attemptedHandle + "' caused '" + errorType.ToString() + "'.\r\n" +
+ return "HandleException: Handle '" + this.attemptedHandle + "' caused '" + this.errorType + "'.\r\n" +
base.ToString();
}
-
-
- public HandleErrorType ErrorType
- {
- get { return errorType; }
- }
-
- private readonly string attemptedHandle;
- private readonly HandleErrorType errorType;
}
}
\ No newline at end of file
diff --git a/Basic/Interfaces/IHasIdentities.cs b/Basic/Interfaces/IHasIdentities.cs
index 11cc8d04..21f6cfd5 100644
--- a/Basic/Interfaces/IHasIdentities.cs
+++ b/Basic/Interfaces/IHasIdentities.cs
@@ -4,4 +4,4 @@ namespace Swarmops.Basic.Interfaces
{
int[] Identities { get; }
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Properties/AssemblyInfo.cs b/Basic/Properties/AssemblyInfo.cs
index 4b4c19b6..b0fe2384 100644
--- a/Basic/Properties/AssemblyInfo.cs
+++ b/Basic/Properties/AssemblyInfo.cs
@@ -6,14 +6,14 @@ using System.Reflection;
// associated with an assembly.
//
-[assembly: AssemblyTitle ("PirateWeb Type Library")]
-[assembly: AssemblyDescription ("")]
-[assembly: AssemblyConfiguration ("")]
-[assembly: AssemblyCompany ("")]
-[assembly: AssemblyProduct ("")]
-[assembly: AssemblyCopyright ("")]
-[assembly: AssemblyTrademark ("")]
-[assembly: AssemblyCulture ("")]
+[assembly: AssemblyTitle("PirateWeb Type Library")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
@@ -26,7 +26,7 @@ using System.Reflection;
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion ("1.0.*")]
+[assembly: AssemblyVersion("1.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
@@ -54,6 +54,6 @@ using System.Reflection;
// documentation for more information on this.
//
-[assembly: AssemblyDelaySign (false)]
-[assembly: AssemblyKeyFile ("")]
-[assembly: AssemblyKeyName ("")]
\ No newline at end of file
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
+[assembly: AssemblyKeyName("")]
\ No newline at end of file
diff --git a/Basic/Strings.cs b/Basic/Strings.cs
index c7e72853..18df4b63 100644
--- a/Basic/Strings.cs
+++ b/Basic/Strings.cs
@@ -1,3 +1,5 @@
+using System.IO;
+
namespace Swarmops.Basic
{
public class Strings
@@ -6,14 +8,11 @@ namespace Swarmops.Basic
{
get
{
- if (System.IO.Path.DirectorySeparatorChar == '/')
+ if (Path.DirectorySeparatorChar == '/')
{
return "PirateWeb";
}
- else
- {
- return "PirateWeb-W";
- }
+ return "PirateWeb-W";
}
}
diff --git a/Basic/Types/BasicAddressValidationRun.cs b/Basic/Types/BasicAddressValidationRun.cs
index 97c4be30..3915ea01 100644
--- a/Basic/Types/BasicAddressValidationRun.cs
+++ b/Basic/Types/BasicAddressValidationRun.cs
@@ -4,13 +4,13 @@ namespace Swarmops.Basic.Types
{
public class BasicAddressValidationRun : IHasIdentity
{
- public BasicAddressValidationRun (int validationRunId)
+ private readonly int validationRunId;
+
+ public BasicAddressValidationRun(int validationRunId)
{
this.validationRunId = validationRunId;
}
- private readonly int validationRunId;
-
public int Identity
{
get { return this.validationRunId; }
diff --git a/Basic/Types/BasicBallot.cs b/Basic/Types/BasicBallot.cs
index bc3427f8..88e2fe14 100644
--- a/Basic/Types/BasicBallot.cs
+++ b/Basic/Types/BasicBallot.cs
@@ -2,21 +2,24 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicBallot: IHasIdentity
+ public class BasicBallot : IHasIdentity
{
- public BasicBallot (int ballotId, int electionId, int organizationId, int geographyId, string name, int count, string deliveryAddress)
+ public BasicBallot(int ballotId, int electionId, int organizationId, int geographyId, string name, int count,
+ string deliveryAddress)
{
- this.BallotId = ballotId;
- this.ElectionId = electionId;
- this.OrganizationId = organizationId;
- this.GeographyId = geographyId;
- this.Name = name;
- this.Count = count;
- this.DeliveryAddress = deliveryAddress;
+ BallotId = ballotId;
+ ElectionId = electionId;
+ OrganizationId = organizationId;
+ GeographyId = geographyId;
+ Name = name;
+ Count = count;
+ DeliveryAddress = deliveryAddress;
}
- public BasicBallot (BasicBallot original)
- :this (original.BallotId, original.ElectionId, original.OrganizationId, original.GeographyId, original.Name, original.Count, original.DeliveryAddress)
+ public BasicBallot(BasicBallot original)
+ : this(
+ original.BallotId, original.ElectionId, original.OrganizationId, original.GeographyId, original.Name,
+ original.Count, original.DeliveryAddress)
{
// empty copy ctor
}
@@ -28,9 +31,10 @@ namespace Swarmops.Basic.Types
public string Name { get; private set; }
public int Count { get; protected set; }
public string DeliveryAddress { get; protected set; }
+
public int Identity
{
- get { return this.BallotId; }
+ get { return BallotId; }
}
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicChurnDataPoint.cs b/Basic/Types/BasicChurnDataPoint.cs
index 4860d3d5..ae7c816d 100644
--- a/Basic/Types/BasicChurnDataPoint.cs
+++ b/Basic/Types/BasicChurnDataPoint.cs
@@ -6,12 +6,14 @@ namespace Swarmops.Basic.Enums
public enum ChurnDataType
{
Unknown = 0,
+
///
- /// The member churned (dropped out, left).
+ /// The member churned (dropped out, left).
///
Churn,
+
///
- /// The member remained in the organization (renewed).
+ /// The member remained in the organization (renewed).
///
Retention
}
@@ -21,8 +23,14 @@ namespace Swarmops.Basic.Types
{
public class BasicChurnDataPoint
{
- public BasicChurnDataPoint (ChurnDataType dataType, DateTime decisionDateTime, DateTime expiryDate,
- int personId, int organizationId)
+ public readonly ChurnDataType DataType;
+ public readonly DateTime DecisionDateTime;
+ public readonly DateTime ExpiryDate;
+ public readonly int OrganizationId;
+ public readonly int PersonId;
+
+ public BasicChurnDataPoint(ChurnDataType dataType, DateTime decisionDateTime, DateTime expiryDate,
+ int personId, int organizationId)
{
this.DataType = dataType;
this.DecisionDateTime = decisionDateTime;
@@ -31,17 +39,11 @@ namespace Swarmops.Basic.Types
this.OrganizationId = organizationId;
}
- public BasicChurnDataPoint (BasicChurnDataPoint original) :
+ public BasicChurnDataPoint(BasicChurnDataPoint original) :
this(
original.DataType, original.DecisionDateTime, original.ExpiryDate, original.PersonId,
original.OrganizationId)
{
}
-
- public readonly ChurnDataType DataType;
- public readonly DateTime DecisionDateTime;
- public readonly DateTime ExpiryDate;
- public readonly int OrganizationId;
- public readonly int PersonId;
}
}
\ No newline at end of file
diff --git a/Basic/Types/BasicCity.cs b/Basic/Types/BasicCity.cs
index bf7cf3b7..ccb1ed5f 100644
--- a/Basic/Types/BasicCity.cs
+++ b/Basic/Types/BasicCity.cs
@@ -6,20 +6,20 @@ namespace Swarmops.Basic.Types
[Serializable]
public class BasicCity : IHasIdentity
{
- public BasicCity (int cityId, string name, int countryId, int geographyId)
+ public BasicCity(int cityId, string name, int countryId, int geographyId)
{
- this.CityId = cityId;
- this.Name = name;
- this.CountryId = countryId;
- this.GeographyId = geographyId;
+ CityId = cityId;
+ Name = name;
+ CountryId = countryId;
+ GeographyId = geographyId;
}
- public BasicCity (BasicCity original)
+ public BasicCity(BasicCity original)
: this(original.CityId, original.Name, original.CountryId, original.GeographyId)
{
}
- [Obsolete ("Do not call this ctor directly. It exists to enable serialization.", true)]
+ [Obsolete("Do not call this ctor directly. It exists to enable serialization.", true)]
public BasicCity()
{
// this ctor should never be called from code
@@ -30,12 +30,11 @@ namespace Swarmops.Basic.Types
public int CountryId { get; protected set; }
public int GeographyId { get; protected set; }
-
#region IHasIdentity Members
public int Identity
{
- get { return this.CityId; }
+ get { return CityId; }
}
#endregion
diff --git a/Basic/Types/BasicCommunicationTurnaround.cs b/Basic/Types/BasicCommunicationTurnaround.cs
index 5b5da053..d42b751f 100644
--- a/Basic/Types/BasicCommunicationTurnaround.cs
+++ b/Basic/Types/BasicCommunicationTurnaround.cs
@@ -3,24 +3,29 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicCommunicationTurnaround: IHasIdentity
+ public class BasicCommunicationTurnaround : IHasIdentity
{
- public BasicCommunicationTurnaround(int organizationId, int communicationTypeId, int communicationId, DateTime dateTimeOpened, DateTime dateTimeFirstResponse, int personIdFirstResponse, DateTime dateTimeClosed, int personIdClosed, bool open, bool responded)
+ public BasicCommunicationTurnaround(int organizationId, int communicationTypeId, int communicationId,
+ DateTime dateTimeOpened, DateTime dateTimeFirstResponse, int personIdFirstResponse, DateTime dateTimeClosed,
+ int personIdClosed, bool open, bool responded)
{
- this.OrganizationId = organizationId;
- this.CommunicationTypeId = communicationTypeId;
- this.CommunicationId = communicationId;
- this.DateTimeOpened = dateTimeOpened;
- this.DateTimeFirstResponse = dateTimeFirstResponse;
- this.PersonIdFirstResponse = personIdFirstResponse;
- this.DateTimeClosed = dateTimeClosed;
- this.PersonIdClosed = personIdClosed;
- this.Open = open;
- this.Responded = responded;
+ OrganizationId = organizationId;
+ CommunicationTypeId = communicationTypeId;
+ CommunicationId = communicationId;
+ DateTimeOpened = dateTimeOpened;
+ DateTimeFirstResponse = dateTimeFirstResponse;
+ PersonIdFirstResponse = personIdFirstResponse;
+ DateTimeClosed = dateTimeClosed;
+ PersonIdClosed = personIdClosed;
+ Open = open;
+ Responded = responded;
}
- public BasicCommunicationTurnaround (BasicCommunicationTurnaround original):
- this (original.OrganizationId, original.CommunicationTypeId, original.CommunicationId, original.DateTimeOpened, original.DateTimeFirstResponse, original.PersonIdFirstResponse, original.DateTimeClosed, original.PersonIdClosed, original.Open, original.Responded)
+ public BasicCommunicationTurnaround(BasicCommunicationTurnaround original) :
+ this(
+ original.OrganizationId, original.CommunicationTypeId, original.CommunicationId, original.DateTimeOpened,
+ original.DateTimeFirstResponse, original.PersonIdFirstResponse, original.DateTimeClosed,
+ original.PersonIdClosed, original.Open, original.Responded)
{
// empty copy ctor
}
@@ -39,7 +44,7 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.CommunicationId; } // ok, this isn't great, but wtf
+ get { return CommunicationId; } // ok, this isn't great, but wtf
}
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicCountry.cs b/Basic/Types/BasicCountry.cs
index d1da2151..6c698c1e 100644
--- a/Basic/Types/BasicCountry.cs
+++ b/Basic/Types/BasicCountry.cs
@@ -6,28 +6,31 @@ namespace Swarmops.Basic.Types
[Serializable]
public class BasicCountry : IHasIdentity
{
- public BasicCountry (int countryId, string name, string code)
+ public BasicCountry(int countryId, string name, string code)
{
- this.CountryId = countryId;
- this.Name = name;
- this.Code = code;
+ CountryId = countryId;
+ Name = name;
+ Code = code;
}
- public BasicCountry (int countryId, string name, string code, string defaultCulture, string currencyCode, int geographyId, int postalCodeLength)
+ public BasicCountry(int countryId, string name, string code, string defaultCulture, string currencyCode,
+ int geographyId, int postalCodeLength)
: this(countryId, name, code)
{
- this.Culture = defaultCulture;
- this.CurrencyCode = currencyCode;
- this.GeographyId = geographyId;
- this.PostalCodeLength = postalCodeLength;
+ Culture = defaultCulture;
+ CurrencyCode = currencyCode;
+ GeographyId = geographyId;
+ PostalCodeLength = postalCodeLength;
}
- public BasicCountry (BasicCountry original)
- : this(original.CountryId, original.Name, original.Code, original.Culture, original.CurrencyCode, original.GeographyId, original.PostalCodeLength )
+ public BasicCountry(BasicCountry original)
+ : this(
+ original.CountryId, original.Name, original.Code, original.Culture, original.CurrencyCode,
+ original.GeographyId, original.PostalCodeLength)
{
}
- [Obsolete ("Do not call this function directly. It exists to enable serialization.", true)]
+ [Obsolete("Do not call this function directly. It exists to enable serialization.", true)]
public BasicCountry()
{
// this does not initialize the Basic Country, but exists to enable serialization.
@@ -45,7 +48,7 @@ namespace Swarmops.Basic.Types
{
get
{
- if (this.Code == "SE")
+ if (Code == "SE")
{
return 1;
}
@@ -58,7 +61,7 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.CountryId; }
+ get { return CountryId; }
}
#endregion
diff --git a/Basic/Types/BasicCurrency.cs b/Basic/Types/BasicCurrency.cs
index ed692da1..0cd7bf20 100644
--- a/Basic/Types/BasicCurrency.cs
+++ b/Basic/Types/BasicCurrency.cs
@@ -2,18 +2,18 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicCurrency: IHasIdentity
+ public class BasicCurrency : IHasIdentity
{
- public BasicCurrency (int currencyId, string code, string name, string sign)
+ public BasicCurrency(int currencyId, string code, string name, string sign)
{
- this.CurrencyId = currencyId;
- this.Code = code;
- this.Name = name;
- this.Sign = sign;
+ CurrencyId = currencyId;
+ Code = code;
+ Name = name;
+ Sign = sign;
}
- public BasicCurrency (BasicCurrency original)
- : this (original.CurrencyId, original.Code, original.Name, original.Sign)
+ public BasicCurrency(BasicCurrency original)
+ : this(original.CurrencyId, original.Code, original.Name, original.Sign)
{
// empty copy ctor
}
@@ -26,7 +26,7 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.CurrencyId; }
+ get { return CurrencyId; }
}
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicDocument.cs b/Basic/Types/BasicDocument.cs
index b048c4e6..0a9700f4 100644
--- a/Basic/Types/BasicDocument.cs
+++ b/Basic/Types/BasicDocument.cs
@@ -4,9 +4,28 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicDocument: IHasIdentity
+ public class BasicDocument : IHasIdentity
{
- public BasicDocument (int documentId, string serverFileName, string clientFileName, string description,
+ private readonly string clientFileName;
+ private readonly int documentId;
+ private readonly DocumentType documentType;
+ private readonly Int64 fileSize;
+ private readonly int foreignId;
+ private readonly int uploadedByPersonId;
+ private readonly DateTime uploadedDateTime;
+ private string description;
+ private string serverFileName;
+
+ #region IHasIdentity Members
+
+ public int Identity
+ {
+ get { return DocumentId; }
+ }
+
+ #endregion
+
+ public BasicDocument(int documentId, string serverFileName, string clientFileName, string description,
DocumentType documentType, int foreignId, Int64 fileSize, int uploadedByPersonId, DateTime uploadedDateTime)
{
this.documentId = documentId;
@@ -20,9 +39,10 @@ namespace Swarmops.Basic.Types
this.uploadedDateTime = uploadedDateTime;
}
- public BasicDocument (BasicDocument original):
- this (original.documentId, original.serverFileName, original.clientFileName, original.description,
- original.documentType, original.foreignId, original.fileSize, original.uploadedByPersonId, original.uploadedDateTime)
+ public BasicDocument(BasicDocument original) :
+ this(original.documentId, original.serverFileName, original.clientFileName, original.description,
+ original.documentType, original.foreignId, original.fileSize, original.uploadedByPersonId,
+ original.uploadedDateTime)
{
// empty ctor apart from calling the other one
}
@@ -63,7 +83,7 @@ namespace Swarmops.Basic.Types
{
get { return this.fileSize; }
}
-
+
public int UploadedByPersonId
{
get { return this.uploadedByPersonId; }
@@ -73,25 +93,5 @@ namespace Swarmops.Basic.Types
{
get { return this.uploadedDateTime; }
}
-
- private int documentId;
- private string serverFileName;
- private string clientFileName;
- private string description;
- private DocumentType documentType;
- private int foreignId;
- private Int64 fileSize;
- private int uploadedByPersonId;
- private DateTime uploadedDateTime;
-
-
- #region IHasIdentity Members
-
- public int Identity
- {
- get { return this.DocumentId; }
- }
-
- #endregion
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicElection.cs b/Basic/Types/BasicElection.cs
index e7698740..90cad9ac 100644
--- a/Basic/Types/BasicElection.cs
+++ b/Basic/Types/BasicElection.cs
@@ -3,18 +3,18 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicElection: IHasIdentity
+ public class BasicElection : IHasIdentity
{
- public BasicElection (int electionId, string name, int geographyId, DateTime date)
+ public BasicElection(int electionId, string name, int geographyId, DateTime date)
{
- this.ElectionId = electionId;
- this.Name = name;
- this.GeographyId = geographyId;
- this.Date = date;
+ ElectionId = electionId;
+ Name = name;
+ GeographyId = geographyId;
+ Date = date;
}
- public BasicElection (BasicElection original):
- this (original.ElectionId, original.Name, original.GeographyId, original.Date)
+ public BasicElection(BasicElection original) :
+ this(original.ElectionId, original.Name, original.GeographyId, original.Date)
{
// empty copy ctor
}
@@ -23,9 +23,10 @@ namespace Swarmops.Basic.Types
public string Name { get; private set; }
public int GeographyId { get; private set; }
public DateTime Date { get; private set; }
+
public int Identity
{
- get { return this.ElectionId; }
+ get { return ElectionId; }
}
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicExceptionLog.cs b/Basic/Types/BasicExceptionLog.cs
index 739e63d9..d1acccb2 100644
--- a/Basic/Types/BasicExceptionLog.cs
+++ b/Basic/Types/BasicExceptionLog.cs
@@ -4,7 +4,7 @@ namespace Swarmops.Basic.Types
{
public class BasicExceptionLog
{
- public BasicExceptionLog (int ExceptionId,DateTime ExceptionDateTime, string Source, string ExceptionText)
+ public BasicExceptionLog(int ExceptionId, DateTime ExceptionDateTime, string Source, string ExceptionText)
{
this.ExceptionId = ExceptionId;
this.ExceptionDateTime = ExceptionDateTime;
@@ -12,8 +12,8 @@ namespace Swarmops.Basic.Types
this.ExceptionText = ExceptionText;
}
- public BasicExceptionLog (BasicExceptionLog original):
- this(original.ExceptionId, original.ExceptionDateTime, original.Source, original.ExceptionText)
+ public BasicExceptionLog(BasicExceptionLog original) :
+ this(original.ExceptionId, original.ExceptionDateTime, original.Source, original.ExceptionText)
{
// empty copy ctor
}
@@ -23,4 +23,4 @@ namespace Swarmops.Basic.Types
public string Source { get; private set; }
public string ExceptionText { get; private set; }
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicExpenseClaim.cs b/Basic/Types/BasicExpenseClaim.cs
index 6edf78eb..13459fdc 100644
--- a/Basic/Types/BasicExpenseClaim.cs
+++ b/Basic/Types/BasicExpenseClaim.cs
@@ -5,43 +5,45 @@ namespace Swarmops.Basic.Types
{
public class BasicExpenseClaim : IHasIdentity
{
+ public readonly int GeographyId;
+ public readonly int OrganizationId;
+
///
- /// Normal constructor
+ /// Normal constructor
///
- public BasicExpenseClaim (int expenseClaimId, int claimingPersonId, DateTime createdDateTime,
+ public BasicExpenseClaim(int expenseClaimId, int claimingPersonId, DateTime createdDateTime,
bool open, bool attested, bool documented, bool claimed, int organizationId,
int geographyId, int budgetId, DateTime expenseDate,
string description, double preApprovedAmount, Int64 amountCents, bool repaid, bool keepSeparate)
{
- this.ExpenseClaimId = expenseClaimId;
- this.ClaimingPersonId = claimingPersonId;
- this.CreatedDateTime = createdDateTime;
- this.Open = open;
- this.Attested = attested;
- this.Validated = documented;
- this.Claimed = claimed;
+ ExpenseClaimId = expenseClaimId;
+ ClaimingPersonId = claimingPersonId;
+ CreatedDateTime = createdDateTime;
+ Open = open;
+ Attested = attested;
+ Validated = documented;
+ Claimed = claimed;
this.OrganizationId = organizationId;
this.GeographyId = geographyId;
- this.BudgetId = budgetId;
- this.ExpenseDate = expenseDate;
- this.Description = description;
- this.PreApprovedAmount = preApprovedAmount;
- this.AmountCents = amountCents;
- this.Repaid = repaid;
- this.KeepSeparate = keepSeparate;
+ BudgetId = budgetId;
+ ExpenseDate = expenseDate;
+ Description = description;
+ PreApprovedAmount = preApprovedAmount;
+ AmountCents = amountCents;
+ Repaid = repaid;
+ KeepSeparate = keepSeparate;
}
///
- /// Copy constructor
+ /// Copy constructor
///
- public BasicExpenseClaim (BasicExpenseClaim original)
+ public BasicExpenseClaim(BasicExpenseClaim original)
: this(original.Identity, original.ClaimingPersonId, original.CreatedDateTime,
- original.Open, original.Attested, original.Validated, original.Claimed,
- original.OrganizationId, original.GeographyId, original.BudgetId,
- original.ExpenseDate, original.Description,
- original.PreApprovedAmount, original.AmountCents, original.Repaid, original.KeepSeparate)
+ original.Open, original.Attested, original.Validated, original.Claimed,
+ original.OrganizationId, original.GeographyId, original.BudgetId,
+ original.ExpenseDate, original.Description,
+ original.PreApprovedAmount, original.AmountCents, original.Repaid, original.KeepSeparate)
{
-
}
@@ -63,12 +65,9 @@ namespace Swarmops.Basic.Types
// The fields below are not just encapsulated yet
- public readonly int OrganizationId;
- public readonly int GeographyId;
-
public int Identity
{
- get { return this.ExpenseClaimId; }
+ get { return ExpenseClaimId; }
}
}
}
\ No newline at end of file
diff --git a/Basic/Types/BasicExternalActivity.cs b/Basic/Types/BasicExternalActivity.cs
index 0d52a54f..3d7cd747 100644
--- a/Basic/Types/BasicExternalActivity.cs
+++ b/Basic/Types/BasicExternalActivity.cs
@@ -4,24 +4,28 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicExternalActivity: IHasIdentity
+ public class BasicExternalActivity : IHasIdentity
{
- public BasicExternalActivity (int externalActivityId, int organizationId, int geographyId, ExternalActivityType type, DateTime dateTime, string description, int createdByPersonId, DateTime createdDateTime,
+ public BasicExternalActivity(int externalActivityId, int organizationId, int geographyId,
+ ExternalActivityType type, DateTime dateTime, string description, int createdByPersonId,
+ DateTime createdDateTime,
int dupeOfActivityId)
{
- this.ExternalActivityId = externalActivityId;
- this.OrganizationId = organizationId;
- this.GeographyId = geographyId;
- this.Type = type;
- this.DateTime = dateTime;
- this.Description = description;
- this.CreatedByPersonId = createdByPersonId;
- this.CreatedDateTime = createdDateTime;
- this.DupeOfActivityId = dupeOfActivityId;
+ ExternalActivityId = externalActivityId;
+ OrganizationId = organizationId;
+ GeographyId = geographyId;
+ Type = type;
+ DateTime = dateTime;
+ Description = description;
+ CreatedByPersonId = createdByPersonId;
+ CreatedDateTime = createdDateTime;
+ DupeOfActivityId = dupeOfActivityId;
}
- public BasicExternalActivity (BasicExternalActivity original):
- this (original.ExternalActivityId, original.OrganizationId, original.GeographyId, original.Type, original.DateTime, original.Description, original.CreatedByPersonId, original.CreatedDateTime, original.DupeOfActivityId)
+ public BasicExternalActivity(BasicExternalActivity original) :
+ this(
+ original.ExternalActivityId, original.OrganizationId, original.GeographyId, original.Type, original.DateTime,
+ original.Description, original.CreatedByPersonId, original.CreatedDateTime, original.DupeOfActivityId)
{
// empty copy ctor
}
@@ -38,7 +42,7 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.ExternalActivityId; }
+ get { return ExternalActivityId; }
}
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicExternalCredential.cs b/Basic/Types/BasicExternalCredential.cs
index 2bb25d43..ac7a0c42 100644
--- a/Basic/Types/BasicExternalCredential.cs
+++ b/Basic/Types/BasicExternalCredential.cs
@@ -4,7 +4,12 @@ namespace Swarmops.Basic.Types
{
public class BasicExternalCredential : IHasIdentity
{
- public BasicExternalCredential (int externalCredentialId, string serviceName, string login, string password)
+ public readonly int ExternalCredentialId;
+ public readonly string Login;
+ public readonly string Password;
+ public readonly string ServiceName;
+
+ public BasicExternalCredential(int externalCredentialId, string serviceName, string login, string password)
{
this.ExternalCredentialId = externalCredentialId;
this.ServiceName = serviceName;
@@ -12,11 +17,6 @@ namespace Swarmops.Basic.Types
this.Password = password;
}
- public readonly int ExternalCredentialId;
- public readonly string ServiceName;
- public readonly string Login;
- public readonly string Password;
-
public int Identity
{
diff --git a/Basic/Types/BasicExternalIdentity.cs b/Basic/Types/BasicExternalIdentity.cs
index 70435fe7..45070fe5 100644
--- a/Basic/Types/BasicExternalIdentity.cs
+++ b/Basic/Types/BasicExternalIdentity.cs
@@ -5,13 +5,20 @@ namespace Swarmops.Basic.Types
{
public class BasicExternalIdentity : IHasIdentity
{
+ private readonly int attachedToPersonID;
+ private readonly int externalIdentityIdentity;
- public BasicExternalIdentity ( int ExternalIdentityIdentity,
- ExternalIdentityType TypeOfAccount,
- string ExternalSystem,
- string UserID,
- string Password,
- int AttachedToPersonID)
+ private readonly string externalSystem;
+ private readonly string password;
+ private readonly ExternalIdentityType typeOfAccount;
+ private readonly string userID;
+
+ public BasicExternalIdentity(int ExternalIdentityIdentity,
+ ExternalIdentityType TypeOfAccount,
+ string ExternalSystem,
+ string UserID,
+ string Password,
+ int AttachedToPersonID)
{
this.externalIdentityIdentity = ExternalIdentityIdentity;
this.externalSystem = ExternalSystem;
@@ -21,60 +28,42 @@ namespace Swarmops.Basic.Types
this.typeOfAccount = TypeOfAccount;
}
- public BasicExternalIdentity (BasicExternalIdentity original)
- : this(original.Identity, original.TypeOfAccount, original.ExternalSystem, original.UserID, original.Password, original.AttachedToPersonID)
+ public BasicExternalIdentity(BasicExternalIdentity original)
+ : this(
+ original.Identity, original.TypeOfAccount, original.ExternalSystem, original.UserID, original.Password,
+ original.AttachedToPersonID)
{
}
- private int externalIdentityIdentity;
-
- private string externalSystem;
- private string userID;
- private string password;
- private int attachedToPersonID;
- private ExternalIdentityType typeOfAccount;
-
public int ExternalIdentityIdentity
{
- get { return externalIdentityIdentity; }
+ get { return this.externalIdentityIdentity; }
}
public string ExternalSystem
{
- get
- {
- return externalSystem;
- }
- }
- public string UserID
- {
- get
- {
- return userID;
- }
- }
- public string Password
- {
- get
- {
- return password;
- }
- }
- public int AttachedToPersonID
- {
- get
- {
- return attachedToPersonID;
- }
- }
- public ExternalIdentityType TypeOfAccount
- {
- get
- {
- return typeOfAccount;
- }
+ get { return this.externalSystem; }
}
+ public string UserID
+ {
+ get { return this.userID; }
+ }
+
+ public string Password
+ {
+ get { return this.password; }
+ }
+
+ public int AttachedToPersonID
+ {
+ get { return this.attachedToPersonID; }
+ }
+
+ public ExternalIdentityType TypeOfAccount
+ {
+ get { return this.typeOfAccount; }
+ }
#region IHasIdentity Members
@@ -85,4 +74,4 @@ namespace Swarmops.Basic.Types
#endregion
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicGeography.cs b/Basic/Types/BasicGeography.cs
index 3415baa9..455b9b38 100644
--- a/Basic/Types/BasicGeography.cs
+++ b/Basic/Types/BasicGeography.cs
@@ -4,25 +4,25 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
///
- /// A geographical node.
+ /// A geographical node.
///
[Serializable]
public class BasicGeography : IHasIdentity
{
- public BasicGeography (int geographyId, int parentGeographyId, string name)
+ public BasicGeography(int geographyId, int parentGeographyId, string name)
: this(geographyId, parentGeographyId, name, 0)
{
}
- public BasicGeography (int geographyId, int parentGeographyId, string name, int generation)
+ public BasicGeography(int geographyId, int parentGeographyId, string name, int generation)
{
- this.GeographyId = geographyId;
- this.ParentGeographyId = parentGeographyId;
- this.Name = name;
- this.Generation = generation;
+ GeographyId = geographyId;
+ ParentGeographyId = parentGeographyId;
+ Name = name;
+ Generation = generation;
}
- public BasicGeography (BasicGeography original)
+ public BasicGeography(BasicGeography original)
: this(original.GeographyId, original.ParentGeographyId, original.Name, original.Generation)
{
}
@@ -34,22 +34,22 @@ namespace Swarmops.Basic.Types
}
///
- /// The database id of this geography.
+ /// The database id of this geography.
///
public int GeographyId { get; private set; }
///
- /// The database id of the parent geography, for linking in a tree structure.
+ /// The database id of the parent geography, for linking in a tree structure.
///
public int ParentGeographyId { get; protected set; }
///
- /// The friendly name of the node (city, county, region, etc).
+ /// The friendly name of the node (city, county, region, etc).
///
public string Name { get; protected set; }
///
- /// The generation of this node. Used in tree-style listings.
+ /// The generation of this node. Used in tree-style listings.
///
public int Generation { get; protected set; }
@@ -57,7 +57,7 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.GeographyId; }
+ get { return GeographyId; }
}
#endregion
diff --git a/Basic/Types/BasicGeographyDesignation.cs b/Basic/Types/BasicGeographyDesignation.cs
index 9c777ddc..c5141bdc 100644
--- a/Basic/Types/BasicGeographyDesignation.cs
+++ b/Basic/Types/BasicGeographyDesignation.cs
@@ -4,16 +4,16 @@ namespace Swarmops.Basic.Types
{
public class BasicGeographyDesignation
{
- public BasicGeographyDesignation (int geographyId, int countryId,
- string designation, GeographyLevel geoLevelId)
+ public BasicGeographyDesignation(int geographyId, int countryId,
+ string designation, GeographyLevel geoLevelId)
{
- this.GeographyId = geographyId;
- this.CountryId = countryId;
- this.Designation = designation;
- this.GeographyLevel = geoLevelId;
+ GeographyId = geographyId;
+ CountryId = countryId;
+ Designation = designation;
+ GeographyLevel = geoLevelId;
}
- public BasicGeographyDesignation (BasicGeographyDesignation original) :
+ public BasicGeographyDesignation(BasicGeographyDesignation original) :
this(original.GeographyId, original.CountryId, original.Designation, original.GeographyLevel)
{
// empty copy ctor
diff --git a/Basic/Types/BasicInboundInvoice.cs b/Basic/Types/BasicInboundInvoice.cs
index 5ba85e54..bbf14e2d 100644
--- a/Basic/Types/BasicInboundInvoice.cs
+++ b/Basic/Types/BasicInboundInvoice.cs
@@ -3,34 +3,34 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicInboundInvoice: IHasIdentity
+ public class BasicInboundInvoice : IHasIdentity
{
- public BasicInboundInvoice (int inboundInvoiceId, int organizationId, DateTime createdDateTime,
+ public BasicInboundInvoice(int inboundInvoiceId, int organizationId, DateTime createdDateTime,
DateTime dueDate, Int64 amountCents, int budgetId, string supplier, string
- payToAccount, string ocr, string invoiceReference, bool attested, bool open,
+ payToAccount, string ocr, string invoiceReference, bool attested, bool open,
DateTime closedDateTime, int closedByPersonId)
{
- this.InboundInvoiceId = inboundInvoiceId;
- this.OrganizationId = organizationId;
- this.CreatedDateTime = createdDateTime;
- this.DueDate = dueDate;
- this.AmountCents = amountCents;
- this.BudgetId = budgetId;
- this.Supplier = supplier;
- this.PayToAccount = payToAccount;
- this.Ocr = ocr;
- this.InvoiceReference = invoiceReference;
- this.Attested = attested;
- this.Open = open;
- this.ClosedDateTime = closedDateTime;
- this.ClosedByPersonId = closedByPersonId;
+ InboundInvoiceId = inboundInvoiceId;
+ OrganizationId = organizationId;
+ CreatedDateTime = createdDateTime;
+ DueDate = dueDate;
+ AmountCents = amountCents;
+ BudgetId = budgetId;
+ Supplier = supplier;
+ PayToAccount = payToAccount;
+ Ocr = ocr;
+ InvoiceReference = invoiceReference;
+ Attested = attested;
+ Open = open;
+ ClosedDateTime = closedDateTime;
+ ClosedByPersonId = closedByPersonId;
}
- public BasicInboundInvoice (BasicInboundInvoice original)
- : this (original.InboundInvoiceId, original.OrganizationId, original.CreatedDateTime,
- original.DueDate, original.AmountCents, original.BudgetId,
- original.Supplier, original.PayToAccount, original.Ocr, original.InvoiceReference,
- original.Attested, original.Open, original.ClosedDateTime, original.ClosedByPersonId)
+ public BasicInboundInvoice(BasicInboundInvoice original)
+ : this(original.InboundInvoiceId, original.OrganizationId, original.CreatedDateTime,
+ original.DueDate, original.AmountCents, original.BudgetId,
+ original.Supplier, original.PayToAccount, original.Ocr, original.InvoiceReference,
+ original.Attested, original.Open, original.ClosedDateTime, original.ClosedByPersonId)
{
// empty copy ctor
}
@@ -54,9 +54,9 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.InboundInvoiceId; }
+ get { return InboundInvoiceId; }
}
#endregion
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicInternalPoll.cs b/Basic/Types/BasicInternalPoll.cs
index 7c9019f3..771d9c60 100644
--- a/Basic/Types/BasicInternalPoll.cs
+++ b/Basic/Types/BasicInternalPoll.cs
@@ -3,28 +3,33 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicInternalPoll: IHasIdentity
+ public class BasicInternalPoll : IHasIdentity
{
- public BasicInternalPoll (int internalPollId, int createdByPersonId, int organizationId, int geographyId, string name, bool runningOpen, bool votingOpen, int maxVoteLength, DateTime runningOpens, DateTime runningCloses, DateTime votingOpens, DateTime votingCloses, InternalPollResultsType resultsType)
+ public BasicInternalPoll(int internalPollId, int createdByPersonId, int organizationId, int geographyId,
+ string name, bool runningOpen, bool votingOpen, int maxVoteLength, DateTime runningOpens,
+ DateTime runningCloses, DateTime votingOpens, DateTime votingCloses, InternalPollResultsType resultsType)
{
- this.InternalPollId = internalPollId;
- this.CreatedByPersonId = createdByPersonId;
- this.OrganizationId = organizationId;
- this.GeographyId = geographyId;
- this.Name = name;
- this.RunningOpen = runningOpen;
- this.VotingOpen = votingOpen;
- this.MaxVoteLength = maxVoteLength;
- this.RunningOpens = runningOpens;
- this.RunningCloses = runningCloses;
- this.VotingOpens = votingOpens;
- this.VotingCloses = votingCloses;
- this.ResultsType = resultsType;
+ InternalPollId = internalPollId;
+ CreatedByPersonId = createdByPersonId;
+ OrganizationId = organizationId;
+ GeographyId = geographyId;
+ Name = name;
+ RunningOpen = runningOpen;
+ VotingOpen = votingOpen;
+ MaxVoteLength = maxVoteLength;
+ RunningOpens = runningOpens;
+ RunningCloses = runningCloses;
+ VotingOpens = votingOpens;
+ VotingCloses = votingCloses;
+ ResultsType = resultsType;
}
public BasicInternalPoll(BasicInternalPoll original)
- : this(original.InternalPollId, original.CreatedByPersonId, original.OrganizationId, original.GeographyId, original.Name, original.RunningOpen,
- original.VotingOpen, original.MaxVoteLength, original.RunningOpens, original.RunningCloses, original.VotingOpens, original.VotingCloses, original.ResultsType)
+ : this(
+ original.InternalPollId, original.CreatedByPersonId, original.OrganizationId, original.GeographyId,
+ original.Name, original.RunningOpen,
+ original.VotingOpen, original.MaxVoteLength, original.RunningOpens, original.RunningCloses,
+ original.VotingOpens, original.VotingCloses, original.ResultsType)
{
// empty copy ctor
}
@@ -47,7 +52,7 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.InternalPollId; }
+ get { return InternalPollId; }
}
#endregion
@@ -57,17 +62,20 @@ namespace Swarmops.Basic.Types
public enum InternalPollResultsType
{
Unknown,
+
///
- /// Primaries vote -- a Condorcet Schultze divided into six lists and some other twists
+ /// Primaries vote -- a Condorcet Schultze divided into six lists and some other twists
///
Primaries,
+
///
- /// A straight Condorcet Schultze, ranking the candidates
+ /// A straight Condorcet Schultze, ranking the candidates
///
Schulze,
+
///
- /// Accept vote: Count the number of accepts for each candidate
+ /// Accept vote: Count the number of accepts for each candidate
///
Accept
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicInternalPollCandidate.cs b/Basic/Types/BasicInternalPollCandidate.cs
index 85c62ae5..d1b7aa3b 100644
--- a/Basic/Types/BasicInternalPollCandidate.cs
+++ b/Basic/Types/BasicInternalPollCandidate.cs
@@ -2,18 +2,21 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicInternalPollCandidate: IHasIdentity
+ public class BasicInternalPollCandidate : IHasIdentity
{
- public BasicInternalPollCandidate (int internalPollCandidateId, int internalPollId, int personId, string candidacyStatement)
+ public BasicInternalPollCandidate(int internalPollCandidateId, int internalPollId, int personId,
+ string candidacyStatement)
{
- this.InternalPollCandidateId = internalPollCandidateId;
- this.InternalPollId = internalPollId;
- this.PersonId = personId;
- this.CandidacyStatement = candidacyStatement;
+ InternalPollCandidateId = internalPollCandidateId;
+ InternalPollId = internalPollId;
+ PersonId = personId;
+ CandidacyStatement = candidacyStatement;
}
- public BasicInternalPollCandidate (BasicInternalPollCandidate original)
- : this (original.InternalPollCandidateId, original.InternalPollId, original.PersonId, original.CandidacyStatement)
+ public BasicInternalPollCandidate(BasicInternalPollCandidate original)
+ : this(
+ original.InternalPollCandidateId, original.InternalPollId, original.PersonId,
+ original.CandidacyStatement)
{
// empty copy ctor
}
@@ -27,9 +30,9 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.InternalPollCandidateId; }
+ get { return InternalPollCandidateId; }
}
#endregion
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicInternalPollVote.cs b/Basic/Types/BasicInternalPollVote.cs
index 74248a2d..c4ca3767 100644
--- a/Basic/Types/BasicInternalPollVote.cs
+++ b/Basic/Types/BasicInternalPollVote.cs
@@ -2,17 +2,17 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicInternalPollVote: IHasIdentity
+ public class BasicInternalPollVote : IHasIdentity
{
- public BasicInternalPollVote (int internalPollVoteId, int internalPollId, string verificationCode)
+ public BasicInternalPollVote(int internalPollVoteId, int internalPollId, string verificationCode)
{
- this.InternalPollVoteId = internalPollVoteId;
- this.InternalPollId = internalPollId;
- this.VerificationCode = verificationCode;
+ InternalPollVoteId = internalPollVoteId;
+ InternalPollId = internalPollId;
+ VerificationCode = verificationCode;
}
- public BasicInternalPollVote (BasicInternalPollVote original)
- : this (original.InternalPollVoteId, original.InternalPollId, original.VerificationCode)
+ public BasicInternalPollVote(BasicInternalPollVote original)
+ : this(original.InternalPollVoteId, original.InternalPollId, original.VerificationCode)
{
// empty copy ctor
}
@@ -25,9 +25,9 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.InternalPollVoteId; }
+ get { return InternalPollVoteId; }
}
#endregion
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicInternalPollVoteDetail.cs b/Basic/Types/BasicInternalPollVoteDetail.cs
index 4f409c3f..e807ac42 100644
--- a/Basic/Types/BasicInternalPollVoteDetail.cs
+++ b/Basic/Types/BasicInternalPollVoteDetail.cs
@@ -2,15 +2,15 @@ namespace Swarmops.Basic.Types
{
public class BasicInternalPollVoteDetail
{
- public BasicInternalPollVoteDetail (int internalPollVoteId, int internalPollCandidateId, int position)
+ public BasicInternalPollVoteDetail(int internalPollVoteId, int internalPollCandidateId, int position)
{
- this.InternalPollVoteId = internalPollVoteId;
- this.InternalPollCandidateId = internalPollCandidateId;
- this.Position = position;
+ InternalPollVoteId = internalPollVoteId;
+ InternalPollCandidateId = internalPollCandidateId;
+ Position = position;
}
- public BasicInternalPollVoteDetail (BasicInternalPollVoteDetail original)
- : this (original.InternalPollVoteId, original.InternalPollCandidateId, original.Position)
+ public BasicInternalPollVoteDetail(BasicInternalPollVoteDetail original)
+ : this(original.InternalPollVoteId, original.InternalPollCandidateId, original.Position)
{
// empty copy ctor
}
@@ -19,4 +19,4 @@ namespace Swarmops.Basic.Types
public int InternalPollCandidateId { get; private set; }
public int Position { get; private set; }
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicInternalPollVoter.cs b/Basic/Types/BasicInternalPollVoter.cs
index 91a635a8..c1fbea7d 100644
--- a/Basic/Types/BasicInternalPollVoter.cs
+++ b/Basic/Types/BasicInternalPollVoter.cs
@@ -4,16 +4,16 @@ namespace Swarmops.Basic.Types
{
public class BasicInternalPollVoter
{
- public BasicInternalPollVoter (int personId, int internalPollId, bool open, DateTime closedDateTime)
+ public BasicInternalPollVoter(int personId, int internalPollId, bool open, DateTime closedDateTime)
{
- this.PersonId = personId;
- this.InternalPollId = internalPollId;
- this.Open = open;
- this.ClosedDateTime = closedDateTime;
+ PersonId = personId;
+ InternalPollId = internalPollId;
+ Open = open;
+ ClosedDateTime = closedDateTime;
}
- public BasicInternalPollVoter (BasicInternalPollVoter original)
- : this (original.PersonId, original.InternalPollId, original.Open, original.ClosedDateTime)
+ public BasicInternalPollVoter(BasicInternalPollVoter original)
+ : this(original.PersonId, original.InternalPollId, original.Open, original.ClosedDateTime)
{
// empty copy ctor
}
@@ -28,17 +28,20 @@ namespace Swarmops.Basic.Types
public enum InternalPollVoterStatus
{
Unknown = 0,
+
///
- /// This voter is eligible and has not yet voted in this poll.
+ /// This voter is eligible and has not yet voted in this poll.
///
CanVote,
+
///
- /// This voter is eligible to vote, but has already voted.
+ /// This voter is eligible to vote, but has already voted.
///
HasAlreadyVoted,
+
///
- /// This person does is not on the list of eligible voters.
+ /// This person does is not on the list of eligible voters.
///
NotEligibleForPoll
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicMailTemplate.cs b/Basic/Types/BasicMailTemplate.cs
index f77121d4..084c59b8 100644
--- a/Basic/Types/BasicMailTemplate.cs
+++ b/Basic/Types/BasicMailTemplate.cs
@@ -4,15 +4,22 @@ namespace Swarmops.Basic.Types
{
public class BasicMailTemplate : IHasIdentity
{
+ private readonly string countryCode;
+ private readonly string languageCode;
+ private readonly int organizationId;
+ private readonly int templateId;
+ private readonly string templateName;
+ private string templateBody;
+
///
- /// Basic constructor.
+ /// Basic constructor.
///
- public BasicMailTemplate (int templateId,
- string templateName,
- string languageCode,
- string countryCode,
- int organizationId,
- string templateBody)
+ public BasicMailTemplate(int templateId,
+ string templateName,
+ string languageCode,
+ string countryCode,
+ int organizationId,
+ string templateBody)
{
this.templateId = templateId;
this.templateName = templateName;
@@ -20,20 +27,19 @@ namespace Swarmops.Basic.Types
this.countryCode = countryCode;
this.organizationId = organizationId;
this.templateBody = templateBody;
-
}
///
- /// Copy constructor.
+ /// Copy constructor.
///
- public BasicMailTemplate (BasicMailTemplate original)
+ public BasicMailTemplate(BasicMailTemplate original)
: this(original.templateId,
- original.templateName,
- original.languageCode,
- original.countryCode,
- original.organizationId,
- original.templateBody)
+ original.templateName,
+ original.languageCode,
+ original.countryCode,
+ original.organizationId,
+ original.templateBody)
{
}
@@ -42,51 +48,37 @@ namespace Swarmops.Basic.Types
get { return this.templateId; }
}
- public int Identity
- {
- get { return this.templateId; }
- }
-
public string TemplateName
{
- get
- {
- return templateName;
- }
+ get { return this.templateName; }
}
+
public string LanguageCode
{
- get
- {
- return languageCode;
- }
+ get { return this.languageCode; }
}
+
public string CountryCode
{
- get
- {
- return countryCode;
- }
+ get { return this.countryCode; }
}
+
public int OrganizationId
{
get { return this.organizationId; }
}
-
public string TemplateBody
{
get { return this.templateBody; }
set { this.templateBody = value; }
}
- private int templateId;
- private string templateName;
- private string languageCode;
- private string countryCode;
- private int organizationId;
- private string templateBody;
+ public int Identity
+ {
+ get { return this.templateId; }
+ }
}
}
\ No newline at end of file
diff --git a/Basic/Types/BasicMediaCategory.cs b/Basic/Types/BasicMediaCategory.cs
index 566ad175..afafa62d 100644
--- a/Basic/Types/BasicMediaCategory.cs
+++ b/Basic/Types/BasicMediaCategory.cs
@@ -4,13 +4,25 @@ namespace Swarmops.Basic.Types
{
public class BasicMediaCategory : IHasIdentity
{
- public BasicMediaCategory (int mediaCategoryId, string name)
+ private readonly int mediaCategoryId;
+ private readonly string name;
+
+ #region IHasIdentity Members
+
+ public int Identity
+ {
+ get { return MediaCategoryId; }
+ }
+
+ #endregion
+
+ public BasicMediaCategory(int mediaCategoryId, string name)
{
this.mediaCategoryId = mediaCategoryId;
this.name = name;
}
- public BasicMediaCategory (BasicMediaCategory original) :
+ public BasicMediaCategory(BasicMediaCategory original) :
this(original.mediaCategoryId, original.name)
{
}
@@ -30,17 +42,5 @@ namespace Swarmops.Basic.Types
{
get { return this.mediaCategoryId; }
}
-
- private int mediaCategoryId;
- private string name;
-
- #region IHasIdentity Members
-
- public int Identity
- {
- get { return MediaCategoryId; }
- }
-
- #endregion
}
}
\ No newline at end of file
diff --git a/Basic/Types/BasicMediaEntry.cs b/Basic/Types/BasicMediaEntry.cs
index 103bcb84..107a169d 100644
--- a/Basic/Types/BasicMediaEntry.cs
+++ b/Basic/Types/BasicMediaEntry.cs
@@ -5,8 +5,25 @@ namespace Swarmops.Basic.Types
{
public class BasicMediaEntry : IHasIdentity
{
- public BasicMediaEntry (int id, int keywordId, string mediaName, bool isBlog, string title, string url,
- DateTime dateTime)
+ private readonly DateTime dateTime;
+ private readonly int id;
+ private readonly bool isBlog;
+ private readonly int keywordId;
+ private readonly string mediaName;
+ private readonly string title;
+ private readonly string url;
+
+ #region IHasIdentity Members
+
+ public int Identity
+ {
+ get { return Id; }
+ }
+
+ #endregion
+
+ public BasicMediaEntry(int id, int keywordId, string mediaName, bool isBlog, string title, string url,
+ DateTime dateTime)
{
this.id = id;
this.keywordId = keywordId;
@@ -17,7 +34,7 @@ namespace Swarmops.Basic.Types
this.dateTime = dateTime;
}
- public BasicMediaEntry (BasicMediaEntry original)
+ public BasicMediaEntry(BasicMediaEntry original)
: this(
original.id, original.keywordId, original.mediaName, original.isBlog, original.title, original.url,
original.dateTime)
@@ -31,17 +48,17 @@ namespace Swarmops.Basic.Types
public int Id
{
- get { return id; }
+ get { return this.id; }
}
public int KeywordId
{
- get { return keywordId; }
+ get { return this.keywordId; }
}
public string Title
{
- get { return title; }
+ get { return this.title; }
}
public string MediaName
@@ -52,34 +69,17 @@ namespace Swarmops.Basic.Types
public string Url
{
- get { return url; }
+ get { return this.url; }
}
public DateTime DateTime
{
- get { return dateTime; }
+ get { return this.dateTime; }
}
public bool IsBlog
{
get { return this.isBlog; }
}
-
- private int id;
- private DateTime dateTime;
- private string title;
- private string mediaName;
- private string url;
- private int keywordId;
- private bool isBlog;
-
- #region IHasIdentity Members
-
- public int Identity
- {
- get { return Id; }
- }
-
- #endregion
}
}
\ No newline at end of file
diff --git a/Basic/Types/BasicMediaKeyword.cs b/Basic/Types/BasicMediaKeyword.cs
index ec0154a1..9608285a 100644
--- a/Basic/Types/BasicMediaKeyword.cs
+++ b/Basic/Types/BasicMediaKeyword.cs
@@ -6,13 +6,25 @@ namespace Swarmops.Basic.Types
[Serializable]
public class BasicMediaKeyword : IHasIdentity
{
- public BasicMediaKeyword (int id, string keyword)
+ private readonly int id;
+ private readonly string keyword;
+
+ #region IHasIdentity Members
+
+ public int Identity
+ {
+ get { return Id; }
+ }
+
+ #endregion
+
+ public BasicMediaKeyword(int id, string keyword)
{
this.id = id;
this.keyword = keyword;
}
- public BasicMediaKeyword (BasicMediaKeyword original)
+ public BasicMediaKeyword(BasicMediaKeyword original)
{
this.id = original.id;
this.keyword = original.keyword;
@@ -25,24 +37,12 @@ namespace Swarmops.Basic.Types
public int Id
{
- get { return id; }
+ get { return this.id; }
}
public string Keyword
{
- get { return keyword; }
+ get { return this.keyword; }
}
-
- private int id;
- private string keyword;
-
- #region IHasIdentity Members
-
- public int Identity
- {
- get { return Id; }
- }
-
- #endregion
}
}
\ No newline at end of file
diff --git a/Basic/Types/BasicMedium.cs b/Basic/Types/BasicMedium.cs
index e5f6ce0f..5a9d6f26 100644
--- a/Basic/Types/BasicMedium.cs
+++ b/Basic/Types/BasicMedium.cs
@@ -5,15 +5,28 @@ namespace Swarmops.Basic.Types
{
public class BasicMedium : IHasIdentity
{
- public BasicMedium (int mediumId, string name, PoliticalAffiliation politicalAffiliation)
+ private readonly int mediumId;
+ private readonly string name;
+ private readonly PoliticalAffiliation politicalAffiliation;
+
+ #region IHasIdentity Members
+
+ public int Identity
+ {
+ get { return MediumId; }
+ }
+
+ #endregion
+
+ public BasicMedium(int mediumId, string name, PoliticalAffiliation politicalAffiliation)
{
this.mediumId = mediumId;
this.name = name;
this.politicalAffiliation = politicalAffiliation;
}
- public BasicMedium (int mediumId, string name)
- : this(mediumId, name, Enums.PoliticalAffiliation.NotPolitical)
+ public BasicMedium(int mediumId, string name)
+ : this(mediumId, name, PoliticalAffiliation.NotPolitical)
{
}
@@ -31,18 +44,5 @@ namespace Swarmops.Basic.Types
{
get { return this.mediumId; }
}
-
- private int mediumId;
- private string name;
- private PoliticalAffiliation politicalAffiliation;
-
- #region IHasIdentity Members
-
- public int Identity
- {
- get { return this.MediumId; }
- }
-
- #endregion
}
}
\ No newline at end of file
diff --git a/Basic/Types/BasicMembership.cs b/Basic/Types/BasicMembership.cs
index 3b90b808..4d88c9a3 100644
--- a/Basic/Types/BasicMembership.cs
+++ b/Basic/Types/BasicMembership.cs
@@ -5,34 +5,34 @@ namespace Swarmops.Basic.Types
{
public class BasicMembership : IHasIdentity
{
- public BasicMembership (int personId, int organizationId)
+ public BasicMembership(int personId, int organizationId)
{
- this.PersonId = personId;
- this.OrganizationId = organizationId;
- this.Active = true;
- this.DateTerminated = DateTime.MinValue;
+ PersonId = personId;
+ OrganizationId = organizationId;
+ Active = true;
+ DateTerminated = DateTime.MinValue;
}
- public BasicMembership (int personId, int organizationId, DateTime memberSince, DateTime expires)
+ public BasicMembership(int personId, int organizationId, DateTime memberSince, DateTime expires)
: this(personId, organizationId)
{
- this.MemberSince = memberSince;
- this.Expires = expires;
+ MemberSince = memberSince;
+ Expires = expires;
}
- public BasicMembership (int membershipId, int personId, int organizationId, DateTime memberSince,
- DateTime expires, bool active, DateTime dateTerminated)
+ public BasicMembership(int membershipId, int personId, int organizationId, DateTime memberSince,
+ DateTime expires, bool active, DateTime dateTerminated)
{
- this.MembershipId = membershipId;
- this.PersonId = personId;
- this.OrganizationId = organizationId;
- this.MemberSince = memberSince;
- this.Expires = expires;
- this.Active = active;
- this.DateTerminated = dateTerminated;
+ MembershipId = membershipId;
+ PersonId = personId;
+ OrganizationId = organizationId;
+ MemberSince = memberSince;
+ Expires = expires;
+ Active = active;
+ DateTerminated = dateTerminated;
}
- public BasicMembership (BasicMembership original)
+ public BasicMembership(BasicMembership original)
: this(
original.MembershipId, original.PersonId, original.OrganizationId, original.MemberSince,
original.Expires, original.Active, original.DateTerminated)
@@ -48,23 +48,18 @@ namespace Swarmops.Basic.Types
public DateTime DateTerminated { get; protected set; }
public DateTime Expires { get; protected set; }
-
-
-
- // RICK NOTES: I moved the MembershipPayments to a separate table, as they are NULL on most rows.
- // Not implemented as per 2010-01-11.
-
- // Also, note the renaming of "Valid" to "Active", consistently with other objects and analogous to "Open".
-
-
-
#region IHasIdentity Members
public int Identity
{
- get { return this.MembershipId; }
+ get { return MembershipId; }
}
#endregion
+
+ // RICK NOTES: I moved the MembershipPayments to a separate table, as they are NULL on most rows.
+ // Not implemented as per 2010-01-11.
+
+ // Also, note the renaming of "Valid" to "Active", consistently with other objects and analogous to "Open".
}
}
\ No newline at end of file
diff --git a/Basic/Types/BasicMembershipPaymentStatus.cs b/Basic/Types/BasicMembershipPaymentStatus.cs
index bc9c9706..97a54955 100644
--- a/Basic/Types/BasicMembershipPaymentStatus.cs
+++ b/Basic/Types/BasicMembershipPaymentStatus.cs
@@ -5,15 +5,15 @@ namespace Swarmops.Basic.Types
{
public class BasicMembershipPaymentStatus
{
- public BasicMembershipPaymentStatus (int membershipId,MembershipPaymentStatus status, DateTime statusDateTime)
+ public BasicMembershipPaymentStatus(int membershipId, MembershipPaymentStatus status, DateTime statusDateTime)
{
- this.MembershipId = membershipId ;
- this.Status = status;
- this.StatusDateTime = statusDateTime;
+ MembershipId = membershipId;
+ Status = status;
+ StatusDateTime = statusDateTime;
}
- public int MembershipId { get; protected set; }
+ public int MembershipId { get; protected set; }
public MembershipPaymentStatus Status { get; set; }
public DateTime StatusDateTime { get; set; }
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicNewsletter.cs b/Basic/Types/BasicNewsletter.cs
index 7cf57a4f..f9a0a08d 100644
--- a/Basic/Types/BasicNewsletter.cs
+++ b/Basic/Types/BasicNewsletter.cs
@@ -3,12 +3,22 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
///
- /// This class encapsulates a single newsletter.
+ /// This class encapsulates a single newsletter.
///
public class BasicNewsletter : IHasIdentity
{
- public BasicNewsletter (int newsletterId, string title, string introduction, string body,
- int authorId, int templateId, int feedId)
+ private readonly int authorId;
+ private readonly string body;
+ private readonly int geographyId;
+ private readonly string introduction;
+ private readonly int newsletterFeedId;
+ private readonly int newsletterId;
+ private readonly int newsletterTemplateId;
+ private readonly int organizationId;
+ private readonly string title;
+
+ public BasicNewsletter(int newsletterId, string title, string introduction, string body,
+ int authorId, int templateId, int feedId)
{
this.newsletterId = newsletterId;
this.newsletterFeedId = feedId;
@@ -20,8 +30,8 @@ namespace Swarmops.Basic.Types
this.newsletterFeedId = feedId;
}
- public BasicNewsletter (int newsletterId, string title, string introduction, string body,
- int authorId, int templateId, int feedId, int organizationId, int geographyId)
+ public BasicNewsletter(int newsletterId, string title, string introduction, string body,
+ int authorId, int templateId, int feedId, int organizationId, int geographyId)
:
this(newsletterId, title, introduction, body, authorId, templateId, feedId)
{
@@ -31,47 +41,47 @@ namespace Swarmops.Basic.Types
public int NewsletterId
{
- get { return newsletterId; }
+ get { return this.newsletterId; }
}
public string Title
{
- get { return title; }
+ get { return this.title; }
}
public string Introduction
{
- get { return introduction; }
+ get { return this.introduction; }
}
public string Body
{
- get { return body; }
+ get { return this.body; }
}
public int AuthorId
{
- get { return authorId; }
+ get { return this.authorId; }
}
public int NewsletterFeedId
{
- get { return newsletterFeedId; }
+ get { return this.newsletterFeedId; }
}
public int NewsletterTemplateId
{
- get { return newsletterTemplateId; }
+ get { return this.newsletterTemplateId; }
}
public int OrganizationId
{
- get { return organizationId; }
+ get { return this.organizationId; }
}
public int GeographyId
{
- get { return geographyId; }
+ get { return this.geographyId; }
}
#region IHasIdentity Members
@@ -82,15 +92,5 @@ namespace Swarmops.Basic.Types
}
#endregion
-
- private int newsletterId;
- private string title;
- private string introduction;
- private string body;
- private int authorId;
- private int newsletterFeedId;
- private int newsletterTemplateId;
- private int geographyId;
- private int organizationId;
}
}
\ No newline at end of file
diff --git a/Basic/Types/BasicNewsletterFeed.cs b/Basic/Types/BasicNewsletterFeed.cs
index 21a6c480..d0dd4af2 100644
--- a/Basic/Types/BasicNewsletterFeed.cs
+++ b/Basic/Types/BasicNewsletterFeed.cs
@@ -2,7 +2,27 @@ namespace Swarmops.Basic.Types
{
public class BasicNewsletterFeed
{
- public BasicNewsletterFeed (int newsletterId, int organizationId, bool defaultSubscribed, string name)
+ ///
+ /// If true, a new member in the owning organization will get this newsletter.
+ ///
+ public readonly bool DefaultSubscribed;
+
+ ///
+ /// A friendly name for the newsletter.
+ ///
+ public readonly string Name;
+
+ ///
+ /// The database identity of the newsletter feed.
+ ///
+ public readonly int NewsletterFeedId;
+
+ ///
+ /// The identity of the organization that owns this newsletter.
+ ///
+ public readonly int OrganizationId;
+
+ public BasicNewsletterFeed(int newsletterId, int organizationId, bool defaultSubscribed, string name)
{
this.NewsletterFeedId = newsletterId;
this.OrganizationId = organizationId;
@@ -12,32 +32,12 @@ namespace Swarmops.Basic.Types
public BasicNewsletterFeed()
{
- Name = string.Empty;
+ this.Name = string.Empty;
}
- public BasicNewsletterFeed (BasicNewsletterFeed original)
+ public BasicNewsletterFeed(BasicNewsletterFeed original)
: this(original.NewsletterFeedId, original.OrganizationId, original.DefaultSubscribed, original.Name)
{
}
-
- ///
- /// The database identity of the newsletter feed.
- ///
- public readonly int NewsletterFeedId;
-
- ///
- /// The identity of the organization that owns this newsletter.
- ///
- public readonly int OrganizationId;
-
- ///
- /// If true, a new member in the owning organization will get this newsletter.
- ///
- public readonly bool DefaultSubscribed;
-
- ///
- /// A friendly name for the newsletter.
- ///
- public readonly string Name;
}
}
\ No newline at end of file
diff --git a/Basic/Types/BasicNewsletterTemplate.cs b/Basic/Types/BasicNewsletterTemplate.cs
index 363b8128..fe66ac52 100644
--- a/Basic/Types/BasicNewsletterTemplate.cs
+++ b/Basic/Types/BasicNewsletterTemplate.cs
@@ -2,13 +2,13 @@ namespace Swarmops.Basic.Types
{
public class BasicNewsletterTemplate
{
- public BasicNewsletterTemplate (string htmlTemplate, string textTemplate)
+ public string HtmlTemplate;
+ public string TextTemplate;
+
+ public BasicNewsletterTemplate(string htmlTemplate, string textTemplate)
{
this.HtmlTemplate = htmlTemplate;
this.TextTemplate = textTemplate;
}
-
- public string HtmlTemplate;
- public string TextTemplate;
}
}
\ No newline at end of file
diff --git a/Basic/Types/BasicObjectOptionalData.cs b/Basic/Types/BasicObjectOptionalData.cs
index 84231566..fbe160b5 100644
--- a/Basic/Types/BasicObjectOptionalData.cs
+++ b/Basic/Types/BasicObjectOptionalData.cs
@@ -7,22 +7,23 @@ namespace Swarmops.Basic.Types
[Serializable]
public class BasicObjectOptionalData
{
- public BasicObjectOptionalData(ObjectType objectType, int objectId, Dictionary initialData)
+ protected Dictionary OptionalData;
+
+ public BasicObjectOptionalData(ObjectType objectType, int objectId,
+ Dictionary initialData)
{
- this.ObjectType = objectType;
- this.ObjectId = objectId;
+ ObjectType = objectType;
+ ObjectId = objectId;
this.OptionalData = initialData;
}
public BasicObjectOptionalData(BasicObjectOptionalData original)
- : this (original.ObjectType, original.ObjectId, original.OptionalData)
+ : this(original.ObjectType, original.ObjectId, original.OptionalData)
{
// empty ctor
}
public ObjectType ObjectType { get; private set; }
public int ObjectId { get; private set; }
-
- protected Dictionary OptionalData;
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicOrganization.cs b/Basic/Types/BasicOrganization.cs
index 2552f6b0..6b3e4141 100644
--- a/Basic/Types/BasicOrganization.cs
+++ b/Basic/Types/BasicOrganization.cs
@@ -4,40 +4,51 @@ namespace Swarmops.Basic.Types
{
public class BasicOrganization : IHasIdentity
{
+ private string nameShort;
+
+ #region IHasIdentity Members
+
+ public int Identity
+ {
+ get { return OrganizationId; }
+ }
+
+ #endregion
+
public BasicOrganization()
{
}
- public BasicOrganization (int organizationId, string name, string nameInternational)
+ public BasicOrganization(int organizationId, string name, string nameInternational)
{
- this.organizationId = organizationId;
- this.name = name;
- this.nameInternational = nameInternational;
+ OrganizationId = organizationId;
+ Name = name;
+ NameInternational = nameInternational;
}
- public BasicOrganization (int organizationId, int parentOrganizationId, string name, string nameInternational) :
+ public BasicOrganization(int organizationId, int parentOrganizationId, string name, string nameInternational) :
this(organizationId, name, nameInternational)
{
- this.parentOrganizationId = parentOrganizationId;
+ ParentOrganizationId = parentOrganizationId;
}
- public BasicOrganization (int organizationId, int parentOrganizationId, string name, string nameInternational,
- string nameShort, string domain, string mailPrefix, int anchorGeographyId,
- bool acceptsMembers, bool autoAssignNewMembers,
- int defaultCountryId)
+ public BasicOrganization(int organizationId, int parentOrganizationId, string name, string nameInternational,
+ string nameShort, string domain, string mailPrefix, int anchorGeographyId,
+ bool acceptsMembers, bool autoAssignNewMembers,
+ int defaultCountryId)
: this(organizationId, parentOrganizationId, name, nameInternational)
{
this.nameShort = nameShort;
- this.domain = domain;
- this.mailPrefix = mailPrefix;
- this.anchorGeographyId = anchorGeographyId;
- this.acceptsMembers = acceptsMembers;
- this.autoAssignNewMembers = autoAssignNewMembers;
- this.defaultCountryId = defaultCountryId;
+ Domain = domain;
+ MailPrefix = mailPrefix;
+ AnchorGeographyId = anchorGeographyId;
+ AcceptsMembers = acceptsMembers;
+ AutoAssignNewMembers = autoAssignNewMembers;
+ DefaultCountryId = defaultCountryId;
}
- public BasicOrganization (BasicOrganization original)
+ public BasicOrganization(BasicOrganization original)
: this(
original.Identity, original.ParentOrganizationId, original.Name, original.NameInternational,
original.NameShort, original.Domain, original.MailPrefix, original.AnchorGeographyId,
@@ -45,23 +56,11 @@ namespace Swarmops.Basic.Types
{
}
- public int DefaultCountryId
- {
- get { return this.defaultCountryId; }
- protected set { this.defaultCountryId = value; }
- }
+ public int DefaultCountryId { get; protected set; }
- public string Name
- {
- get { return this.name; }
- protected set { this.name = value; }
- }
+ public string Name { get; protected set; }
- public string NameInternational
- {
- get { return this.nameInternational; }
- protected set { this.nameInternational = value; }
- }
+ public string NameInternational { get; protected set; }
public string NameShort
{
@@ -72,75 +71,23 @@ namespace Swarmops.Basic.Types
return this.nameShort;
}
- return this.Name;
- }
- set
- {
- this.nameShort = value;
+ return Name;
}
+ set { this.nameShort = value; }
}
- public string Domain
- {
- get { return this.domain; }
- protected set { this.domain = value; }
- }
+ public string Domain { get; protected set; }
- public string MailPrefix
- {
- get { return this.mailPrefix; }
- protected set { this.mailPrefix = value; }
- }
+ public string MailPrefix { get; protected set; }
- public int AnchorGeographyId
- {
- get { return this.anchorGeographyId; }
- protected set { this.anchorGeographyId = value; }
- }
+ public int AnchorGeographyId { get; protected set; }
- public bool AcceptsMembers
- {
- get { return this.acceptsMembers; }
- protected set { this.acceptsMembers=value; }
- }
+ public bool AcceptsMembers { get; protected set; }
- public int OrganizationId
- {
- get { return this.organizationId; }
- protected set { this.organizationId = value; }
- }
+ public int OrganizationId { get; protected set; }
- public int ParentOrganizationId
- {
- get { return this.parentOrganizationId; }
- protected set { this.parentOrganizationId = value; }
- }
+ public int ParentOrganizationId { get; protected set; }
- public bool AutoAssignNewMembers
- {
- get { return this.autoAssignNewMembers; }
- protected set { this.autoAssignNewMembers = value; }
- }
-
- private string name;
- private string nameInternational;
- private string nameShort;
- private string domain;
- private string mailPrefix;
- private int anchorGeographyId;
- private bool acceptsMembers;
- private bool autoAssignNewMembers;
- private int organizationId;
- private int parentOrganizationId;
- private int defaultCountryId;
-
- #region IHasIdentity Members
-
- public int Identity
- {
- get { return OrganizationId; }
- }
-
- #endregion
+ public bool AutoAssignNewMembers { get; protected set; }
}
}
\ No newline at end of file
diff --git a/Basic/Types/BasicOutboundInvoice.cs b/Basic/Types/BasicOutboundInvoice.cs
index 96ecb3d3..6868adc1 100644
--- a/Basic/Types/BasicOutboundInvoice.cs
+++ b/Basic/Types/BasicOutboundInvoice.cs
@@ -3,33 +3,39 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicOutboundInvoice: IHasIdentity
+ public class BasicOutboundInvoice : IHasIdentity
{
- public BasicOutboundInvoice (int outboundInvoiceId, string customerName, string invoiceAddressPaper, string invoiceAddressMail, int currencyId, int organizationId, int budgetId,
- DateTime createdDateTime, int createdByPersonId, DateTime dueDate, int reminderCount, string reference, bool domestic, bool open, bool sent, string securityCode, string theirReference)
+ public BasicOutboundInvoice(int outboundInvoiceId, string customerName, string invoiceAddressPaper,
+ string invoiceAddressMail, int currencyId, int organizationId, int budgetId,
+ DateTime createdDateTime, int createdByPersonId, DateTime dueDate, int reminderCount, string reference,
+ bool domestic, bool open, bool sent, string securityCode, string theirReference)
{
- this.OutboundInvoiceId = outboundInvoiceId;
- this.CustomerName = customerName;
- this.InvoiceAddressPaper = invoiceAddressPaper;
- this.InvoiceAddressMail = invoiceAddressMail;
- this.CurrencyId = currencyId;
- this.OrganizationId = organizationId;
- this.BudgetId = budgetId;
- this.CreatedDateTime = createdDateTime;
- this.CreatedByPersonId = createdByPersonId;
- this.DueDate = dueDate;
- this.ReminderCount = reminderCount;
- this.Reference = reference;
- this.Domestic = domestic;
- this.Open = open;
- this.Sent = sent;
- this.SecurityCode = securityCode;
- this.TheirReference = theirReference;
+ OutboundInvoiceId = outboundInvoiceId;
+ CustomerName = customerName;
+ InvoiceAddressPaper = invoiceAddressPaper;
+ InvoiceAddressMail = invoiceAddressMail;
+ CurrencyId = currencyId;
+ OrganizationId = organizationId;
+ BudgetId = budgetId;
+ CreatedDateTime = createdDateTime;
+ CreatedByPersonId = createdByPersonId;
+ DueDate = dueDate;
+ ReminderCount = reminderCount;
+ Reference = reference;
+ Domestic = domestic;
+ Open = open;
+ Sent = sent;
+ SecurityCode = securityCode;
+ TheirReference = theirReference;
}
- public BasicOutboundInvoice (BasicOutboundInvoice original):
- this (original.OutboundInvoiceId, original.CustomerName, original.InvoiceAddressPaper, original.InvoiceAddressMail, original.CurrencyId, original.OrganizationId, original.BudgetId, original.CreatedDateTime, original.CreatedByPersonId, original.DueDate, original.ReminderCount, original.Reference, original.Domestic, original.Open, original.Sent, original.SecurityCode, original.TheirReference)
+ public BasicOutboundInvoice(BasicOutboundInvoice original) :
+ this(
+ original.OutboundInvoiceId, original.CustomerName, original.InvoiceAddressPaper, original.InvoiceAddressMail,
+ original.CurrencyId, original.OrganizationId, original.BudgetId, original.CreatedDateTime,
+ original.CreatedByPersonId, original.DueDate, original.ReminderCount, original.Reference, original.Domestic,
+ original.Open, original.Sent, original.SecurityCode, original.TheirReference)
{
// empty copy ctor
}
@@ -55,7 +61,7 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.OutboundInvoiceId; }
+ get { return OutboundInvoiceId; }
}
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicOutboundInvoiceItem.cs b/Basic/Types/BasicOutboundInvoiceItem.cs
index c75c5f91..7c7d7e13 100644
--- a/Basic/Types/BasicOutboundInvoiceItem.cs
+++ b/Basic/Types/BasicOutboundInvoiceItem.cs
@@ -3,18 +3,19 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicOutboundInvoiceItem: IHasIdentity
+ public class BasicOutboundInvoiceItem : IHasIdentity
{
- public BasicOutboundInvoiceItem (int outboundInvoiceItemId, int outboundInvoiceId, string description, Int64 amountCents)
+ public BasicOutboundInvoiceItem(int outboundInvoiceItemId, int outboundInvoiceId, string description,
+ Int64 amountCents)
{
- this.OutboundInvoiceItemId = outboundInvoiceItemId;
- this.OutboundInvoiceId = outboundInvoiceId;
- this.Description = description;
- this.AmountCents = amountCents;
+ OutboundInvoiceItemId = outboundInvoiceItemId;
+ OutboundInvoiceId = outboundInvoiceId;
+ Description = description;
+ AmountCents = amountCents;
}
- public BasicOutboundInvoiceItem(BasicOutboundInvoiceItem original):
- this (original.OutboundInvoiceItemId, original.OutboundInvoiceId, original.Description, original.AmountCents)
+ public BasicOutboundInvoiceItem(BasicOutboundInvoiceItem original) :
+ this(original.OutboundInvoiceItemId, original.OutboundInvoiceId, original.Description, original.AmountCents)
{
// empty copy ctor
}
@@ -26,7 +27,7 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.OutboundInvoiceItemId; }
+ get { return OutboundInvoiceItemId; }
}
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicOutboundMail.cs b/Basic/Types/BasicOutboundMail.cs
index cc3d5492..dfa69373 100644
--- a/Basic/Types/BasicOutboundMail.cs
+++ b/Basic/Types/BasicOutboundMail.cs
@@ -14,15 +14,15 @@ namespace Swarmops.Basic.Types
///
- /// Basic constructor. This is for database use and NOT for public construction.
+ /// Basic constructor. This is for database use and NOT for public construction.
///
- public BasicOutboundMail (int outboundMailId, MailAuthorType authorType, int authorPersonId, string title,
- string body, int mailPriority, int mailTypeId, int organizationId,
- int geographyId,
- DateTime createdDateTime, DateTime releaseDateTime, bool readyForPickup, bool resolved,
- bool processed,
- DateTime resolvedDateTime, DateTime startProcessDateTime, DateTime endProcessDateTime,
- int recipientCount, int recipientsSuccess, int recipientsFail)
+ public BasicOutboundMail(int outboundMailId, MailAuthorType authorType, int authorPersonId, string title,
+ string body, int mailPriority, int mailTypeId, int organizationId,
+ int geographyId,
+ DateTime createdDateTime, DateTime releaseDateTime, bool readyForPickup, bool resolved,
+ bool processed,
+ DateTime resolvedDateTime, DateTime startProcessDateTime, DateTime endProcessDateTime,
+ int recipientCount, int recipientsSuccess, int recipientsFail)
{
this.outboundMailId = outboundMailId;
this.authorType = authorType;
@@ -49,24 +49,24 @@ namespace Swarmops.Basic.Types
}
///
- /// Constructor used by OutboundMail after creating record in db. NOT for other use
+ /// Constructor used by OutboundMail after creating record in db. NOT for other use
///
- public BasicOutboundMail (int outboundMailId, MailAuthorType authorType, int authorPersonId, string title,
- string body, int mailPriority, int mailType, int organizationId,
- int geographyId, DateTime createdDateTime, DateTime releaseDateTime)
+ public BasicOutboundMail(int outboundMailId, MailAuthorType authorType, int authorPersonId, string title,
+ string body, int mailPriority, int mailType, int organizationId,
+ int geographyId, DateTime createdDateTime, DateTime releaseDateTime)
: this(outboundMailId, authorType, authorPersonId, title, body,
- mailPriority, mailType, organizationId, geographyId,
- createdDateTime, releaseDateTime,
- false, false, false, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, 0, 0, 0)
+ mailPriority, mailType, organizationId, geographyId,
+ createdDateTime, releaseDateTime,
+ false, false, false, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, 0, 0, 0)
{
// nothing more to do
}
///
- /// Copy constructor. Used when PirateWeb.Logic constructs an OutboundMail object.
+ /// Copy constructor. Used when PirateWeb.Logic constructs an OutboundMail object.
///
/// The original to copy.
- public BasicOutboundMail (BasicOutboundMail original)
+ public BasicOutboundMail(BasicOutboundMail original)
: this(
original.outboundMailId, original.authorType, original.authorPersonId, original.title,
original.body, original.mailPriority, original.mailType,
@@ -87,11 +87,6 @@ namespace Swarmops.Basic.Types
// ============================
- public int Identity
- {
- get { return this.OutboundMailId; }
- }
-
public int OutboundMailId
{
get { return this.outboundMailId; }
@@ -185,6 +180,11 @@ namespace Swarmops.Basic.Types
set { this.recipientsFail = value; }
}
+ public int Identity
+ {
+ get { return OutboundMailId; }
+ }
+
#endregion
#region Private fields
@@ -194,26 +194,26 @@ namespace Swarmops.Basic.Types
// ==================
- private int outboundMailId;
- private MailAuthorType authorType;
- private int authorPersonId;
- private string title;
- private string body;
- private int mailPriority;
- private int mailType;
- private int geographyId;
- private int organizationId;
- private DateTime createdDateTime;
- private DateTime releaseDateTime;
- private bool readyForPickup;
- private bool resolved;
+ private readonly int authorPersonId;
+ private readonly MailAuthorType authorType;
+ private readonly string body;
+ private readonly DateTime createdDateTime;
+ private readonly DateTime endProcessDateTime;
+ private readonly int geographyId;
+ private readonly int mailPriority;
+ private readonly int mailType;
+ private readonly int organizationId;
+ private readonly int outboundMailId;
+ private readonly DateTime releaseDateTime;
+ private readonly DateTime resolvedDateTime;
private bool processed;
- private DateTime resolvedDateTime;
- private DateTime startProcessDateTime;
- private DateTime endProcessDateTime;
+ private bool readyForPickup;
private int recipientCount;
- private int recipientsSuccess;
private int recipientsFail;
+ private int recipientsSuccess;
+ private bool resolved;
+ private DateTime startProcessDateTime;
+ private string title;
#endregion
}
diff --git a/Basic/Types/BasicOutboundMailRecipient.cs b/Basic/Types/BasicOutboundMailRecipient.cs
index 1bfc13da..1ba40727 100644
--- a/Basic/Types/BasicOutboundMailRecipient.cs
+++ b/Basic/Types/BasicOutboundMailRecipient.cs
@@ -7,9 +7,10 @@ namespace Swarmops.Basic.Types
#region Creation and Construction
///
- /// Normal constructor.
+ /// Normal constructor.
///
- public BasicOutboundMailRecipient (int outboundMailRecipientId, int outboundMailId, int personId, bool asOfficer,int personType)
+ public BasicOutboundMailRecipient(int outboundMailRecipientId, int outboundMailId, int personId, bool asOfficer,
+ int personType)
{
this.outboundMailId = outboundMailId;
this.outboundMailRecipientId = outboundMailRecipientId;
@@ -19,10 +20,12 @@ namespace Swarmops.Basic.Types
}
///
- /// Copy constructor.
+ /// Copy constructor.
///
- public BasicOutboundMailRecipient (BasicOutboundMailRecipient original)
- : this(original.outboundMailRecipientId, original.outboundMailId, original.personId, original.asOfficer, original.personType)
+ public BasicOutboundMailRecipient(BasicOutboundMailRecipient original)
+ : this(
+ original.outboundMailRecipientId, original.outboundMailId, original.personId, original.asOfficer,
+ original.personType)
{
}
@@ -46,12 +49,6 @@ namespace Swarmops.Basic.Types
}
- public int Identity
- {
- get { return this.OutboundMailRecipientId; }
- }
-
-
public bool AsOfficer
{
get { return this.asOfficer; }
@@ -59,18 +56,23 @@ namespace Swarmops.Basic.Types
public int PersonType
{
- get { return this.personType ; }
+ get { return this.personType; }
+ }
+
+ public int Identity
+ {
+ get { return OutboundMailRecipientId; }
}
#endregion
#region Private fields
- private int outboundMailRecipientId;
- private int outboundMailId;
- private int personId;
- private bool asOfficer;
- private int personType = 0; //0 = Person, 1 = Reporter
+ private readonly bool asOfficer;
+ private readonly int outboundMailId;
+ private readonly int outboundMailRecipientId;
+ private readonly int personId;
+ private readonly int personType; //0 = Person, 1 = Reporter
#endregion
}
diff --git a/Basic/Types/BasicPWEvent.cs b/Basic/Types/BasicPWEvent.cs
index 44eddc4d..fd1723d8 100644
--- a/Basic/Types/BasicPWEvent.cs
+++ b/Basic/Types/BasicPWEvent.cs
@@ -1,25 +1,26 @@
using System;
+using Swarmops.Basic.Enums;
namespace Swarmops.Basic.Types
{
public class BasicPWEvent
{
- public BasicPWEvent (int eventId, DateTime dateTime, bool open, DateTime processedDateTime, Enums.EventType eventType,
- Enums.EventSource eventSource, int actingPersonId, int affectedPersonId, int organizationId,
- int geographyId, int parameterInt, string parameterText)
+ public BasicPWEvent(int eventId, DateTime dateTime, bool open, DateTime processedDateTime, EventType eventType,
+ EventSource eventSource, int actingPersonId, int affectedPersonId, int organizationId,
+ int geographyId, int parameterInt, string parameterText)
{
- this.EventId = eventId;
- this.DateTime = dateTime;
- this.Open = open;
- this.ProcessedDateTime = processedDateTime;
- this.EventType = eventType;
- this.EventSource = eventSource;
- this.ActingPersonId = actingPersonId;
- this.AffectedPersonId = affectedPersonId;
- this.OrganizationId = organizationId;
- this.GeographyId = geographyId;
- this.ParameterInt = parameterInt;
- this.ParameterText = parameterText;
+ EventId = eventId;
+ DateTime = dateTime;
+ Open = open;
+ ProcessedDateTime = processedDateTime;
+ EventType = eventType;
+ EventSource = eventSource;
+ ActingPersonId = actingPersonId;
+ AffectedPersonId = affectedPersonId;
+ OrganizationId = organizationId;
+ GeographyId = geographyId;
+ ParameterInt = parameterInt;
+ ParameterText = parameterText;
}
@@ -27,8 +28,8 @@ namespace Swarmops.Basic.Types
public DateTime ProcessedDateTime { get; protected set; }
public int EventId { get; private set; }
public bool Open { get; protected set; }
- public Enums.EventType EventType { get; private set; }
- public Enums.EventSource EventSource { get; private set; }
+ public EventType EventType { get; private set; }
+ public EventSource EventSource { get; private set; }
public int ActingPersonId { get; private set; }
public int AffectedPersonId { get; private set; }
public int OrganizationId { get; private set; }
diff --git a/Basic/Types/BasicPWLog.cs b/Basic/Types/BasicPWLog.cs
index 540f1c94..80bf4bee 100644
--- a/Basic/Types/BasicPWLog.cs
+++ b/Basic/Types/BasicPWLog.cs
@@ -5,17 +5,29 @@ namespace Swarmops.Basic.Types
[Serializable]
public class BasicPWLog
{
- public BasicPWLog ( DateTime dateTimeUtc,
- int actingPersonId,
- string affectedItemType,
- int affectedItemId,
- string actionType,
- string actionDescription,
- string changedField,
- string valueBefore,
- string valueAfter,
- string comment,
- string ipAddress)
+ private int actingPersonId;
+ private string actionDescription;
+ private string actionType;
+ private int affectedItemId;
+ private string affectedItemType;
+ private string changedField;
+ private string comment;
+ private DateTime dateTimeUtc;
+ private string ipAddress;
+ private string valueAfter;
+ private string valueBefore;
+
+ public BasicPWLog(DateTime dateTimeUtc,
+ int actingPersonId,
+ string affectedItemType,
+ int affectedItemId,
+ string actionType,
+ string actionDescription,
+ string changedField,
+ string valueBefore,
+ string valueAfter,
+ string comment,
+ string ipAddress)
{
this.dateTimeUtc = dateTimeUtc;
this.actingPersonId = actingPersonId;
@@ -28,87 +40,73 @@ namespace Swarmops.Basic.Types
this.valueAfter = valueAfter;
this.comment = comment;
this.ipAddress = ipAddress;
-
}
public DateTime DateTimeUtc
{
- get { return dateTimeUtc; }
- set { dateTimeUtc = value; }
+ get { return this.dateTimeUtc; }
+ set { this.dateTimeUtc = value; }
}
public int ActingPersonId
{
- get { return actingPersonId; }
- set { actingPersonId = value; }
+ get { return this.actingPersonId; }
+ set { this.actingPersonId = value; }
}
public string AffectedItemType
{
- get { return affectedItemType; }
- set { affectedItemType = value; }
+ get { return this.affectedItemType; }
+ set { this.affectedItemType = value; }
}
public int AffectedItemId
{
- get { return affectedItemId; }
- set { affectedItemId = value; }
+ get { return this.affectedItemId; }
+ set { this.affectedItemId = value; }
}
public string ActionType
{
- get { return actionType; }
- set { actionType = value; }
+ get { return this.actionType; }
+ set { this.actionType = value; }
}
public string ActionDescription
{
- get { return actionDescription; }
- set { actionDescription = value; }
+ get { return this.actionDescription; }
+ set { this.actionDescription = value; }
}
public string ChangedField
{
- get { return changedField; }
- set { changedField = value; }
+ get { return this.changedField; }
+ set { this.changedField = value; }
}
public string ValueBefore
{
- get { return valueBefore; }
- set { valueBefore = value; }
+ get { return this.valueBefore; }
+ set { this.valueBefore = value; }
}
public string ValueAfter
{
- get { return valueAfter; }
- set { valueAfter = value; }
+ get { return this.valueAfter; }
+ set { this.valueAfter = value; }
}
public string Comment
{
- get { return comment; }
- set { comment = value; }
+ get { return this.comment; }
+ set { this.comment = value; }
}
public string IpAddress
{
- get { return ipAddress; }
- set { ipAddress = value; }
+ get { return this.ipAddress; }
+ set { this.ipAddress = value; }
}
-
- private DateTime dateTimeUtc;
- private int actingPersonId;
- private string affectedItemType;
- private int affectedItemId;
- private string actionType;
- private string actionDescription;
- private string changedField;
- private string valueBefore;
- private string valueAfter;
- private string comment;
- private string ipAddress;
-
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicPaperLetter.cs b/Basic/Types/BasicPaperLetter.cs
index d69ed4a2..dc792994 100644
--- a/Basic/Types/BasicPaperLetter.cs
+++ b/Basic/Types/BasicPaperLetter.cs
@@ -4,27 +4,29 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicPaperLetter: IHasIdentity
+ public class BasicPaperLetter : IHasIdentity
{
- public BasicPaperLetter (int paperLetterId, int organizationId, string fromName, string replyAddress,
- DateTime receivedDate, int toPersonId, RoleType toPersonInRole, bool personal, int uploadedByPersonId, DateTime uploadedDateTime)
+ public BasicPaperLetter(int paperLetterId, int organizationId, string fromName, string replyAddress,
+ DateTime receivedDate, int toPersonId, RoleType toPersonInRole, bool personal, int uploadedByPersonId,
+ DateTime uploadedDateTime)
{
- this.PaperLetterId = paperLetterId;
- this.OrganizationId = organizationId;
- this.FromName = fromName;
- this.ReplyAddress = replyAddress;
- this.ReceivedDate = receivedDate;
- this.ToPersonId = toPersonId;
- this.ToPersonInRole = toPersonInRole;
- this.Personal = personal;
- this.UploadedByPersonId = uploadedByPersonId;
- this.UploadedDateTime = uploadedDateTime;
+ PaperLetterId = paperLetterId;
+ OrganizationId = organizationId;
+ FromName = fromName;
+ ReplyAddress = replyAddress;
+ ReceivedDate = receivedDate;
+ ToPersonId = toPersonId;
+ ToPersonInRole = toPersonInRole;
+ Personal = personal;
+ UploadedByPersonId = uploadedByPersonId;
+ UploadedDateTime = uploadedDateTime;
}
- public BasicPaperLetter (BasicPaperLetter original)
- : this (original.PaperLetterId, original.OrganizationId, original.FromName, original.ReplyAddress,
- original.ReceivedDate, original.ToPersonId, original.ToPersonInRole, original.Personal, original.UploadedByPersonId,
- original.UploadedDateTime)
+ public BasicPaperLetter(BasicPaperLetter original)
+ : this(original.PaperLetterId, original.OrganizationId, original.FromName, original.ReplyAddress,
+ original.ReceivedDate, original.ToPersonId, original.ToPersonInRole, original.Personal,
+ original.UploadedByPersonId,
+ original.UploadedDateTime)
{
// empty copy ctor
}
@@ -45,9 +47,9 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.PaperLetterId; }
+ get { return PaperLetterId; }
}
#endregion
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicParley.cs b/Basic/Types/BasicParley.cs
index d23261f1..f3e0dae5 100644
--- a/Basic/Types/BasicParley.cs
+++ b/Basic/Types/BasicParley.cs
@@ -3,32 +3,38 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicParley: IHasIdentity
+ public class BasicParley : IHasIdentity
{
- public BasicParley (int parleyId, int organizationId, int personId, int budgetId, DateTime createdDateTime, bool open, bool attested, string name, int geographyId, string description, string informationUrl, DateTime startDate, DateTime endDate, Int64 budgetCents, Int64 guaranteeCents,
+ public BasicParley(int parleyId, int organizationId, int personId, int budgetId, DateTime createdDateTime,
+ bool open, bool attested, string name, int geographyId, string description, string informationUrl,
+ DateTime startDate, DateTime endDate, Int64 budgetCents, Int64 guaranteeCents,
Int64 attendanceFeeCents, DateTime closedDateTime)
{
- this.ParleyId = parleyId;
- this.OrganizationId = organizationId;
- this.PersonId = personId;
- this.BudgetId = budgetId;
- this.CreatedDateTime = createdDateTime;
- this.Open = open;
- this.Attested = attested;
- this.Name = name;
- this.GeographyId = geographyId;
- this.Description = description;
- this.InformationUrl = informationUrl;
- this.StartDate = startDate;
- this.EndDate = endDate;
- this.BudgetCents = budgetCents;
- this.GuaranteeCents = guaranteeCents;
- this.AttendanceFeeCents = attendanceFeeCents;
- this.ClosedDateTime = closedDateTime;
+ ParleyId = parleyId;
+ OrganizationId = organizationId;
+ PersonId = personId;
+ BudgetId = budgetId;
+ CreatedDateTime = createdDateTime;
+ Open = open;
+ Attested = attested;
+ Name = name;
+ GeographyId = geographyId;
+ Description = description;
+ InformationUrl = informationUrl;
+ StartDate = startDate;
+ EndDate = endDate;
+ BudgetCents = budgetCents;
+ GuaranteeCents = guaranteeCents;
+ AttendanceFeeCents = attendanceFeeCents;
+ ClosedDateTime = closedDateTime;
}
- public BasicParley (BasicParley original)
- : this (original.ParleyId, original.OrganizationId, original.PersonId, original.BudgetId, original.CreatedDateTime, original.Open, original.Attested, original.Name, original.GeographyId, original.Description, original.InformationUrl, original.StartDate, original.EndDate, original.BudgetCents, original.GuaranteeCents, original.AttendanceFeeCents, original.ClosedDateTime)
+ public BasicParley(BasicParley original)
+ : this(
+ original.ParleyId, original.OrganizationId, original.PersonId, original.BudgetId,
+ original.CreatedDateTime, original.Open, original.Attested, original.Name, original.GeographyId,
+ original.Description, original.InformationUrl, original.StartDate, original.EndDate,
+ original.BudgetCents, original.GuaranteeCents, original.AttendanceFeeCents, original.ClosedDateTime)
{
// empty copy ctor
}
@@ -54,7 +60,7 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.ParleyId; }
+ get { return ParleyId; }
}
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicParleyAttendee.cs b/Basic/Types/BasicParleyAttendee.cs
index 89a0be3d..7dc0169d 100644
--- a/Basic/Types/BasicParleyAttendee.cs
+++ b/Basic/Types/BasicParleyAttendee.cs
@@ -3,22 +3,26 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicParleyAttendee: IHasIdentity
+ public class BasicParleyAttendee : IHasIdentity
{
- public BasicParleyAttendee (int parleyAttendeeId, int parleyId, int personId, DateTime signupDateTime, bool active, DateTime cancelDateTime, bool invoiced, int outboundInvoiceId, bool isGuest)
+ public BasicParleyAttendee(int parleyAttendeeId, int parleyId, int personId, DateTime signupDateTime,
+ bool active, DateTime cancelDateTime, bool invoiced, int outboundInvoiceId, bool isGuest)
{
- this.ParleyAttendeeId = parleyAttendeeId;
- this.ParleyId = parleyId;
- this.PersonId = personId;
- this.SignupDateTime = signupDateTime;
- this.Active = active;
- this.CancelDateTime = cancelDateTime;
- this.Invoiced = invoiced;
- this.OutboundInvoiceId = outboundInvoiceId;
+ ParleyAttendeeId = parleyAttendeeId;
+ ParleyId = parleyId;
+ PersonId = personId;
+ SignupDateTime = signupDateTime;
+ Active = active;
+ CancelDateTime = cancelDateTime;
+ Invoiced = invoiced;
+ OutboundInvoiceId = outboundInvoiceId;
}
public BasicParleyAttendee(BasicParleyAttendee original)
- : this (original.ParleyAttendeeId, original.ParleyId, original.PersonId, original.SignupDateTime, original.Active, original.CancelDateTime, original.Invoiced, original.OutboundInvoiceId, original.IsGuest)
+ : this(
+ original.ParleyAttendeeId, original.ParleyId, original.PersonId, original.SignupDateTime,
+ original.Active, original.CancelDateTime, original.Invoiced, original.OutboundInvoiceId,
+ original.IsGuest)
{
// empty copy ctor
}
@@ -35,7 +39,7 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.ParleyAttendeeId; }
+ get { return ParleyAttendeeId; }
}
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicParleyOption.cs b/Basic/Types/BasicParleyOption.cs
index 778d7077..4ec39789 100644
--- a/Basic/Types/BasicParleyOption.cs
+++ b/Basic/Types/BasicParleyOption.cs
@@ -3,19 +3,20 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicParleyOption: IHasIdentity
+ public class BasicParleyOption : IHasIdentity
{
- public BasicParleyOption (int parleyOptionId, int parleyId, string description, Int64 amountCents, bool active)
+ public BasicParleyOption(int parleyOptionId, int parleyId, string description, Int64 amountCents, bool active)
{
- this.ParleyOptionId = parleyOptionId;
- this.ParleyId = parleyId;
- this.Description = description;
- this.AmountCents = amountCents;
- this.Active = active;
+ ParleyOptionId = parleyOptionId;
+ ParleyId = parleyId;
+ Description = description;
+ AmountCents = amountCents;
+ Active = active;
}
- public BasicParleyOption (BasicParleyOption original)
- : this (original.ParleyOptionId, original.ParleyId, original.Description, original.AmountCents, original.Active)
+ public BasicParleyOption(BasicParleyOption original)
+ : this(
+ original.ParleyOptionId, original.ParleyId, original.Description, original.AmountCents, original.Active)
{
// empty copy ctor
}
@@ -28,7 +29,7 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.ParleyOptionId; }
+ get { return ParleyOptionId; }
}
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicPayment.cs b/Basic/Types/BasicPayment.cs
index 6b15e245..f4f2ee68 100644
--- a/Basic/Types/BasicPayment.cs
+++ b/Basic/Types/BasicPayment.cs
@@ -3,22 +3,25 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicPayment: IHasIdentity
+ public class BasicPayment : IHasIdentity
{
- public BasicPayment (int paymentId, int paymentGroupId, Int64 amountCents, string reference, string fromAccount, string key, bool hasImage, int outboundInvoiceId)
+ public BasicPayment(int paymentId, int paymentGroupId, Int64 amountCents, string reference, string fromAccount,
+ string key, bool hasImage, int outboundInvoiceId)
{
- this.PaymentId = paymentId;
- this.PaymentGroupId = paymentGroupId;
- this.AmountCents = amountCents;
- this.Reference = reference;
- this.FromAccount = fromAccount;
- this.Key = key;
- this.HasImage = hasImage;
- this.OutboundInvoiceId = outboundInvoiceId;
+ PaymentId = paymentId;
+ PaymentGroupId = paymentGroupId;
+ AmountCents = amountCents;
+ Reference = reference;
+ FromAccount = fromAccount;
+ Key = key;
+ HasImage = hasImage;
+ OutboundInvoiceId = outboundInvoiceId;
}
- public BasicPayment (BasicPayment original)
- : this (original.PaymentId, original.PaymentGroupId, original.AmountCents, original.Reference, original.FromAccount, original.Key, original.HasImage, original.OutboundInvoiceId)
+ public BasicPayment(BasicPayment original)
+ : this(
+ original.PaymentId, original.PaymentGroupId, original.AmountCents, original.Reference,
+ original.FromAccount, original.Key, original.HasImage, original.OutboundInvoiceId)
{
// empty copy ctor
}
@@ -28,13 +31,13 @@ namespace Swarmops.Basic.Types
public Int64 AmountCents { get; private set; }
public string Reference { get; private set; }
public string FromAccount { get; private set; }
- public string Key { get; private set; } // may need to expand with URL or similar later
+ public string Key { get; private set; } // may need to expand with URL or similar later
public bool HasImage { get; private set; }
public int OutboundInvoiceId { get; protected set; }
public int Identity
{
- get { return this.PaymentId; }
+ get { return PaymentId; }
}
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicPaymentCode.cs b/Basic/Types/BasicPaymentCode.cs
index 73ba05d0..f67e5f85 100644
--- a/Basic/Types/BasicPaymentCode.cs
+++ b/Basic/Types/BasicPaymentCode.cs
@@ -5,8 +5,23 @@ namespace Swarmops.Basic.Types
{
public class BasicPaymentCode : IHasIdentity
{
- public BasicPaymentCode (int paymentCodeId, string paymentCode, string issuedToPhoneNumber, int issuedToPersonId,
- bool claimed)
+ private readonly int issuedToPersonId;
+ private readonly string issuedToPhoneNumber;
+ private readonly string paymentCode;
+ private readonly int paymentCodeId;
+ private bool claimed;
+
+ #region IHasIdentity Members
+
+ public int Identity
+ {
+ get { return PaymentCodeId; }
+ }
+
+ #endregion
+
+ public BasicPaymentCode(int paymentCodeId, string paymentCode, string issuedToPhoneNumber, int issuedToPersonId,
+ bool claimed)
{
this.paymentCodeId = paymentCodeId;
this.paymentCode = paymentCode;
@@ -15,7 +30,7 @@ namespace Swarmops.Basic.Types
this.claimed = claimed;
}
- public BasicPaymentCode (BasicPaymentCode original)
+ public BasicPaymentCode(BasicPaymentCode original)
: this(
original.paymentCodeId, original.paymentCode, original.issuedToPhoneNumber, original.issuedToPersonId,
original.claimed)
@@ -50,42 +65,24 @@ namespace Swarmops.Basic.Types
}
+ public PaymentCodeIssueType IssueType
+ {
+ get
+ {
+ if (this.issuedToPersonId == 0)
+ {
+ return PaymentCodeIssueType.Phone;
+ }
+ return PaymentCodeIssueType.Person;
+ }
+ }
+
protected void SetClaimed()
{
this.claimed = true;
}
- public PaymentCodeIssueType IssueType
- {
- get
- {
- if (issuedToPersonId == 0)
- {
- return PaymentCodeIssueType.Phone;
- }
- else
- {
- return PaymentCodeIssueType.Person;
- }
- }
- }
-
-
- private int paymentCodeId;
- private string paymentCode;
- private string issuedToPhoneNumber;
- private int issuedToPersonId;
- private bool claimed;
//private bool balanced;
-
- #region IHasIdentity Members
-
- public int Identity
- {
- get { return this.PaymentCodeId; }
- }
-
- #endregion
}
}
\ No newline at end of file
diff --git a/Basic/Types/BasicPaymentGroup.cs b/Basic/Types/BasicPaymentGroup.cs
index 654c86fb..76bbc27f 100644
--- a/Basic/Types/BasicPaymentGroup.cs
+++ b/Basic/Types/BasicPaymentGroup.cs
@@ -3,23 +3,26 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicPaymentGroup: IHasIdentity
+ public class BasicPaymentGroup : IHasIdentity
{
- public BasicPaymentGroup (int paymentGroupId, int organizationId, DateTime dateTime, int currencyId, Int64 amountCents, string tag, int createdByPersonId, DateTime createdDateTime, bool open)
+ public BasicPaymentGroup(int paymentGroupId, int organizationId, DateTime dateTime, int currencyId,
+ Int64 amountCents, string tag, int createdByPersonId, DateTime createdDateTime, bool open)
{
- this.PaymentGroupId = paymentGroupId;
- this.OrganizationId = organizationId;
- this.Tag = tag;
- this.DateTime = dateTime;
- this.AmountCents = amountCents;
- this.CurrencyId = currencyId;
- this.CreatedByPersonId = createdByPersonId;
- this.CreatedDateTime = createdDateTime;
- this.Open = open;
+ PaymentGroupId = paymentGroupId;
+ OrganizationId = organizationId;
+ Tag = tag;
+ DateTime = dateTime;
+ AmountCents = amountCents;
+ CurrencyId = currencyId;
+ CreatedByPersonId = createdByPersonId;
+ CreatedDateTime = createdDateTime;
+ Open = open;
}
- public BasicPaymentGroup (BasicPaymentGroup original)
- : this(original.PaymentGroupId, original.OrganizationId, original.DateTime, original.CurrencyId, original.AmountCents, original.Tag, original.CreatedByPersonId, original.CreatedDateTime, original.Open)
+ public BasicPaymentGroup(BasicPaymentGroup original)
+ : this(
+ original.PaymentGroupId, original.OrganizationId, original.DateTime, original.CurrencyId,
+ original.AmountCents, original.Tag, original.CreatedByPersonId, original.CreatedDateTime, original.Open)
{
// empty copy ctor
}
@@ -36,7 +39,7 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.PaymentGroupId; }
+ get { return PaymentGroupId; }
}
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicPaymentInformation.cs b/Basic/Types/BasicPaymentInformation.cs
index b2d2879c..36d97c2b 100644
--- a/Basic/Types/BasicPaymentInformation.cs
+++ b/Basic/Types/BasicPaymentInformation.cs
@@ -2,14 +2,14 @@ namespace Swarmops.Basic.Types
{
public class BasicPaymentInformation
{
- public BasicPaymentInformation (PaymentInformationType type, string data)
+ public BasicPaymentInformation(PaymentInformationType type, string data)
{
- this.Type = type;
- this.Data = data;
+ Type = type;
+ Data = data;
}
- public BasicPaymentInformation (BasicPaymentInformation original)
- : this (original.Type, original.Data)
+ public BasicPaymentInformation(BasicPaymentInformation original)
+ : this(original.Type, original.Data)
{
// empty copy ctor
}
@@ -22,45 +22,55 @@ namespace Swarmops.Basic.Types
public enum PaymentInformationType
{
Unknown = 0,
+
///
- /// The payer's name as supplied by the bank.
+ /// The payer's name as supplied by the bank.
///
Name,
+
///
- /// The payer's street as and if supplied by the bank.
+ /// The payer's street as and if supplied by the bank.
///
Street,
+
///
- /// The payer's postal code as and if supplied by the bank.
+ /// The payer's postal code as and if supplied by the bank.
///
PostalCode,
+
///
- /// The payer's city as and if supplied by the bank.
+ /// The payer's city as and if supplied by the bank.
///
City,
+
///
- /// The payer's org# or person# as and if supplied by the bank.
+ /// The payer's org# or person# as and if supplied by the bank.
///
OrgNumber,
+
///
- /// Freeform information supplied by payer.
+ /// Freeform information supplied by payer.
///
Freeform,
+
///
- /// The payer's country as and if supplied by the bank.
+ /// The payer's country as and if supplied by the bank.
///
Country,
+
///
- /// The payer's country code as and if supplied by the bank.
+ /// The payer's country code as and if supplied by the bank.
///
CountryCode,
+
///
- /// Payer's email as and if supplied by the bank.
+ /// Payer's email as and if supplied by the bank.
///
Email,
+
///
- /// Information needed to perform a future refund.
+ /// Information needed to perform a future refund.
///
RefundInformation
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicPayout.cs b/Basic/Types/BasicPayout.cs
index 92d61745..fdc00535 100644
--- a/Basic/Types/BasicPayout.cs
+++ b/Basic/Types/BasicPayout.cs
@@ -3,32 +3,32 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicPayout: IHasIdentity
+ public class BasicPayout : IHasIdentity
{
- public BasicPayout (int payoutId, int organizationId, string bank, string account,
+ public BasicPayout(int payoutId, int organizationId, string bank, string account,
string reference, Int64 amountCents, DateTime expectedTransactionDate, bool open,
DateTime createdDateTime, int createdByPersonId)
{
- this.PayoutId = payoutId;
- this.OrganizationId = organizationId;
- this.Bank = bank;
- this.Account = account;
- this.Reference = reference;
- this.AmountCents = amountCents;
- this.ExpectedTransactionDate = expectedTransactionDate;
- this.Open = open;
- this.CreatedDateTime = createdDateTime;
- this.CreatedByPersonId = createdByPersonId;
+ PayoutId = payoutId;
+ OrganizationId = organizationId;
+ Bank = bank;
+ Account = account;
+ Reference = reference;
+ AmountCents = amountCents;
+ ExpectedTransactionDate = expectedTransactionDate;
+ Open = open;
+ CreatedDateTime = createdDateTime;
+ CreatedByPersonId = createdByPersonId;
}
public BasicPayout(BasicPayout original) :
this(original.PayoutId, original.OrganizationId, original.Bank, original.Account,
- original.Reference, original.AmountCents, original.ExpectedTransactionDate, original.Open,
- original.CreatedDateTime, original.CreatedByPersonId)
+ original.Reference, original.AmountCents, original.ExpectedTransactionDate, original.Open,
+ original.CreatedDateTime, original.CreatedByPersonId)
{
// empty copy ctor
}
-
+
public int PayoutId { get; private set; }
public int OrganizationId { get; protected set; }
public string Bank { get; protected set; }
@@ -44,9 +44,9 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.PayoutId; }
+ get { return PayoutId; }
}
#endregion
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicPayrollAdjustment.cs b/Basic/Types/BasicPayrollAdjustment.cs
index 6d860de9..cc979af2 100644
--- a/Basic/Types/BasicPayrollAdjustment.cs
+++ b/Basic/Types/BasicPayrollAdjustment.cs
@@ -3,23 +3,26 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicPayrollAdjustment: IHasIdentity
+ public class BasicPayrollAdjustment : IHasIdentity
{
- public BasicPayrollAdjustment (int payrollAdjustmentId, int payrollItemId, PayrollAdjustmentType type, Int64 amountCents,
+ public BasicPayrollAdjustment(int payrollAdjustmentId, int payrollItemId, PayrollAdjustmentType type,
+ Int64 amountCents,
string description, bool open, int salaryId)
{
- this.PayrollAdjustmentId = payrollAdjustmentId;
- this.PayrollItemId = payrollItemId;
- this.Type = type;
- this.AmountCents = amountCents;
- this.Description = description;
- this.Open = open;
- this.SalaryId = salaryId;
+ PayrollAdjustmentId = payrollAdjustmentId;
+ PayrollItemId = payrollItemId;
+ Type = type;
+ AmountCents = amountCents;
+ Description = description;
+ Open = open;
+ SalaryId = salaryId;
}
- public BasicPayrollAdjustment (BasicPayrollAdjustment original)
- : this (original.PayrollAdjustmentId, original.PayrollItemId, original.Type, original.AmountCents, original.Description, original.Open, original.SalaryId)
+ public BasicPayrollAdjustment(BasicPayrollAdjustment original)
+ : this(
+ original.PayrollAdjustmentId, original.PayrollItemId, original.Type, original.AmountCents,
+ original.Description, original.Open, original.SalaryId)
{
// empty copy ctor
}
@@ -32,9 +35,10 @@ namespace Swarmops.Basic.Types
public string Description { get; private set; }
public bool Open { get; protected set; }
public int SalaryId { get; protected set; }
+
public int Identity
{
- get { return this.PayrollAdjustmentId; }
+ get { return PayrollAdjustmentId; }
}
}
@@ -42,16 +46,18 @@ namespace Swarmops.Basic.Types
public enum PayrollAdjustmentType
{
///
- /// Undefined value
+ /// Undefined value
///
Unknown = 0,
+
///
- /// Adjustment to salary BEFORE tax (sick leave, etc)
+ /// Adjustment to salary BEFORE tax (sick leave, etc)
///
GrossAdjustment = 1,
+
///
- /// Adjustment to salary AFTER tax (expenses, etc)
+ /// Adjustment to salary AFTER tax (expenses, etc)
///
NetAdjustment = 2
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicPayrollItem.cs b/Basic/Types/BasicPayrollItem.cs
index 09dd0c0b..87a33227 100644
--- a/Basic/Types/BasicPayrollItem.cs
+++ b/Basic/Types/BasicPayrollItem.cs
@@ -3,81 +3,93 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicPayrollItem: IHasIdentity
+ public class BasicPayrollItem : IHasIdentity
{
- public BasicPayrollItem (int payrollItemId, int personId, int organizationId, int countryId, DateTime employedDate,
+ public BasicPayrollItem(int payrollItemId, int personId, int organizationId, int countryId,
+ DateTime employedDate,
int reportsToPersonId, Int64 baseSalaryCents, int budgetId, bool open, DateTime terminatedDate,
int subtractiveTaxLevelId, double additiveTaxLevel)
{
- this.PayrollItemId = payrollItemId;
- this.PersonId = personId;
- this.OrganizationId = organizationId;
- this.CountryId = countryId;
- this.EmployedDate = employedDate;
- this.ReportsToPersonId = reportsToPersonId;
- this.BaseSalaryCents = baseSalaryCents;
- this.BudgetId = budgetId;
- this.Open = open;
- this.TerminatedDate = terminatedDate;
- this.SubtractiveTaxLevelId = subtractiveTaxLevelId;
- this.AdditiveTaxLevel = additiveTaxLevel;
+ PayrollItemId = payrollItemId;
+ PersonId = personId;
+ OrganizationId = organizationId;
+ CountryId = countryId;
+ EmployedDate = employedDate;
+ ReportsToPersonId = reportsToPersonId;
+ BaseSalaryCents = baseSalaryCents;
+ BudgetId = budgetId;
+ Open = open;
+ TerminatedDate = terminatedDate;
+ SubtractiveTaxLevelId = subtractiveTaxLevelId;
+ AdditiveTaxLevel = additiveTaxLevel;
}
- public BasicPayrollItem (BasicPayrollItem original)
- :this (original.PayrollItemId, original.PersonId, original.OrganizationId, original.CountryId,
- original.EmployedDate, original.ReportsToPersonId, original.BaseSalaryCents, original.BudgetId,
- original.Open, original.TerminatedDate, original.SubtractiveTaxLevelId, original.AdditiveTaxLevel)
+ public BasicPayrollItem(BasicPayrollItem original)
+ : this(original.PayrollItemId, original.PersonId, original.OrganizationId, original.CountryId,
+ original.EmployedDate, original.ReportsToPersonId, original.BaseSalaryCents, original.BudgetId,
+ original.Open, original.TerminatedDate, original.SubtractiveTaxLevelId, original.AdditiveTaxLevel)
{
// empty copy constructor
}
///
- /// Gets the identity of the payroll item. Also accessible through Identity.
+ /// Gets the identity of the payroll item. Also accessible through Identity.
///
public int PayrollItemId { get; private set; }
+
///
- /// The employed person Id.
+ /// The employed person Id.
///
public int PersonId { get; private set; }
+
///
- /// The employing organization.
+ /// The employing organization.
///
public int OrganizationId { get; private set; }
+
///
- /// The employment country (for tax laws and such).
+ /// The employment country (for tax laws and such).
///
public int CountryId { get; private set; }
+
///
- /// The date of employment.
+ /// The date of employment.
///
public DateTime EmployedDate { get; private set; }
+
///
- /// The person above this person in the org chart.
+ /// The person above this person in the org chart.
///
public int ReportsToPersonId { get; protected set; }
+
///
- /// The base gross montly salary in the local currency.
+ /// The base gross montly salary in the local currency.
///
public Int64 BaseSalaryCents { get; protected set; }
+
///
- /// The budget charged with the costs of this employment.
+ /// The budget charged with the costs of this employment.
///
public int BudgetId { get; protected set; }
+
///
- /// True if this employment is still active.
+ /// True if this employment is still active.
///
public bool Open { get; protected set; }
+
///
- /// If closed, this field contains the date the employment ended.
+ /// If closed, this field contains the date the employment ended.
///
public DateTime TerminatedDate { get; protected set; }
+
///
- /// The tax level code of the country of employment. Subtracted from gross salary to get net salary.
+ /// The tax level code of the country of employment. Subtracted from gross salary to get net salary.
///
public int SubtractiveTaxLevelId { get; protected set; }
+
///
- /// The tax level, as a fraction, paid by the organization on top of the gross salary.
+ /// The tax level, as a fraction, paid by the organization on top of the gross salary.
///
public double AdditiveTaxLevel { get; protected set; }
@@ -85,9 +97,9 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.PayrollItemId; }
+ get { return PayrollItemId; }
}
#endregion
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicPermission.cs b/Basic/Types/BasicPermission.cs
index 9d2b8006..a244e0a4 100644
--- a/Basic/Types/BasicPermission.cs
+++ b/Basic/Types/BasicPermission.cs
@@ -4,13 +4,13 @@ namespace Swarmops.Basic.Types
{
public class BasicPermission
{
- public RoleType RoleType;
public Permission PermissionType;
+ public RoleType RoleType;
- public BasicPermission (RoleType pRoleType, Permission pPermissionType)
+ public BasicPermission(RoleType pRoleType, Permission pPermissionType)
{
- RoleType = pRoleType;
- PermissionType = pPermissionType;
+ this.RoleType = pRoleType;
+ this.PermissionType = pPermissionType;
}
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicPerson.cs b/Basic/Types/BasicPerson.cs
index 17e67740..f721c81e 100644
--- a/Basic/Types/BasicPerson.cs
+++ b/Basic/Types/BasicPerson.cs
@@ -4,39 +4,37 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
-
-
[Serializable]
public class BasicPerson : IEmailPerson, IHasIdentity
{
- public BasicPerson (string name, string email)
+ public BasicPerson(string name, string email)
{
- this.Name = name;
- this.Email = email;
+ Name = name;
+ Email = email;
}
- public BasicPerson (int personId, string passwordHash, string name, string email, string street,
- string postalCode, string cityName, int countryId, string phone, int geographyId,
- DateTime birthdate, PersonGender gender)
+ public BasicPerson(int personId, string passwordHash, string name, string email, string street,
+ string postalCode, string cityName, int countryId, string phone, int geographyId,
+ DateTime birthdate, PersonGender gender)
{
- this.PersonId = personId;
- this.PasswordHash = passwordHash;
- this.Name = name;
- this.Email = email;
- this.Street = street;
- this.PostalCode = postalCode;
- this.CityName = cityName;
- this.CountryId = countryId;
- this.Phone = phone;
- this.GeographyId = geographyId;
- this.Birthdate = birthdate;
- this.Gender = gender;
+ PersonId = personId;
+ PasswordHash = passwordHash;
+ Name = name;
+ Email = email;
+ Street = street;
+ PostalCode = postalCode;
+ CityName = cityName;
+ CountryId = countryId;
+ Phone = phone;
+ GeographyId = geographyId;
+ Birthdate = birthdate;
+ Gender = gender;
}
- public BasicPerson (BasicPerson original)
- : this (original.PersonId, original.PasswordHash, original.Name, original.Email, original.Street,
- original.PostalCode, original.CityName, original.CountryId, original.Phone,
- original.GeographyId, original.Birthdate, original.Gender)
+ public BasicPerson(BasicPerson original)
+ : this(original.PersonId, original.PasswordHash, original.Name, original.Email, original.Street,
+ original.PostalCode, original.CityName, original.CountryId, original.Phone,
+ original.GeographyId, original.Birthdate, original.Gender)
{
}
@@ -53,8 +51,6 @@ namespace Swarmops.Basic.Types
public int PersonId { get; private set; }
- public string Name { get; protected set; }
- public string Email { get; protected set; }
public string Street { get; protected set; }
public string PostalCode { get; protected set; }
public string CityName { get; protected set; }
@@ -64,14 +60,13 @@ namespace Swarmops.Basic.Types
public int GeographyId { get; protected set; }
public int CountryId { get; protected set; }
public PersonGender Gender { get; protected set; }
+ public string Name { get; protected set; }
+ public string Email { get; protected set; }
public int Identity
{
get { return PersonId; }
}
-
-
-
}
}
\ No newline at end of file
diff --git a/Basic/Types/BasicPersonRole.cs b/Basic/Types/BasicPersonRole.cs
index 8782d112..45d21849 100644
--- a/Basic/Types/BasicPersonRole.cs
+++ b/Basic/Types/BasicPersonRole.cs
@@ -5,18 +5,33 @@ namespace Swarmops.Basic.Types
{
public class BasicPersonRole : IHasIdentity
{
- protected BasicPersonRole ()
+ private readonly int geographyId;
+ private readonly int organizationId;
+ private readonly int personId;
+ private readonly int roleId;
+ private readonly RoleType type;
+
+ #region IHasIdentity Members
+
+ public int Identity
+ {
+ get { return RoleId; }
+ }
+
+ #endregion
+
+ protected BasicPersonRole()
{
}
///
- /// Normal constructor.
+ /// Normal constructor.
///
/// The person Id.
/// The node-specific role.
/// The organization Id.
/// The node Id.
- public BasicPersonRole (int roleId, int personId, RoleType type, int organizationId, int geographyId)
+ public BasicPersonRole(int roleId, int personId, RoleType type, int organizationId, int geographyId)
{
this.roleId = roleId;
this.personId = personId;
@@ -26,9 +41,9 @@ namespace Swarmops.Basic.Types
}
///
- /// Copy constructor.
+ /// Copy constructor.
///
- public BasicPersonRole (BasicPersonRole original)
+ public BasicPersonRole(BasicPersonRole original)
: this(original.roleId, original.personId, original.type, original.organizationId, original.geographyId)
{
}
@@ -58,20 +73,5 @@ namespace Swarmops.Basic.Types
{
get { return this.geographyId; }
}
-
- private int roleId;
- private int personId;
- private RoleType type;
- private int organizationId;
- private int geographyId;
-
- #region IHasIdentity Members
-
- public int Identity
- {
- get { return this.RoleId; }
- }
-
- #endregion
}
}
\ No newline at end of file
diff --git a/Basic/Types/BasicPostalCode.cs b/Basic/Types/BasicPostalCode.cs
index 414e87dd..366126bc 100644
--- a/Basic/Types/BasicPostalCode.cs
+++ b/Basic/Types/BasicPostalCode.cs
@@ -7,10 +7,10 @@ namespace Swarmops.Basic.Types
{
public BasicPostalCode(int postalCodeId, string postalCode, int cityId, int countryId)
{
- this.PostalCodeId = postalCodeId;
- this.PostalCode = postalCode.Replace(" ", "");
- this.CityId = cityId;
- this.CountryId = countryId;
+ PostalCodeId = postalCodeId;
+ PostalCode = postalCode.Replace(" ", "");
+ CityId = cityId;
+ CountryId = countryId;
}
public BasicPostalCode(BasicPostalCode original)
@@ -18,15 +18,15 @@ namespace Swarmops.Basic.Types
{
}
- [Obsolete ("Do not call this ctor directly. It exists to enable serialization.", true)]
+ [Obsolete("Do not call this ctor directly. It exists to enable serialization.", true)]
public BasicPostalCode()
{
// this should never be called from code
}
public int PostalCodeId { get; private set; }
- public string PostalCode { get; private set; } // any whitespace removed
+ public string PostalCode { get; private set; } // any whitespace removed
public int CityId { get; protected set; }
public int CountryId { get; protected set; }
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicRefund.cs b/Basic/Types/BasicRefund.cs
index fac6383c..39ad2415 100644
--- a/Basic/Types/BasicRefund.cs
+++ b/Basic/Types/BasicRefund.cs
@@ -3,21 +3,24 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicRefund: IHasIdentity
+ public class BasicRefund : IHasIdentity
{
- public BasicRefund (int refundId, int paymentId, bool open, Int64 amountCents, int createdByPersonId, DateTime createdDateTime, DateTime closedDateTime)
+ public BasicRefund(int refundId, int paymentId, bool open, Int64 amountCents, int createdByPersonId,
+ DateTime createdDateTime, DateTime closedDateTime)
{
- this.RefundId = refundId;
- this.PaymentId = paymentId;
- this.Open = open;
- this.AmountCents = amountCents;
- this.CreatedByPersonId = createdByPersonId;
- this.CreatedDateTime = createdDateTime;
- this.ClosedDateTime = closedDateTime;
+ RefundId = refundId;
+ PaymentId = paymentId;
+ Open = open;
+ AmountCents = amountCents;
+ CreatedByPersonId = createdByPersonId;
+ CreatedDateTime = createdDateTime;
+ ClosedDateTime = closedDateTime;
}
public BasicRefund(BasicRefund original)
- :this (original.RefundId, original.PaymentId, original.Open, original.AmountCents, original.CreatedByPersonId, original.CreatedDateTime, original.ClosedDateTime)
+ : this(
+ original.RefundId, original.PaymentId, original.Open, original.AmountCents, original.CreatedByPersonId,
+ original.CreatedDateTime, original.ClosedDateTime)
{
// Empty copy ctor
}
@@ -32,7 +35,7 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.RefundId; }
+ get { return RefundId; }
}
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicReporter.cs b/Basic/Types/BasicReporter.cs
index 7bd972e6..1add44ff 100644
--- a/Basic/Types/BasicReporter.cs
+++ b/Basic/Types/BasicReporter.cs
@@ -4,7 +4,21 @@ namespace Swarmops.Basic.Types
{
public class BasicReporter : IEmailPerson, IHasIdentity
{
- public BasicReporter (int reporterId, string name, string email, int[] mediaCategoryIds)
+ private readonly string email;
+ private readonly string name;
+ private readonly int reporterId;
+ private int[] mediaCategoryIds; // null if not loaded
+
+ #region IHasIdentity Members
+
+ public int Identity
+ {
+ get { return ReporterId; }
+ }
+
+ #endregion
+
+ public BasicReporter(int reporterId, string name, string email, int[] mediaCategoryIds)
{
this.reporterId = reporterId;
this.name = name;
@@ -12,17 +26,17 @@ namespace Swarmops.Basic.Types
this.mediaCategoryIds = mediaCategoryIds;
}
- public BasicReporter (BasicReporter original) :
+ public BasicReporter(BasicReporter original) :
this(original.reporterId, original.name, original.email, original.mediaCategoryIds)
{
}
public BasicReporter()
{
- reporterId = 0;
- name = string.Empty;
- email = string.Empty;
- mediaCategoryIds = new int[0];
+ this.reporterId = 0;
+ this.name = string.Empty;
+ this.email = string.Empty;
+ this.mediaCategoryIds = new int[0];
}
public int ReporterId
@@ -30,6 +44,12 @@ namespace Swarmops.Basic.Types
get { return this.reporterId; }
}
+ public int[] MediaCategoryIds
+ {
+ get { return this.mediaCategoryIds; }
+ set { this.mediaCategoryIds = value; } // this is an exception to the norm
+ }
+
public string Name
{
get { return this.name; }
@@ -39,26 +59,5 @@ namespace Swarmops.Basic.Types
{
get { return this.email; }
}
-
- public int[] MediaCategoryIds
- {
- get { return this.mediaCategoryIds; }
- set { this.mediaCategoryIds = value; } // this is an exception to the norm
- }
-
-
- private int reporterId;
- private string name;
- private string email;
- private int[] mediaCategoryIds; // null if not loaded
-
- #region IHasIdentity Members
-
- public int Identity
- {
- get { return ReporterId; }
- }
-
- #endregion
}
}
\ No newline at end of file
diff --git a/Basic/Types/BasicSalary.cs b/Basic/Types/BasicSalary.cs
index 859dec0e..81f5a339 100644
--- a/Basic/Types/BasicSalary.cs
+++ b/Basic/Types/BasicSalary.cs
@@ -3,28 +3,32 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicSalary: IHasIdentity
+ public class BasicSalary : IHasIdentity
{
- public BasicSalary (int salaryId, int payrollItemId, DateTime payoutDate, Int64 baseSalaryCents, Int64 netSalaryCents,
+ public BasicSalary(int salaryId, int payrollItemId, DateTime payoutDate, Int64 baseSalaryCents,
+ Int64 netSalaryCents,
Int64 subtractiveTaxCents, Int64 additiveTaxCents, bool attested, bool netPaid, bool taxPaid, bool open)
{
- this.SalaryId = salaryId;
- this.PayrollItemId = payrollItemId;
- this.PayoutDate = payoutDate;
- this.BaseSalaryCents = baseSalaryCents;
- this.NetSalaryCents = netSalaryCents;
- this.SubtractiveTaxCents = subtractiveTaxCents;
- this.AdditiveTaxCents = additiveTaxCents;
- this.Attested = attested;
- this.NetPaid = netPaid;
- this.TaxPaid = taxPaid;
- this.Open = open;
+ SalaryId = salaryId;
+ PayrollItemId = payrollItemId;
+ PayoutDate = payoutDate;
+ BaseSalaryCents = baseSalaryCents;
+ NetSalaryCents = netSalaryCents;
+ SubtractiveTaxCents = subtractiveTaxCents;
+ AdditiveTaxCents = additiveTaxCents;
+ Attested = attested;
+ NetPaid = netPaid;
+ TaxPaid = taxPaid;
+ Open = open;
}
- public BasicSalary (BasicSalary original)
- :this (original.SalaryId, original.PayrollItemId, original.PayoutDate, original.BaseSalaryCents, original.NetSalaryCents,
- original.SubtractiveTaxCents, original.AdditiveTaxCents, original.Attested, original.NetPaid, original.TaxPaid,
- original.Open)
+ public BasicSalary(BasicSalary original)
+ : this(
+ original.SalaryId, original.PayrollItemId, original.PayoutDate, original.BaseSalaryCents,
+ original.NetSalaryCents,
+ original.SubtractiveTaxCents, original.AdditiveTaxCents, original.Attested, original.NetPaid,
+ original.TaxPaid,
+ original.Open)
{
// empty copy constructor
}
@@ -45,9 +49,9 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.SalaryId; }
+ get { return SalaryId; }
}
#endregion
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicSupplier.cs b/Basic/Types/BasicSupplier.cs
index 0e4a6968..31a8b4c1 100644
--- a/Basic/Types/BasicSupplier.cs
+++ b/Basic/Types/BasicSupplier.cs
@@ -3,20 +3,24 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicSupplier: IHasIdentity
+ public class BasicSupplier : IHasIdentity
{
- public BasicSupplier (int supplierId, string name, string email, string passwordHash, string bankAccount, DateTime createdDateTime, int createdByPersonId)
+ public BasicSupplier(int supplierId, string name, string email, string passwordHash, string bankAccount,
+ DateTime createdDateTime, int createdByPersonId)
{
- this.SupplierId = supplierId;
- this.Name = name;
- this.Email = email;
- this.PasswordHash = passwordHash;
- this.BankAccount = bankAccount;
- this.CreatedDateTime = createdDateTime;
- this.CreatedByPersonId = createdByPersonId;
+ SupplierId = supplierId;
+ Name = name;
+ Email = email;
+ PasswordHash = passwordHash;
+ BankAccount = bankAccount;
+ CreatedDateTime = createdDateTime;
+ CreatedByPersonId = createdByPersonId;
}
- public BasicSupplier(BasicSupplier original): this (original.SupplierId, original.Name, original.Email, original.PasswordHash, original.BankAccount, original.CreatedDateTime, original.CreatedByPersonId)
+ public BasicSupplier(BasicSupplier original)
+ : this(
+ original.SupplierId, original.Name, original.Email, original.PasswordHash, original.BankAccount,
+ original.CreatedDateTime, original.CreatedByPersonId)
{
// empty copy ctor
}
@@ -31,7 +35,7 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.SupplierId; }
+ get { return SupplierId; }
}
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicSwarmopsLogEntry.cs b/Basic/Types/BasicSwarmopsLogEntry.cs
index 82a55339..9819e671 100644
--- a/Basic/Types/BasicSwarmopsLogEntry.cs
+++ b/Basic/Types/BasicSwarmopsLogEntry.cs
@@ -3,19 +3,22 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
- public class BasicSwarmopsLogEntry: IHasIdentity
+ public class BasicSwarmopsLogEntry : IHasIdentity
{
- public BasicSwarmopsLogEntry (int swarmopsLogEntryId, int personId, DateTime dateTime, int entryTypeId, string entryXml)
+ public BasicSwarmopsLogEntry(int swarmopsLogEntryId, int personId, DateTime dateTime, int entryTypeId,
+ string entryXml)
{
- this.SwarmopsLogEntryId = swarmopsLogEntryId;
- this.PersonId = personId;
- this.DateTime = dateTime;
- this.EntryTypeId = entryTypeId;
- this.EntryXml = entryXml;
+ SwarmopsLogEntryId = swarmopsLogEntryId;
+ PersonId = personId;
+ DateTime = dateTime;
+ EntryTypeId = entryTypeId;
+ EntryXml = entryXml;
}
- public BasicSwarmopsLogEntry (BasicSwarmopsLogEntry original)
- : this (original.SwarmopsLogEntryId, original.PersonId, original.DateTime, original.EntryTypeId, original.EntryXml)
+ public BasicSwarmopsLogEntry(BasicSwarmopsLogEntry original)
+ : this(
+ original.SwarmopsLogEntryId, original.PersonId, original.DateTime, original.EntryTypeId,
+ original.EntryXml)
{
// copy ctor
}
@@ -28,7 +31,7 @@ namespace Swarmops.Basic.Types
public int Identity
{
- get { return this.SwarmopsLogEntryId; }
+ get { return SwarmopsLogEntryId; }
}
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicUptakeGeography.cs b/Basic/Types/BasicUptakeGeography.cs
index 72664fe5..05d92a9f 100644
--- a/Basic/Types/BasicUptakeGeography.cs
+++ b/Basic/Types/BasicUptakeGeography.cs
@@ -1,36 +1,36 @@
namespace Swarmops.Basic.Types
{
-
- public class BasicUptakeGeography
+ public class BasicUptakeGeography
+ {
+ private int geoId;
+ private int orgId;
+
+ public BasicUptakeGeography(int pOrgId, int pGeoId)
{
- int orgId;
- public int OrgId
- {
- get { return orgId; }
- set { orgId = value; }
- }
- int geoId;
- public int GeoId
- {
- get { return geoId; }
- set { geoId = value; }
- }
-
- public BasicUptakeGeography (int pOrgId, int pGeoId)
- {
- orgId = pOrgId;
- geoId = pGeoId;
- }
-
- public BasicUptakeGeography ()
- {
- }
-
- public BasicUptakeGeography (BasicUptakeGeography other)
- {
- this.orgId = other.orgId;
- this.geoId = other.geoId;
- }
+ this.orgId = pOrgId;
+ this.geoId = pGeoId;
}
-}
+ public BasicUptakeGeography()
+ {
+ }
+
+ public BasicUptakeGeography(BasicUptakeGeography other)
+ {
+ this.orgId = other.orgId;
+ this.geoId = other.geoId;
+ }
+
+ public int OrgId
+ {
+ get { return this.orgId; }
+ set { this.orgId = value; }
+ }
+
+ public int GeoId
+ {
+ get { return this.geoId; }
+ set { this.geoId = value; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Basic/Types/BasicVolunteer.cs b/Basic/Types/BasicVolunteer.cs
index cd40e63d..0689fc4e 100644
--- a/Basic/Types/BasicVolunteer.cs
+++ b/Basic/Types/BasicVolunteer.cs
@@ -5,8 +5,16 @@ namespace Swarmops.Basic.Types
{
public class BasicVolunteer : IHasIdentity
{
- public BasicVolunteer (int volunteerId, int personId, int ownerPersonId, DateTime openedDateTime,
- bool open, DateTime closedDateTime, string closingComments)
+ private readonly DateTime closedDateTime;
+ private readonly string closingComments;
+ private readonly bool open;
+ private readonly DateTime openedDateTime;
+ private readonly int ownerPersonId;
+ private readonly int personId;
+ private readonly int volunteerId;
+
+ public BasicVolunteer(int volunteerId, int personId, int ownerPersonId, DateTime openedDateTime,
+ bool open, DateTime closedDateTime, string closingComments)
{
this.volunteerId = volunteerId;
this.personId = personId;
@@ -17,22 +25,13 @@ namespace Swarmops.Basic.Types
this.closingComments = closingComments;
}
- public BasicVolunteer (BasicVolunteer original)
+ public BasicVolunteer(BasicVolunteer original)
: this(original.volunteerId, original.personId, original.ownerPersonId, original.openedDateTime,
- original.open, original.closedDateTime, original.closingComments)
+ original.open, original.closedDateTime, original.closingComments)
{
// copy ctor
}
-
- private int volunteerId;
- private int personId;
- private int ownerPersonId;
- private DateTime openedDateTime;
- private bool open;
- private DateTime closedDateTime;
- private string closingComments;
-
public int VolunteerId
{
get { return this.volunteerId; }
diff --git a/Basic/Types/BasicVolunteerRole.cs b/Basic/Types/BasicVolunteerRole.cs
index 5b37bb7a..31652e92 100644
--- a/Basic/Types/BasicVolunteerRole.cs
+++ b/Basic/Types/BasicVolunteerRole.cs
@@ -5,8 +5,16 @@ namespace Swarmops.Basic.Types
{
public class BasicVolunteerRole : IHasIdentity
{
- public BasicVolunteerRole (int volunteerRoleId, int volunteerId, int organizationId, int geographyId,
- RoleType roleType, bool open, bool assigned)
+ private readonly bool assigned;
+ private readonly int geographyId;
+ private readonly bool open;
+ private readonly int organizationId;
+ private readonly RoleType roleType;
+ private readonly int volunteerId;
+ private readonly int volunteerRoleId;
+
+ public BasicVolunteerRole(int volunteerRoleId, int volunteerId, int organizationId, int geographyId,
+ RoleType roleType, bool open, bool assigned)
{
this.volunteerRoleId = volunteerRoleId;
this.volunteerId = volunteerId;
@@ -17,21 +25,12 @@ namespace Swarmops.Basic.Types
this.assigned = assigned;
}
- public BasicVolunteerRole (BasicVolunteerRole original)
+ public BasicVolunteerRole(BasicVolunteerRole original)
: this(original.volunteerRoleId, original.volunteerId, original.organizationId, original.geographyId,
- original.roleType, original.open, original.assigned)
+ original.roleType, original.open, original.assigned)
{
}
-
- private int volunteerRoleId;
- private int volunteerId;
- private int organizationId;
- private int geographyId;
- private RoleType roleType;
- private bool open;
- private bool assigned;
-
public int VolunteerRoleId
{
get { return this.volunteerRoleId; }
diff --git a/Basic/Types/Communications/BasicAutoMail.cs b/Basic/Types/Communications/BasicAutoMail.cs
index d489049d..a5ba80ad 100644
--- a/Basic/Types/Communications/BasicAutoMail.cs
+++ b/Basic/Types/Communications/BasicAutoMail.cs
@@ -5,11 +5,19 @@ namespace Swarmops.Basic.Types.Communications
{
public class BasicAutoMail : IHasIdentity
{
+ private readonly int authorPersonId;
+ private readonly int autoMailId;
+ private readonly int geographyId;
+ private readonly int organizationId;
+ private readonly string title;
+ private readonly AutoMailType type;
+ private string body;
+
///
- /// Basic constructor.
+ /// Basic constructor.
///
- public BasicAutoMail (int autoMailId, AutoMailType type, int organizationId, int geographyId,
- int authorPersonId, string title, string body)
+ public BasicAutoMail(int autoMailId, AutoMailType type, int organizationId, int geographyId,
+ int authorPersonId, string title, string body)
{
this.autoMailId = autoMailId;
this.type = type;
@@ -22,11 +30,11 @@ namespace Swarmops.Basic.Types.Communications
///
- /// Copy constructor.
+ /// Copy constructor.
///
- public BasicAutoMail (BasicAutoMail original)
+ public BasicAutoMail(BasicAutoMail original)
: this(original.autoMailId, original.type, original.organizationId, original.geographyId,
- original.authorPersonId, original.title, original.body)
+ original.authorPersonId, original.title, original.body)
{
}
@@ -35,11 +43,6 @@ namespace Swarmops.Basic.Types.Communications
get { return this.autoMailId; }
}
- public int Identity
- {
- get { return this.AutoMailId; }
- }
-
public AutoMailType Type
{
get { return this.type; }
@@ -71,12 +74,9 @@ namespace Swarmops.Basic.Types.Communications
set { this.body = value; }
}
- private int autoMailId;
- private AutoMailType type;
- private int organizationId;
- private int geographyId;
- private int authorPersonId;
- private string title;
- private string body;
+ public int Identity
+ {
+ get { return AutoMailId; }
+ }
}
}
\ No newline at end of file
diff --git a/Basic/Types/Communications/BasicOutboundComm.cs b/Basic/Types/Communications/BasicOutboundComm.cs
index 0595620b..f33c9059 100644
--- a/Basic/Types/Communications/BasicOutboundComm.cs
+++ b/Basic/Types/Communications/BasicOutboundComm.cs
@@ -4,41 +4,47 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types.Communications
{
- public class BasicOutboundComm: IHasIdentity
+ public class BasicOutboundComm : IHasIdentity
{
- public BasicOutboundComm (int outboundCommId, int senderPersonId, int fromPersonId, int organizationId, DateTime createdDateTime, string resolverClass, string recipientDataXml, bool resolved, DateTime resolvedDateTime, OutboundCommPriority priority, string transmitterClass, string payloadXml,
- bool open, DateTime startTransmitDateTime, DateTime closedDateTime, int recipientCount, int recipientsSuccess, int recipientsFail)
+ public BasicOutboundComm(int outboundCommId, int senderPersonId, int fromPersonId, int organizationId,
+ DateTime createdDateTime, string resolverClass, string recipientDataXml, bool resolved,
+ DateTime resolvedDateTime, OutboundCommPriority priority, string transmitterClass, string payloadXml,
+ bool open, DateTime startTransmitDateTime, DateTime closedDateTime, int recipientCount,
+ int recipientsSuccess, int recipientsFail)
{
- this.OutboundCommId = outboundCommId;
- this.SenderPersonId = senderPersonId;
- this.FromPersonId = fromPersonId;
- this.OrganizationId = organizationId;
- this.CreatedDateTime = createdDateTime;
- this.ResolverClass = resolverClass;
- this.RecipientDataXml = recipientDataXml;
- this.Resolved = resolved;
- this.ResolvedDateTime = resolvedDateTime;
- this.Priority = priority;
- this.TransmitterClass = transmitterClass;
- this.PayloadXml = payloadXml;
- this.Open = open;
- this.StartTransmitDateTime = startTransmitDateTime;
- this.ClosedDateTime = closedDateTime;
- this.RecipientCount = recipientCount;
- this.RecipientsSuccess = recipientsSuccess;
- this.RecipeintsFail = recipientsFail;
+ OutboundCommId = outboundCommId;
+ SenderPersonId = senderPersonId;
+ FromPersonId = fromPersonId;
+ OrganizationId = organizationId;
+ CreatedDateTime = createdDateTime;
+ ResolverClass = resolverClass;
+ RecipientDataXml = recipientDataXml;
+ Resolved = resolved;
+ ResolvedDateTime = resolvedDateTime;
+ Priority = priority;
+ TransmitterClass = transmitterClass;
+ PayloadXml = payloadXml;
+ Open = open;
+ StartTransmitDateTime = startTransmitDateTime;
+ ClosedDateTime = closedDateTime;
+ RecipientCount = recipientCount;
+ RecipientsSuccess = recipientsSuccess;
+ RecipeintsFail = recipientsFail;
}
- public BasicOutboundComm (BasicOutboundComm original) :
- this (original.OutboundCommId, original.SenderPersonId, original.FromPersonId, original.OrganizationId, original.CreatedDateTime, original.ResolverClass, original.RecipientDataXml, original.Resolved, original.ResolvedDateTime, original.Priority, original.TransmitterClass, original.PayloadXml,
- original.Open, original.StartTransmitDateTime, original.ClosedDateTime, original.RecipientCount, original.RecipientsSuccess, original.RecipeintsFail)
+ public BasicOutboundComm(BasicOutboundComm original) :
+ this(
+ original.OutboundCommId, original.SenderPersonId, original.FromPersonId, original.OrganizationId,
+ original.CreatedDateTime, original.ResolverClass, original.RecipientDataXml, original.Resolved,
+ original.ResolvedDateTime, original.Priority, original.TransmitterClass, original.PayloadXml,
+ original.Open, original.StartTransmitDateTime, original.ClosedDateTime, original.RecipientCount,
+ original.RecipientsSuccess, original.RecipeintsFail)
{
// copy ctor
}
-
public int OutboundCommId { get; private set; }
public int SenderPersonId { get; private set; }
public int FromPersonId { get; private set; }
@@ -58,15 +64,13 @@ namespace Swarmops.Basic.Types.Communications
public int RecipientsSuccess { get; protected set; }
public int RecipeintsFail { get; protected set; }
-
-
#region Implementation of IHasIdentity
public int Identity
{
- get { return this.OutboundCommId; }
+ get { return OutboundCommId; }
}
#endregion
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/Communications/BasicOutboundCommRecipient.cs b/Basic/Types/Communications/BasicOutboundCommRecipient.cs
index 3b8895c6..1d587460 100644
--- a/Basic/Types/Communications/BasicOutboundCommRecipient.cs
+++ b/Basic/Types/Communications/BasicOutboundCommRecipient.cs
@@ -2,20 +2,23 @@
namespace Swarmops.Basic.Types.Communications
{
- public class BasicOutboundCommRecipient: IHasIdentity
+ public class BasicOutboundCommRecipient : IHasIdentity
{
- public BasicOutboundCommRecipient (int outboundCommRecipientId, int outboundCommId, int personId, bool open, bool success, string failReason)
+ public BasicOutboundCommRecipient(int outboundCommRecipientId, int outboundCommId, int personId, bool open,
+ bool success, string failReason)
{
- this.OutboundCommRecipientId = outboundCommRecipientId;
- this.OutboundCommId = outboundCommId;
- this.PersonId = personId;
- this.Open = open;
- this.Success = success;
- this.FailReason = failReason;
+ OutboundCommRecipientId = outboundCommRecipientId;
+ OutboundCommId = outboundCommId;
+ PersonId = personId;
+ Open = open;
+ Success = success;
+ FailReason = failReason;
}
- public BasicOutboundCommRecipient (BasicOutboundCommRecipient original):
- this (original.OutboundCommRecipientId, original.OutboundCommId, original.PersonId, original.Open, original.Success, original.FailReason)
+ public BasicOutboundCommRecipient(BasicOutboundCommRecipient original) :
+ this(
+ original.OutboundCommRecipientId, original.OutboundCommId, original.PersonId, original.Open,
+ original.Success, original.FailReason)
{
// copy ctor
}
@@ -31,9 +34,9 @@ namespace Swarmops.Basic.Types.Communications
public int Identity
{
- get { return this.OutboundCommRecipientId; }
+ get { return OutboundCommRecipientId; }
}
#endregion
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/Financial/BasicCashAdvance.cs b/Basic/Types/Financial/BasicCashAdvance.cs
index c71f4d6a..ed0a836a 100644
--- a/Basic/Types/Financial/BasicCashAdvance.cs
+++ b/Basic/Types/Financial/BasicCashAdvance.cs
@@ -4,30 +4,33 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types.Financial
{
[Serializable]
- public class BasicCashAdvance: IHasIdentity
+ public class BasicCashAdvance : IHasIdentity
{
- public BasicCashAdvance(int cashAdvanceId, int organizationId, int personId, DateTime createdDateTime, int createdByPersonId,
- int financialAccountId, Int64 amountCents, string description, bool open, bool attested,
+ public BasicCashAdvance(int cashAdvanceId, int organizationId, int personId, DateTime createdDateTime,
+ int createdByPersonId,
+ int financialAccountId, Int64 amountCents, string description, bool open, bool attested,
bool paidOut, int attestedByPersonId, DateTime attestedDateTime)
{
- this.CashAdvanceId = cashAdvanceId;
- this.OrganizationId = organizationId;
- this.PersonId = personId;
- this.CreatedDateTime = createdDateTime;
- this.CreatedByPersonId = createdByPersonId;
- this.BudgetId = financialAccountId;
- this.AmountCents = amountCents;
- this.Description = description;
- this.Open = open;
- this.Attested = attested;
- this.PaidOut = paidOut;
- this.AttestedByPersonId = attestedByPersonId;
- this.AttestedDateTime = attestedDateTime;
+ CashAdvanceId = cashAdvanceId;
+ OrganizationId = organizationId;
+ PersonId = personId;
+ CreatedDateTime = createdDateTime;
+ CreatedByPersonId = createdByPersonId;
+ BudgetId = financialAccountId;
+ AmountCents = amountCents;
+ Description = description;
+ Open = open;
+ Attested = attested;
+ PaidOut = paidOut;
+ AttestedByPersonId = attestedByPersonId;
+ AttestedDateTime = attestedDateTime;
}
- public BasicCashAdvance (BasicCashAdvance original):
- this(original.CashAdvanceId, original.OrganizationId, original.PersonId, original.CreatedDateTime, original.CreatedByPersonId,
- original.BudgetId, original.AmountCents,original.Description, original.Open, original.Attested,
+ public BasicCashAdvance(BasicCashAdvance original) :
+ this(
+ original.CashAdvanceId, original.OrganizationId, original.PersonId, original.CreatedDateTime,
+ original.CreatedByPersonId,
+ original.BudgetId, original.AmountCents, original.Description, original.Open, original.Attested,
original.PaidOut, original.AttestedByPersonId, original.AttestedDateTime)
{
// copy ctor - no action other than copying original object
@@ -55,6 +58,9 @@ namespace Swarmops.Basic.Types.Financial
// IHasIdentity interface
- public int Identity { get { return this.CashAdvanceId; } }
+ public int Identity
+ {
+ get { return CashAdvanceId; }
+ }
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/Financial/BasicFinancialAccount.cs b/Basic/Types/Financial/BasicFinancialAccount.cs
index 709fa548..c0d9fce9 100644
--- a/Basic/Types/Financial/BasicFinancialAccount.cs
+++ b/Basic/Types/Financial/BasicFinancialAccount.cs
@@ -5,29 +5,33 @@ namespace Swarmops.Basic.Types.Financial
{
public class BasicFinancialAccount : IHasIdentity
{
- public BasicFinancialAccount (int financialAccountId, string name, FinancialAccountType accountType,
- int organizationId, int parentFinancialAccountId, int ownerPersonId,
- bool open, int openedYear, int closedYear, bool active, bool expensable,
- bool administrative, int linkBackward, int linkForward)
+ public BasicFinancialAccount(int financialAccountId, string name, FinancialAccountType accountType,
+ int organizationId, int parentFinancialAccountId, int ownerPersonId,
+ bool open, int openedYear, int closedYear, bool active, bool expensable,
+ bool administrative, int linkBackward, int linkForward)
{
- this.FinancialAccountId = financialAccountId;
- this.Name = name;
- this.AccountType = accountType;
- this.OrganizationId = organizationId;
- this.OwnerPersonId = ownerPersonId;
- this.ParentFinancialAccountId = parentFinancialAccountId;
- this.Open = open;
- this.OpenedYear = openedYear;
- this.ClosedYear = closedYear;
- this.Active = active;
- this.Expensable = expensable;
- this.Administrative = administrative;
- this.LinkBackward = linkBackward;
- this.LinkForward = linkForward;
+ FinancialAccountId = financialAccountId;
+ Name = name;
+ AccountType = accountType;
+ OrganizationId = organizationId;
+ OwnerPersonId = ownerPersonId;
+ ParentFinancialAccountId = parentFinancialAccountId;
+ Open = open;
+ OpenedYear = openedYear;
+ ClosedYear = closedYear;
+ Active = active;
+ Expensable = expensable;
+ Administrative = administrative;
+ LinkBackward = linkBackward;
+ LinkForward = linkForward;
}
- public BasicFinancialAccount (BasicFinancialAccount original) :
- this(original.Identity, original.Name, original.AccountType, original.OrganizationId, original.ParentFinancialAccountId, original.OwnerPersonId, original.Open, original.OpenedYear, original.ClosedYear, original.Active, original.Expensable, original.Administrative, original.LinkBackward, original.LinkForward)
+ public BasicFinancialAccount(BasicFinancialAccount original) :
+ this(
+ original.Identity, original.Name, original.AccountType, original.OrganizationId,
+ original.ParentFinancialAccountId, original.OwnerPersonId, original.Open, original.OpenedYear,
+ original.ClosedYear, original.Active, original.Expensable, original.Administrative, original.LinkBackward,
+ original.LinkForward)
{
// Empty copy constructor
}
@@ -52,7 +56,7 @@ namespace Swarmops.Basic.Types.Financial
public int Identity
{
- get { return this.FinancialAccountId; }
+ get { return FinancialAccountId; }
}
#endregion
diff --git a/Basic/Types/Financial/BasicFinancialAccountRow.cs b/Basic/Types/Financial/BasicFinancialAccountRow.cs
index 1acf8a06..b6416ee1 100644
--- a/Basic/Types/Financial/BasicFinancialAccountRow.cs
+++ b/Basic/Types/Financial/BasicFinancialAccountRow.cs
@@ -4,21 +4,22 @@ namespace Swarmops.Basic.Types.Financial
{
public class BasicFinancialAccountRow
{
- public BasicFinancialAccountRow (int financialAccountId, int financialTransactionId, DateTime dateTime,
- string comment, Int64 amountCents, DateTime rowDateTime, int rowCreatedByPersonId)
+ public BasicFinancialAccountRow(int financialAccountId, int financialTransactionId, DateTime dateTime,
+ string comment, Int64 amountCents, DateTime rowDateTime, int rowCreatedByPersonId)
{
- this.FinancialAccountId = financialAccountId;
- this.FinancialTransactionId = financialTransactionId;
- this.TransactionDateTime = dateTime;
- this.Description = comment;
- this.AmountCents = amountCents;
- this.RowDateTime = rowDateTime;
- this.RowCreatedByPersonId = rowCreatedByPersonId;
+ FinancialAccountId = financialAccountId;
+ FinancialTransactionId = financialTransactionId;
+ TransactionDateTime = dateTime;
+ Description = comment;
+ AmountCents = amountCents;
+ RowDateTime = rowDateTime;
+ RowCreatedByPersonId = rowCreatedByPersonId;
}
- public BasicFinancialAccountRow (BasicFinancialAccountRow original)
+ public BasicFinancialAccountRow(BasicFinancialAccountRow original)
: this(
- original.FinancialAccountId, original.FinancialTransactionId, original.TransactionDateTime, original.Description,
+ original.FinancialAccountId, original.FinancialTransactionId, original.TransactionDateTime,
+ original.Description,
original.AmountCents, original.RowDateTime, original.RowCreatedByPersonId)
{
}
@@ -30,6 +31,5 @@ namespace Swarmops.Basic.Types.Financial
public Int64 AmountCents { get; private set; }
public DateTime RowDateTime { get; private set; }
public int RowCreatedByPersonId { get; private set; }
-
}
}
\ No newline at end of file
diff --git a/Basic/Types/Financial/BasicFinancialDependency.cs b/Basic/Types/Financial/BasicFinancialDependency.cs
index da5f3864..f7a9535a 100644
--- a/Basic/Types/Financial/BasicFinancialDependency.cs
+++ b/Basic/Types/Financial/BasicFinancialDependency.cs
@@ -3,19 +3,19 @@ using Swarmops.Basic.Enums;
namespace Swarmops.Basic.Types.Financial
{
///
- /// This class encapsulates what a financial transaction was constructed from.
+ /// This class encapsulates what a financial transaction was constructed from.
///
public class BasicFinancialDependency
{
- public BasicFinancialDependency (int objectId, FinancialDependencyType dependencyType, int foreignId)
+ public BasicFinancialDependency(int objectId, FinancialDependencyType dependencyType, int foreignId)
{
- this.ObjectId = objectId;
- this.DependencyType = dependencyType;
- this.ForeignId = foreignId;
+ ObjectId = objectId;
+ DependencyType = dependencyType;
+ ForeignId = foreignId;
}
public int ObjectId { get; private set; }
public FinancialDependencyType DependencyType { get; private set; }
public int ForeignId { get; private set; }
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/Financial/BasicFinancialTransaction.cs b/Basic/Types/Financial/BasicFinancialTransaction.cs
index f764ec48..1df04f62 100644
--- a/Basic/Types/Financial/BasicFinancialTransaction.cs
+++ b/Basic/Types/Financial/BasicFinancialTransaction.cs
@@ -5,8 +5,14 @@ namespace Swarmops.Basic.Types.Financial
{
public class BasicFinancialTransaction : IHasIdentity
{
- public BasicFinancialTransaction (int financialTransactionId, int organizationId, DateTime dateTime,
- string description, string importHash)
+ private readonly DateTime dateTime;
+ private readonly int financialTransactionId;
+ private readonly string importHash;
+ private readonly int organizationId;
+ private string description;
+
+ public BasicFinancialTransaction(int financialTransactionId, int organizationId, DateTime dateTime,
+ string description, string importHash)
{
this.financialTransactionId = financialTransactionId;
this.organizationId = organizationId;
@@ -15,19 +21,13 @@ namespace Swarmops.Basic.Types.Financial
this.importHash = importHash;
}
- public BasicFinancialTransaction (BasicFinancialTransaction original) :
+ public BasicFinancialTransaction(BasicFinancialTransaction original) :
this(
original.financialTransactionId, original.organizationId, original.dateTime, original.description,
original.importHash)
{
}
- private int organizationId;
- private int financialTransactionId;
- private DateTime dateTime;
- private string description;
- private string importHash;
-
public int OrganizationId
{
get { return this.organizationId; }
diff --git a/Basic/Types/Financial/BasicFinancialTransactionRow.cs b/Basic/Types/Financial/BasicFinancialTransactionRow.cs
index d01eeea4..c69a6088 100644
--- a/Basic/Types/Financial/BasicFinancialTransactionRow.cs
+++ b/Basic/Types/Financial/BasicFinancialTransactionRow.cs
@@ -5,18 +5,18 @@ namespace Swarmops.Basic.Types.Financial
{
public class BasicFinancialTransactionRow : IHasIdentity
{
- public BasicFinancialTransactionRow (int financialTransactionRowId, int financialAccountId,
- int financialTransactionId, Int64 amountCents, DateTime createdDateTime, int createdByPersonId)
+ public BasicFinancialTransactionRow(int financialTransactionRowId, int financialAccountId,
+ int financialTransactionId, Int64 amountCents, DateTime createdDateTime, int createdByPersonId)
{
- this.FinancialTransactionRowId = financialTransactionRowId;
- this.FinancialAccountId = financialAccountId;
- this.FinancialTransactionId = financialTransactionId;
- this.AmountCents = amountCents;
- this.CreatedDateTime = createdDateTime;
- this.CreatedByPersonId = createdByPersonId;
+ FinancialTransactionRowId = financialTransactionRowId;
+ FinancialAccountId = financialAccountId;
+ FinancialTransactionId = financialTransactionId;
+ AmountCents = amountCents;
+ CreatedDateTime = createdDateTime;
+ CreatedByPersonId = createdByPersonId;
}
- public BasicFinancialTransactionRow (BasicFinancialTransactionRow original)
+ public BasicFinancialTransactionRow(BasicFinancialTransactionRow original)
: this(
original.FinancialTransactionRowId, original.FinancialAccountId, original.FinancialTransactionId,
original.AmountCents, original.CreatedDateTime, original.CreatedByPersonId)
@@ -25,7 +25,7 @@ namespace Swarmops.Basic.Types.Financial
public int FinancialAccountId { get; private set; }
public int FinancialTransactionId { get; private set; }
- public int FinancialTransactionRowId { get; private set;}
+ public int FinancialTransactionRowId { get; private set; }
public Int64 AmountCents { get; private set; }
public DateTime CreatedDateTime { get; private set; }
public int CreatedByPersonId { get; private set; }
@@ -34,7 +34,7 @@ namespace Swarmops.Basic.Types.Financial
public int Identity
{
- get { return this.FinancialTransactionRowId; }
+ get { return FinancialTransactionRowId; }
}
#endregion
diff --git a/Basic/Types/Financial/BasicFinancialTransactionTagSet.cs b/Basic/Types/Financial/BasicFinancialTransactionTagSet.cs
index 73a5c1a3..033eafd9 100644
--- a/Basic/Types/Financial/BasicFinancialTransactionTagSet.cs
+++ b/Basic/Types/Financial/BasicFinancialTransactionTagSet.cs
@@ -2,21 +2,24 @@
namespace Swarmops.Basic.Types.Financial
{
- public class BasicFinancialTransactionTagSet: IHasIdentity
+ public class BasicFinancialTransactionTagSet : IHasIdentity
{
- public BasicFinancialTransactionTagSet (int financialTransactionTagSetId, int financialTransactionTagSetTypeId, int organizationId, int order, bool allowUntagged, int visibilityLevel, int profitLossType)
+ public BasicFinancialTransactionTagSet(int financialTransactionTagSetId, int financialTransactionTagSetTypeId,
+ int organizationId, int order, bool allowUntagged, int visibilityLevel, int profitLossType)
{
- this.FinancialTransactionTagSetId = financialTransactionTagSetId;
- this.FinancialTransactionTagSetTypeId = financialTransactionTagSetTypeId;
- this.OrganizationId = organizationId;
- this.Order = order;
- this.AllowUntagged = allowUntagged;
- this.VisibilityLevel = visibilityLevel;
- this.ProfitLossType = profitLossType;
+ FinancialTransactionTagSetId = financialTransactionTagSetId;
+ FinancialTransactionTagSetTypeId = financialTransactionTagSetTypeId;
+ OrganizationId = organizationId;
+ Order = order;
+ AllowUntagged = allowUntagged;
+ VisibilityLevel = visibilityLevel;
+ ProfitLossType = profitLossType;
}
- public BasicFinancialTransactionTagSet (BasicFinancialTransactionTagSet original):
- this (original.FinancialTransactionTagSetId, original.FinancialTransactionTagSetTypeId, original.OrganizationId, original.Order, original.AllowUntagged, original.VisibilityLevel, original.ProfitLossType)
+ public BasicFinancialTransactionTagSet(BasicFinancialTransactionTagSet original) :
+ this(
+ original.FinancialTransactionTagSetId, original.FinancialTransactionTagSetTypeId, original.OrganizationId,
+ original.Order, original.AllowUntagged, original.VisibilityLevel, original.ProfitLossType)
{
// copy ctor
}
@@ -31,8 +34,11 @@ namespace Swarmops.Basic.Types.Financial
#region Implementation of IHasIdentity
- public int Identity { get { return this.FinancialTransactionTagSetId; } }
+ public int Identity
+ {
+ get { return FinancialTransactionTagSetId; }
+ }
#endregion
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/Financial/BasicFinancialTransactionTagSetType.cs b/Basic/Types/Financial/BasicFinancialTransactionTagSetType.cs
index 79cfe098..6102f894 100644
--- a/Basic/Types/Financial/BasicFinancialTransactionTagSetType.cs
+++ b/Basic/Types/Financial/BasicFinancialTransactionTagSetType.cs
@@ -2,16 +2,16 @@
namespace Swarmops.Basic.Types.Financial
{
- public class BasicFinancialTransactionTagSetType: IHasIdentity
+ public class BasicFinancialTransactionTagSetType : IHasIdentity
{
- public BasicFinancialTransactionTagSetType (int financialTransactionTagSetTypeId, string resourceName)
+ public BasicFinancialTransactionTagSetType(int financialTransactionTagSetTypeId, string resourceName)
{
- this.FinancialTransactionTagSetTypeId = financialTransactionTagSetTypeId;
- this.ResourceName = resourceName;
+ FinancialTransactionTagSetTypeId = financialTransactionTagSetTypeId;
+ ResourceName = resourceName;
}
- public BasicFinancialTransactionTagSetType (BasicFinancialTransactionTagSetType original):
- this (original.FinancialTransactionTagSetTypeId, original.ResourceName)
+ public BasicFinancialTransactionTagSetType(BasicFinancialTransactionTagSetType original) :
+ this(original.FinancialTransactionTagSetTypeId, original.ResourceName)
{
// copy ctor
}
@@ -19,11 +19,13 @@ namespace Swarmops.Basic.Types.Financial
public int FinancialTransactionTagSetTypeId { get; private set; }
public string ResourceName { get; private set; }
-
#region Implementation of IHasIdentity
- public int Identity { get { return this.FinancialTransactionTagSetTypeId; } }
+ public int Identity
+ {
+ get { return FinancialTransactionTagSetTypeId; }
+ }
#endregion
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/Financial/BasicFinancialTransactionTagType.cs b/Basic/Types/Financial/BasicFinancialTransactionTagType.cs
index 44e30bca..85b0fdcb 100644
--- a/Basic/Types/Financial/BasicFinancialTransactionTagType.cs
+++ b/Basic/Types/Financial/BasicFinancialTransactionTagType.cs
@@ -2,22 +2,27 @@
namespace Swarmops.Basic.Types.Financial
{
- public class BasicFinancialTransactionTagType: IHasIdentity
+ public class BasicFinancialTransactionTagType : IHasIdentity
{
- public BasicFinancialTransactionTagType (int financialTransactionTagTypeId, int parentFinancialTransactionTagTypeId, int financialTransactionTagSetId, string name, bool active, int openedYear, int closedYear)
+ public BasicFinancialTransactionTagType(int financialTransactionTagTypeId,
+ int parentFinancialTransactionTagTypeId, int financialTransactionTagSetId, string name, bool active,
+ int openedYear, int closedYear)
{
- this.FinancialTransactionTagTypeId = financialTransactionTagTypeId;
- this.ParentFinancialTransactionTagTypeId = parentFinancialTransactionTagTypeId;
- this.FinancialTransactionTagSetId = financialTransactionTagSetId;
- this.Name = name;
- this.Active = active;
- this.OpenedYear = openedYear;
- this.ClosedYear = closedYear;
+ FinancialTransactionTagTypeId = financialTransactionTagTypeId;
+ ParentFinancialTransactionTagTypeId = parentFinancialTransactionTagTypeId;
+ FinancialTransactionTagSetId = financialTransactionTagSetId;
+ Name = name;
+ Active = active;
+ OpenedYear = openedYear;
+ ClosedYear = closedYear;
}
- public BasicFinancialTransactionTagType (BasicFinancialTransactionTagType original):
- this (original.FinancialTransactionTagTypeId, original.ParentFinancialTransactionTagTypeId, original.FinancialTransactionTagSetId, original.Name, original.Active, original.OpenedYear, original.ClosedYear)
- {
+ public BasicFinancialTransactionTagType(BasicFinancialTransactionTagType original) :
+ this(
+ original.FinancialTransactionTagTypeId, original.ParentFinancialTransactionTagTypeId,
+ original.FinancialTransactionTagSetId, original.Name, original.Active, original.OpenedYear,
+ original.ClosedYear)
+ {
// copy ctor
}
@@ -31,8 +36,11 @@ namespace Swarmops.Basic.Types.Financial
#region Implementation of IHasIdentity
- public int Identity { get { return this.FinancialTransactionTagTypeId; } }
+ public int Identity
+ {
+ get { return FinancialTransactionTagTypeId; }
+ }
#endregion
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/Financial/BasicFinancialValidation.cs b/Basic/Types/Financial/BasicFinancialValidation.cs
index d5bd4f7d..f239bc5d 100644
--- a/Basic/Types/Financial/BasicFinancialValidation.cs
+++ b/Basic/Types/Financial/BasicFinancialValidation.cs
@@ -4,20 +4,23 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types.Financial
{
- public class BasicFinancialValidation: IHasIdentity
+ public class BasicFinancialValidation : IHasIdentity
{
- public BasicFinancialValidation (int financialValidationId, FinancialValidationType validationType, int personId, DateTime dateTime, FinancialDependencyType dependencyType, int foreignId)
+ public BasicFinancialValidation(int financialValidationId, FinancialValidationType validationType, int personId,
+ DateTime dateTime, FinancialDependencyType dependencyType, int foreignId)
{
- this.FinancialValidationId = financialValidationId;
- this.ValidationType = validationType;
- this.PersonId = personId;
- this.DateTime = dateTime;
- this.DependencyType = dependencyType;
- this.ForeignId = foreignId;
+ FinancialValidationId = financialValidationId;
+ ValidationType = validationType;
+ PersonId = personId;
+ DateTime = dateTime;
+ DependencyType = dependencyType;
+ ForeignId = foreignId;
}
- public BasicFinancialValidation (BasicFinancialValidation original)
- :this (original.Identity, original.ValidationType, original.PersonId, original.DateTime, original.DependencyType, original.ForeignId)
+ public BasicFinancialValidation(BasicFinancialValidation original)
+ : this(
+ original.Identity, original.ValidationType, original.PersonId, original.DateTime,
+ original.DependencyType, original.ForeignId)
{
// empty copy ctor
}
@@ -28,9 +31,10 @@ namespace Swarmops.Basic.Types.Financial
public DateTime DateTime { get; private set; }
public FinancialDependencyType DependencyType { get; private set; }
public int ForeignId { get; private set; }
+
public int Identity
{
- get { return this.FinancialValidationId; }
+ get { return FinancialValidationId; }
}
}
-}
+}
\ No newline at end of file
diff --git a/Basic/Types/GeographyWithPeople.cs b/Basic/Types/GeographyWithPeople.cs
index 1f843245..dcf8aa5c 100644
--- a/Basic/Types/GeographyWithPeople.cs
+++ b/Basic/Types/GeographyWithPeople.cs
@@ -3,17 +3,17 @@ using System;
namespace Swarmops.Basic.Types
{
[Serializable]
- public class BasicGeographyWithPeople
+ public class BasicGeographyWithPeople
{
+ public int ActivistCount;
public int GeographyID;
- public int OrgId = 0;
public string GeograpyName;
+ public string LeadContent;
+ public int MemberCount;
+ public int OrgId = 0;
public string OrgName;
public int ParentGeographyId;
public int ParentOrgId;
- public int MemberCount;
- public int ActivistCount;
- public string LeadContent;
public string SecondsContent;
}
}
\ No newline at end of file
diff --git a/Basic/Types/Governance/BasicMeeting.cs b/Basic/Types/Governance/BasicMeeting.cs
index 063ef154..77419b6d 100644
--- a/Basic/Types/Governance/BasicMeeting.cs
+++ b/Basic/Types/Governance/BasicMeeting.cs
@@ -3,23 +3,28 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types.Governance
{
- public class BasicMeeting: IHasIdentity
+ public class BasicMeeting : IHasIdentity
{
- public BasicMeeting (int meetingId, int organizationId, string name, DateTime motionSubmissionEnds, DateTime amendmentSubmissionEnds, DateTime amendmentVotingStarts, DateTime amendmentVotingEnds, DateTime motionVotingStarts, DateTime motionVotingEnds)
+ public BasicMeeting(int meetingId, int organizationId, string name, DateTime motionSubmissionEnds,
+ DateTime amendmentSubmissionEnds, DateTime amendmentVotingStarts, DateTime amendmentVotingEnds,
+ DateTime motionVotingStarts, DateTime motionVotingEnds)
{
- this.MeetingId = meetingId;
- this.OrganizationId = organizationId;
- this.Name = name;
- this.MotionSubmissionEnds = motionSubmissionEnds;
- this.AmendmentSubmissionEnds = amendmentSubmissionEnds;
- this.AmendmentVotingStarts = amendmentVotingStarts;
- this.AmendmentVotingEnds = amendmentVotingEnds;
- this.MotionVotingStarts = motionVotingStarts;
- this.MotionVotingEnds = motionVotingEnds;
+ MeetingId = meetingId;
+ OrganizationId = organizationId;
+ Name = name;
+ MotionSubmissionEnds = motionSubmissionEnds;
+ AmendmentSubmissionEnds = amendmentSubmissionEnds;
+ AmendmentVotingStarts = amendmentVotingStarts;
+ AmendmentVotingEnds = amendmentVotingEnds;
+ MotionVotingStarts = motionVotingStarts;
+ MotionVotingEnds = motionVotingEnds;
}
- public BasicMeeting (BasicMeeting original):
- this (original.MeetingId, original.OrganizationId, original.Name, original.MotionSubmissionEnds, original.AmendmentSubmissionEnds, original.AmendmentVotingStarts, original.AmendmentVotingEnds, original.MotionVotingStarts, original.MotionVotingEnds)
+ public BasicMeeting(BasicMeeting original) :
+ this(
+ original.MeetingId, original.OrganizationId, original.Name, original.MotionSubmissionEnds,
+ original.AmendmentSubmissionEnds, original.AmendmentVotingStarts, original.AmendmentVotingEnds,
+ original.MotionVotingStarts, original.MotionVotingEnds)
{
// empty copy ctor
}
@@ -36,7 +41,7 @@ namespace Swarmops.Basic.Types.Governance
public int Identity
{
- get { return this.MeetingId; }
+ get { return MeetingId; }
}
}
}
\ No newline at end of file
diff --git a/Basic/Types/Governance/BasicMotion.cs b/Basic/Types/Governance/BasicMotion.cs
index 0a82728c..32498379 100644
--- a/Basic/Types/Governance/BasicMotion.cs
+++ b/Basic/Types/Governance/BasicMotion.cs
@@ -3,32 +3,40 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types.Governance
{
- public class BasicMotion: IHasIdentity
+ public class BasicMotion : IHasIdentity
{
- public BasicMotion (int motionId, int meetingId, int sequenceNumber, string designation, int submittedByPersonId, int createdByPersonId, DateTime createdDateTime, bool amended, int amendedByPersonId, DateTime amendedDateTime, string title, string text, string amendedText, string decisionPoints, string amendedDecisionPoints, string threadUrl, bool open, bool carried)
+ public BasicMotion(int motionId, int meetingId, int sequenceNumber, string designation, int submittedByPersonId,
+ int createdByPersonId, DateTime createdDateTime, bool amended, int amendedByPersonId,
+ DateTime amendedDateTime, string title, string text, string amendedText, string decisionPoints,
+ string amendedDecisionPoints, string threadUrl, bool open, bool carried)
{
- this.MotionId = motionId;
- this.MeetingId = meetingId;
- this.SequenceNumber = sequenceNumber;
- this.Designation = designation;
- this.SubmittedByPersonId = submittedByPersonId;
- this.CreatedByPersonId = createdByPersonId;
- this.CreatedDateTime = createdDateTime;
- this.Amended = amended;
- this.AmendedByPersonId = amendedByPersonId;
- this.AmendedDateTime = amendedDateTime;
- this.Title = title;
- this.Text = text;
- this.AmendedText = amendedText;
- this.DecisionPoints = decisionPoints;
- this.AmendedDecisionPoints = amendedDecisionPoints;
- this.ThreadUrl = threadUrl;
- this.Open = open;
- this.Carried = carried;
+ MotionId = motionId;
+ MeetingId = meetingId;
+ SequenceNumber = sequenceNumber;
+ Designation = designation;
+ SubmittedByPersonId = submittedByPersonId;
+ CreatedByPersonId = createdByPersonId;
+ CreatedDateTime = createdDateTime;
+ Amended = amended;
+ AmendedByPersonId = amendedByPersonId;
+ AmendedDateTime = amendedDateTime;
+ Title = title;
+ Text = text;
+ AmendedText = amendedText;
+ DecisionPoints = decisionPoints;
+ AmendedDecisionPoints = amendedDecisionPoints;
+ ThreadUrl = threadUrl;
+ Open = open;
+ Carried = carried;
}
- public BasicMotion (BasicMotion original):
- this (original.MotionId, original.MeetingId, original.SequenceNumber, original.Designation, original.SubmittedByPersonId, original.CreatedByPersonId, original.CreatedDateTime, original.Amended, original.AmendedByPersonId, original.AmendedDateTime, original.Title, original.Text, original.AmendedText, original.DecisionPoints, original.AmendedDecisionPoints, original.ThreadUrl, original.Open, original.Carried)
+ public BasicMotion(BasicMotion original) :
+ this(
+ original.MotionId, original.MeetingId, original.SequenceNumber, original.Designation,
+ original.SubmittedByPersonId, original.CreatedByPersonId, original.CreatedDateTime, original.Amended,
+ original.AmendedByPersonId, original.AmendedDateTime, original.Title, original.Text, original.AmendedText,
+ original.DecisionPoints, original.AmendedDecisionPoints, original.ThreadUrl, original.Open, original.Carried
+ )
{
// empty copy ctor
}
@@ -56,7 +64,7 @@ namespace Swarmops.Basic.Types.Governance
public int Identity
{
- get { return this.MotionId; }
+ get { return MotionId; }
}
}
}
\ No newline at end of file
diff --git a/Basic/Types/Governance/BasicMotionAmendment.cs b/Basic/Types/Governance/BasicMotionAmendment.cs
index 5d60d4dc..1174400b 100644
--- a/Basic/Types/Governance/BasicMotionAmendment.cs
+++ b/Basic/Types/Governance/BasicMotionAmendment.cs
@@ -3,25 +3,30 @@ using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types.Governance
{
- public class BasicMotionAmendment: IHasIdentity
+ public class BasicMotionAmendment : IHasIdentity
{
- public BasicMotionAmendment(int motionAmendmentId, int motionId, int sequenceNumber, int submittedByPersonId, int createdByPersonId, DateTime createdDateTime, string title, string text, string decisionPoint, bool open, bool carried)
+ public BasicMotionAmendment(int motionAmendmentId, int motionId, int sequenceNumber, int submittedByPersonId,
+ int createdByPersonId, DateTime createdDateTime, string title, string text, string decisionPoint, bool open,
+ bool carried)
{
- this.MotionAmendmentId = motionAmendmentId;
- this.MotionId = motionId;
- this.SequenceNumber = sequenceNumber;
- this.SubmittedByPersonId = submittedByPersonId;
- this.CreatedByPersonId = createdByPersonId;
- this.CreatedDateTime = createdDateTime;
- this.Title = title;
- this.Text = text;
- this.DecisionPoint = decisionPoint;
- this.Open = open;
- this.Carried = carried;
+ MotionAmendmentId = motionAmendmentId;
+ MotionId = motionId;
+ SequenceNumber = sequenceNumber;
+ SubmittedByPersonId = submittedByPersonId;
+ CreatedByPersonId = createdByPersonId;
+ CreatedDateTime = createdDateTime;
+ Title = title;
+ Text = text;
+ DecisionPoint = decisionPoint;
+ Open = open;
+ Carried = carried;
}
- public BasicMotionAmendment (BasicMotionAmendment original):
- this (original.MotionAmendmentId, original.MotionId, original.SequenceNumber, original.SubmittedByPersonId, original.CreatedByPersonId, original.CreatedDateTime, original.Title, original.Text, original.DecisionPoint, original.Open, original.Carried)
+ public BasicMotionAmendment(BasicMotionAmendment original) :
+ this(
+ original.MotionAmendmentId, original.MotionId, original.SequenceNumber, original.SubmittedByPersonId,
+ original.CreatedByPersonId, original.CreatedDateTime, original.Title, original.Text, original.DecisionPoint,
+ original.Open, original.Carried)
{
// empty copy ctor
}
@@ -37,9 +42,10 @@ namespace Swarmops.Basic.Types.Governance
public string DecisionPoint { get; private set; }
public bool Open { get; protected set; }
public bool Carried { get; protected set; }
+
public int Identity
{
- get { return this.MotionAmendmentId; }
+ get { return MotionAmendmentId; }
}
}
}
\ No newline at end of file
diff --git a/Basic/Types/Security/BasicAuthority.cs b/Basic/Types/Security/BasicAuthority.cs
index e86f5e9b..85059296 100644
--- a/Basic/Types/Security/BasicAuthority.cs
+++ b/Basic/Types/Security/BasicAuthority.cs
@@ -3,16 +3,23 @@ using System;
namespace Swarmops.Basic.Types.Security
{
///
- /// Container of a person's authority within PirateWeb.
+ /// Container of a person's authority within PirateWeb.
///
public class BasicAuthority
{
- public BasicAuthority (int personId, BasicPersonRole[] systemPersonRoles, BasicPersonRole[] organizationPersonRoles,
- BasicPersonRole[] nodePersonRoles)
+ public readonly BasicPersonRole[] AllPersonRoles;
+ public readonly BasicPersonRole[] LocalPersonRoles;
+ public readonly BasicPersonRole[] OrganizationPersonRoles;
+ public readonly int PersonId;
+ public readonly BasicPersonRole[] SystemPersonRoles;
+
+ public BasicAuthority(int personId, BasicPersonRole[] systemPersonRoles,
+ BasicPersonRole[] organizationPersonRoles,
+ BasicPersonRole[] nodePersonRoles)
{
if (personId < 1)
{
- throw new ArgumentOutOfRangeException("PersonId cannot be " + personId.ToString());
+ throw new ArgumentOutOfRangeException("PersonId cannot be " + personId);
}
this.PersonId = personId;
@@ -35,23 +42,19 @@ namespace Swarmops.Basic.Types.Security
this.LocalPersonRoles = new BasicPersonRole[0];
}
- AllPersonRoles = new BasicPersonRole[SystemPersonRoles.Length + OrganizationPersonRoles.Length + LocalPersonRoles.Length];
+ this.AllPersonRoles =
+ new BasicPersonRole[
+ this.SystemPersonRoles.Length + this.OrganizationPersonRoles.Length + this.LocalPersonRoles.Length];
- if (SystemPersonRoles.Length > 0)
- SystemPersonRoles.CopyTo(AllPersonRoles, 0);
+ if (this.SystemPersonRoles.Length > 0)
+ this.SystemPersonRoles.CopyTo(this.AllPersonRoles, 0);
- if (OrganizationPersonRoles.Length > 0)
- OrganizationPersonRoles.CopyTo(AllPersonRoles, SystemPersonRoles.Length);
-
- if (LocalPersonRoles.Length > 0)
- LocalPersonRoles.CopyTo(AllPersonRoles, SystemPersonRoles.Length + OrganizationPersonRoles.Length);
+ if (this.OrganizationPersonRoles.Length > 0)
+ this.OrganizationPersonRoles.CopyTo(this.AllPersonRoles, this.SystemPersonRoles.Length);
+ if (this.LocalPersonRoles.Length > 0)
+ this.LocalPersonRoles.CopyTo(this.AllPersonRoles,
+ this.SystemPersonRoles.Length + this.OrganizationPersonRoles.Length);
}
-
- public readonly int PersonId;
- public readonly BasicPersonRole[] SystemPersonRoles;
- public readonly BasicPersonRole[] OrganizationPersonRoles;
- public readonly BasicPersonRole[] LocalPersonRoles;
- public readonly BasicPersonRole[] AllPersonRoles;
}
}
\ No newline at end of file
diff --git a/Basic/Types/XmlSerializableDictionary.cs b/Basic/Types/XmlSerializableDictionary.cs
index a018fff4..a5659211 100644
--- a/Basic/Types/XmlSerializableDictionary.cs
+++ b/Basic/Types/XmlSerializableDictionary.cs
@@ -1,4 +1,6 @@
using System.Collections.Generic;
+using System.Xml;
+using System.Xml.Schema;
using System.Xml.Serialization;
[XmlRoot("dictionary")]
@@ -6,15 +8,16 @@ public class SerializableDictionary
: Dictionary, IXmlSerializable
{
#region IXmlSerializable Members
- public System.Xml.Schema.XmlSchema GetSchema ()
+
+ public XmlSchema GetSchema()
{
return null;
}
- public void ReadXml (System.Xml.XmlReader reader)
+ public void ReadXml(XmlReader reader)
{
- XmlSerializer keySerializer = new XmlSerializer(typeof(TKey));
- XmlSerializer valueSerializer = new XmlSerializer(typeof(TValue));
+ XmlSerializer keySerializer = new XmlSerializer(typeof (TKey));
+ XmlSerializer valueSerializer = new XmlSerializer(typeof (TValue));
bool wasEmpty = reader.IsEmptyElement;
reader.Read();
@@ -22,19 +25,19 @@ public class SerializableDictionary
if (wasEmpty)
return;
- while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
+ while (reader.NodeType != XmlNodeType.EndElement)
{
reader.ReadStartElement("item");
reader.ReadStartElement("key");
- TKey key = (TKey)keySerializer.Deserialize(reader);
+ TKey key = (TKey) keySerializer.Deserialize(reader);
reader.ReadEndElement();
reader.ReadStartElement("value");
- TValue value = (TValue)valueSerializer.Deserialize(reader);
+ TValue value = (TValue) valueSerializer.Deserialize(reader);
reader.ReadEndElement();
- this.Add(key, value);
+ Add(key, value);
reader.ReadEndElement();
reader.MoveToContent();
@@ -42,12 +45,12 @@ public class SerializableDictionary
reader.ReadEndElement();
}
- public void WriteXml (System.Xml.XmlWriter writer)
+ public void WriteXml(XmlWriter writer)
{
- XmlSerializer keySerializer = new XmlSerializer(typeof(TKey));
- XmlSerializer valueSerializer = new XmlSerializer(typeof(TValue));
+ XmlSerializer keySerializer = new XmlSerializer(typeof (TKey));
+ XmlSerializer valueSerializer = new XmlSerializer(typeof (TValue));
- foreach (TKey key in this.Keys)
+ foreach (TKey key in Keys)
{
writer.WriteStartElement("item");
@@ -63,5 +66,6 @@ public class SerializableDictionary
writer.WriteEndElement();
}
}
+
#endregion
}
\ No newline at end of file
diff --git a/Database/Configuration.cs b/Database/Configuration.cs
index ac866296..c5d982ee 100644
--- a/Database/Configuration.cs
+++ b/Database/Configuration.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.IO;
using System.Web;
using System.Xml.Serialization;
@@ -9,7 +10,7 @@ namespace Swarmops.Database
public partial class SwarmDb
{
///
- /// This is the IN-CODE revision of the database. The version we expect to be running against.
+ /// This is the IN-CODE revision of the database. The version we expect to be running against.
///
public static int DbVersionExpected
{
@@ -22,23 +23,32 @@ namespace Swarmops.Database
[Serializable]
public class Configuration
{
- public Configuration() {}
- public Configuration (Credentials read, Credentials write, Credentials admin)
+ private static Configuration _configuration;
+
+ public Configuration()
{
- this.Read = read;
- this.Write = write;
- this.Admin = admin;
}
+ public Configuration(Credentials read, Credentials write, Credentials admin)
+ {
+ Read = read;
+ Write = write;
+ Admin = admin;
+ }
+
+ public Credentials Read { get; set; }
+ public Credentials Write { get; set; }
+ public Credentials Admin { get; set; }
+
public static bool IsConfigured()
{
- if (Configuration._configuration == null)
+ if (_configuration == null)
{
try
{
- Configuration.Load();
+ Load();
}
- catch(Exception)
+ catch (Exception)
{
return false;
}
@@ -49,10 +59,6 @@ namespace Swarmops.Database
return !String.IsNullOrEmpty(testString);
}
- public Credentials Read { get; set; }
- public Credentials Write { get; set; }
- public Credentials Admin { get; set; }
-
public Configuration Get()
{
@@ -64,20 +70,19 @@ namespace Swarmops.Database
return _configuration;
}
- private static Configuration _configuration;
-
public static bool TestConfigurationWritable()
{
try
{
- using (FileStream stream = new FileStream(GetConfigurationFileName(), FileMode.Append, FileAccess.Write, FileShare.ReadWrite))
+ using (
+ FileStream stream = new FileStream(GetConfigurationFileName(), FileMode.Append, FileAccess.Write,
+ FileShare.ReadWrite))
{
// do nothing
}
}
catch (Exception)
{
-
return false;
}
@@ -86,20 +91,21 @@ namespace Swarmops.Database
public static void Load()
{
- XmlSerializer serializer = new XmlSerializer(typeof(Configuration));
+ XmlSerializer serializer = new XmlSerializer(typeof (Configuration));
string configFileName = GetConfigurationFileName();
- using (FileStream readFileStream = new FileStream(configFileName, FileMode.Open, FileAccess.Read, FileShare.Read))
+ using (
+ FileStream readFileStream = new FileStream(configFileName, FileMode.Open, FileAccess.Read,
+ FileShare.Read))
{
-
_configuration = (Configuration) serializer.Deserialize(readFileStream);
}
}
public static void Set(Configuration configuration)
{
- XmlSerializer serializer = new XmlSerializer(typeof(Configuration));
+ XmlSerializer serializer = new XmlSerializer(typeof (Configuration));
string fileName = GetConfigurationFileName();
using (TextWriter writeFileStream = new StreamWriter(fileName))
@@ -125,24 +131,43 @@ namespace Swarmops.Database
return "/etc/swarmops/database.config";
}
- else if (System.Diagnostics.Debugger.IsAttached)
+ if (Debugger.IsAttached)
{
// Dev web process. This will throw if we're not in a HttpContext and trying to debug something else.
- return HttpContext.Current.Server.MapPath ("~/database.config");
+ return HttpContext.Current.Server.MapPath("~/database.config");
}
- else
- {
- throw new NotImplementedException("Invalid state");
+ throw new NotImplementedException("Invalid state");
- // Dev console process
+ // Dev console process
- // Each dev needs to set the working directory to the Console directory when debugging
- // return "database.config";
- }
+ // Each dev needs to set the working directory to the Console directory when debugging
+ // return "database.config";
}
}
+ [Serializable]
+ public class Credentials
+ {
+ public Credentials()
+ {
+ // paramless ctor to enable serialization
+ }
+
+ public Credentials(string database, ServerSet servers, string username, string password)
+ {
+ Database = database;
+ ServerSet = servers;
+ Username = username;
+ Password = password;
+ }
+
+ public string Database { get; set; }
+ public ServerSet ServerSet { get; set; }
+ public string Username { get; set; }
+ public string Password { get; set; }
+ }
+
[Serializable]
public class ServerSet
{
@@ -152,35 +177,14 @@ namespace Swarmops.Database
ServerPriorities = new List();
}
- public ServerSet (string singleServer)
+ public ServerSet(string singleServer)
{
ServerPriorities = new List();
ServerPriorities.Add(singleServer);
}
- public List ServerPriorities { get; set; } // array of semicolon-delimited hostnames; topmost string in array is first-priority servers, and so on.
+ public List ServerPriorities { get; set; }
+ // array of semicolon-delimited hostnames; topmost string in array is first-priority servers, and so on.
}
-
- [Serializable]
- public class Credentials
- {
- public Credentials()
- {
- // paramless ctor to enable serialization
- }
-
- public Credentials (string database, ServerSet servers, string username, string password)
- {
- this.Database = database;
- this.ServerSet = servers;
- this.Username = username;
- this.Password = password;
- }
-
- public string Database { get; set; }
- public ServerSet ServerSet { get; set; }
- public string Username { get; set; }
- public string Password { get; set; }
- }
}
-}
+}
\ No newline at end of file
diff --git a/Database/Database-Activists.cs b/Database/Database-Activists.cs
index 9bdfc6e2..71026b55 100644
--- a/Database/Database-Activists.cs
+++ b/Database/Database-Activists.cs
@@ -7,7 +7,7 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
- public int[] GetActivistPersonIds (int[] geographyIds)
+ public int[] GetActivistPersonIds(int[] geographyIds)
{
List result = new List();
@@ -30,7 +30,7 @@ namespace Swarmops.Database
return result.ToArray();
}
- public void CreateActivist (int personId, bool isPublic, bool isConfirmed)
+ public void CreateActivist(int personId, bool isPublic, bool isConfirmed)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -47,7 +47,7 @@ namespace Swarmops.Database
}
}
- public int GetActivistCountForGeographies (int[] geographyIds)
+ public int GetActivistCountForGeographies(int[] geographyIds)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -65,7 +65,7 @@ namespace Swarmops.Database
}
- public bool GetActivistStatus (int personId)
+ public bool GetActivistStatus(int personId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -73,7 +73,7 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT * From Activists WHERE Active=1 AND PersonId=" + personId.ToString(),
+ "SELECT * From Activists WHERE Active=1 AND PersonId=" + personId,
connection);
using (DbDataReader reader = command.ExecuteReader())
@@ -89,7 +89,7 @@ namespace Swarmops.Database
}
- public void TerminateActivist (int personId)
+ public void TerminateActivist(int personId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -100,12 +100,7 @@ namespace Swarmops.Database
AddParameterWithName(command, "personId", personId);
command.ExecuteNonQuery();
-
}
}
-
-
-
-
}
}
\ No newline at end of file
diff --git a/Database/Database-Attribute.cs b/Database/Database-Attribute.cs
index bbd9a86a..142e7124 100644
--- a/Database/Database-Attribute.cs
+++ b/Database/Database-Attribute.cs
@@ -3,23 +3,24 @@ using System;
namespace Swarmops.Database.Attributes
{
///
- /// DbRecordType is used to mark a class what its database record is named
- /// Needed if a Logic entity is using Database-condition and have to work with a subclass
- /// i.e. [DbRecordType("Person")] on class Person
+ /// DbRecordType is used to mark a class what its database record is named
+ /// Needed if a Logic entity is using Database-condition and have to work with a subclass
+ /// i.e. [DbRecordType("Person")] on class Person
///
[AttributeUsage(AttributeTargets.All)]
- public class DbRecordType : System.Attribute
+ public class DbRecordType : Attribute
{
- string typeName = "";
+ private string typeName = "";
+
+ public DbRecordType(string recordname)
+ {
+ this.typeName = recordname;
+ }
public string TypeName
{
- get { return typeName; }
- set { typeName = value; }
- }
- public DbRecordType (string recordname)
- {
- typeName = recordname;
+ get { return this.typeName; }
+ set { this.typeName = value; }
}
}
-}
+}
\ No newline at end of file
diff --git a/Database/Database-AutoMails.cs b/Database/Database-AutoMails.cs
index 07e9c8f8..d31f5634 100644
--- a/Database/Database-AutoMails.cs
+++ b/Database/Database-AutoMails.cs
@@ -13,7 +13,7 @@ namespace Swarmops.Database
return new BasicAutoMail[0];
}
- public BasicAutoMail GetAutoMail (AutoMailType type, int organizationId, int geographyId)
+ public BasicAutoMail GetAutoMail(AutoMailType type, int organizationId, int geographyId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -21,9 +21,10 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "select AutoMails.AutoMailId,AutoMailTypes.Name,AutoMails.OrganizationId,AutoMails.GeographyId,AutoMails.AuthorPersonId,Title,Body " +
+ "select AutoMails.AutoMailId,AutoMailTypes.Name,AutoMails.OrganizationId,AutoMails.GeographyId,AutoMails.AuthorPersonId,Title,Body " +
"FROM AutoMails JOIN AutoMailTypes USING (AutoMailTypeId) " +
- "WHERE AutoMailTypes.Name='" + type.ToString() + "' AND AutoMails.OrganizationId=" + organizationId.ToString() + " AND AutoMails.GeographyId=" + geographyId.ToString(), connection);
+ "WHERE AutoMailTypes.Name='" + type + "' AND AutoMails.OrganizationId=" + organizationId +
+ " AND AutoMails.GeographyId=" + geographyId, connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -38,7 +39,7 @@ namespace Swarmops.Database
}
- private static BasicAutoMail ReadAutoMailFromDataReader (DbDataReader reader)
+ private static BasicAutoMail ReadAutoMailFromDataReader(DbDataReader reader)
{
int autoMailId = reader.GetInt32(0);
AutoMailType type = (AutoMailType) Enum.Parse(typeof (AutoMailType), reader.GetString(1));
@@ -49,12 +50,12 @@ namespace Swarmops.Database
string body = reader.GetString(6);
return new BasicAutoMail(autoMailId, type, organizationId, geographyId, authorPersonId,
- title, body);
+ title, body);
}
- public int SetAutoMail (AutoMailType type, int organizationId, int geographyId,
- int authorPersonId, string title, string body)
+ public int SetAutoMail(AutoMailType type, int organizationId, int geographyId,
+ int authorPersonId, string title, string body)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -75,10 +76,10 @@ namespace Swarmops.Database
}
- public int SetAutoMail (BasicAutoMail autoMail)
+ public int SetAutoMail(BasicAutoMail autoMail)
{
return SetAutoMail(autoMail.Type, autoMail.OrganizationId, autoMail.GeographyId,
- autoMail.AuthorPersonId, autoMail.Title, autoMail.Body);
+ autoMail.AuthorPersonId, autoMail.Title, autoMail.Body);
}
}
}
\ No newline at end of file
diff --git a/Database/Database-Ballots.cs b/Database/Database-Ballots.cs
index 9b3e4bed..e3feaf34 100644
--- a/Database/Database-Ballots.cs
+++ b/Database/Database-Ballots.cs
@@ -11,8 +11,8 @@ namespace Swarmops.Database
#region Field reading code
private const string ballotFieldSequence =
- " BallotId,ElectionId,Name,OrganizationId,GeographyId," + // 0-4
- "BallotCount,DeliveryAddress " + // 5-6
+ " BallotId,ElectionId,Name,OrganizationId,GeographyId," + // 0-4
+ "BallotCount,DeliveryAddress " + // 5-6
"FROM Ballots ";
private static BasicBallot ReadBallotFromDataReader(IDataRecord reader)
@@ -30,8 +30,6 @@ namespace Swarmops.Database
#endregion
-
-
#region Record reading - SELECT statements
public BasicBallot GetBallot(int ballotId)
@@ -51,7 +49,7 @@ namespace Swarmops.Database
return ReadBallotFromDataReader(reader);
}
- throw new ArgumentException("Unknown Ballot Id: " + ballotId.ToString());
+ throw new ArgumentException("Unknown Ballot Id: " + ballotId);
}
}
}
@@ -91,7 +89,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT PersonId FROM BallotCandidates WHERE BallotId=" + ballotId + " ORDER BY SortOrder", connection);
+ "SELECT PersonId FROM BallotCandidates WHERE BallotId=" + ballotId + " ORDER BY SortOrder",
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -116,7 +115,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT PersonId FROM CandidateDocumentation WHERE ElectionId=" + electionId + " AND OrganizationId=" + organizationId, connection);
+ "SELECT PersonId FROM CandidateDocumentation WHERE ElectionId=" + electionId +
+ " AND OrganizationId=" + organizationId, connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -130,7 +130,7 @@ namespace Swarmops.Database
}
}
- public Dictionary GetBallotsForPerson (int personId)
+ public Dictionary GetBallotsForPerson(int personId)
{
Dictionary result = new Dictionary();
@@ -146,7 +146,7 @@ namespace Swarmops.Database
{
while (reader.Read())
{
- result [reader.GetInt32(0)] = reader.GetInt32(1);
+ result[reader.GetInt32(0)] = reader.GetInt32(1);
}
return result;
@@ -154,14 +154,12 @@ namespace Swarmops.Database
}
}
-
#endregion
-
-
#region Creation and manipulation - stored procedures
- public int CreateBallot (int electionId, string name, int organizationId, int geographyId, int ballotCount, string deliveryAddress)
+ public int CreateBallot(int electionId, string name, int organizationId, int geographyId, int ballotCount,
+ string deliveryAddress)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -215,7 +213,6 @@ namespace Swarmops.Database
}
-
public void CreateBallotCandidate(int ballotId, int personId)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -267,6 +264,5 @@ namespace Swarmops.Database
}
#endregion
-
}
}
\ No newline at end of file
diff --git a/Database/Database-CashAdvances.cs b/Database/Database-CashAdvances.cs
index 91f269d5..3e7a7f22 100644
--- a/Database/Database-CashAdvances.cs
+++ b/Database/Database-CashAdvances.cs
@@ -8,13 +8,12 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
-
#region Database field reading
private const string cashAdvanceFieldSequence =
- " CashAdvanceId,OrganizationId,PersonId,CreatedDateTime,CreatedByPersonId," + // 0-4
- "FinancialAccountId,AmountCents,Description,Open,Attested," + // 5-9
- "PaidOut,AttestedByPersonId,AttestedDateTime " + // 10-12
+ " CashAdvanceId,OrganizationId,PersonId,CreatedDateTime,CreatedByPersonId," + // 0-4
+ "FinancialAccountId,AmountCents,Description,Open,Attested," + // 5-9
+ "PaidOut,AttestedByPersonId,AttestedDateTime " + // 10-12
"FROM CashAdvances ";
private static BasicCashAdvance ReadCashAdvanceFromDataReader(IDataRecord reader)
@@ -40,14 +39,11 @@ namespace Swarmops.Database
paidOut, attestedByPersonId, attestedDateTime);
}
-
#endregion
-
#region Database record reading -- SELECT clauses
-
- public BasicCashAdvance GetCashAdvance (int cashAdvanceId)
+ public BasicCashAdvance GetCashAdvance(int cashAdvanceId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -55,8 +51,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand("SELECT " + cashAdvanceFieldSequence +
- " WHERE CashAdvanceId=" + cashAdvanceId.ToString(),
- connection);
+ " WHERE CashAdvanceId=" + cashAdvanceId,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -65,10 +61,9 @@ namespace Swarmops.Database
return ReadCashAdvanceFromDataReader(reader);
}
- throw new ArgumentException("No such CashAdvanceId:" + cashAdvanceId.ToString());
+ throw new ArgumentException("No such CashAdvanceId:" + cashAdvanceId);
}
}
-
}
@@ -82,7 +77,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT " + cashAdvanceFieldSequence + ConstructWhereClause("CashAdvances", conditions), connection);
+ "SELECT " + cashAdvanceFieldSequence + ConstructWhereClause("CashAdvances", conditions),
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -96,13 +92,10 @@ namespace Swarmops.Database
}
}
-
#endregion
-
#region Creation and manipulation -- stored procedures
-
public int CreateCashAdvance(int personId, int createdByPersonId, int organizationId, int financialAccountId,
Int64 amountCents, string description)
{
@@ -183,10 +176,8 @@ namespace Swarmops.Database
}
}
-
#endregion
-
#region Dead template code
/*
@@ -530,7 +521,5 @@ namespace Swarmops.Database
*/
#endregion
-
-
}
}
\ No newline at end of file
diff --git a/Database/Database-ChurnData.cs b/Database/Database-ChurnData.cs
index 568cc618..7d05792d 100644
--- a/Database/Database-ChurnData.cs
+++ b/Database/Database-ChurnData.cs
@@ -13,10 +13,10 @@ namespace Swarmops.Database
#region Field reading code
private const string churnDataFieldSequence =
- " PersonId,OrganizationId,Churn,DecisionDateTime,ExpiryDateTime " + // 0-4
+ " PersonId,OrganizationId,Churn,DecisionDateTime,ExpiryDateTime " + // 0-4
" FROM ChurnData ";
- static private BasicChurnDataPoint ReadChurnDataPointFromDataReader (DbDataReader reader)
+ private static BasicChurnDataPoint ReadChurnDataPointFromDataReader(DbDataReader reader)
{
int personId = reader.GetInt32(0);
int organizationId = reader.GetInt32(1);
@@ -25,15 +25,14 @@ namespace Swarmops.Database
DateTime expiryDateTime = reader.GetDateTime(4);
return new BasicChurnDataPoint(churn ? ChurnDataType.Churn : ChurnDataType.Retention, decisionDateTime,
- expiryDateTime, personId, organizationId);
+ expiryDateTime, personId, organizationId);
}
#endregion
-
#region Record reading code -- SELECT statements
- public BasicChurnDataPoint[] GetChurnData (params object[] conditions)
+ public BasicChurnDataPoint[] GetChurnData(params object[] conditions)
{
List result = new List();
@@ -59,8 +58,8 @@ namespace Swarmops.Database
}
- public BasicChurnDataPoint[] GetChurnDataForOrganization (IHasIdentity organization, DateTime lowerDate,
- DateTime upperDate)
+ public BasicChurnDataPoint[] GetChurnDataForOrganization(IHasIdentity organization, DateTime lowerDate,
+ DateTime upperDate)
{
// Since I don't trust SQL Server to make correct date comparisons, especially given
// that the dates are passed in text in SQL, we get ALL the data and do
@@ -71,7 +70,7 @@ namespace Swarmops.Database
DateTime maximumDateTime = upperDate.Date.AddDays(1);
List result = new List();
- BasicChurnDataPoint[] rawData = this.GetChurnData(organization);
+ BasicChurnDataPoint[] rawData = GetChurnData(organization);
foreach (BasicChurnDataPoint churnPoint in rawData)
{
@@ -86,10 +85,9 @@ namespace Swarmops.Database
return result.ToArray();
}
-
+
#endregion
-
#region Record creation and manipulation code -- stored procedures
public int LogChurnData(int personId, int organizationId, bool churn, DateTime expiryDateTime)
@@ -98,7 +96,7 @@ namespace Swarmops.Database
}
public int LogChurnData(int personId, int organizationId, bool churn, DateTime expiryDateTime,
- DateTime decisionDateTime)
+ DateTime decisionDateTime)
{
using (DbConnection connection = GetMySqlDbConnection())
{
diff --git a/Database/Database-CommunicationTurnarounds.cs b/Database/Database-CommunicationTurnarounds.cs
index dae1b8ed..187ced3e 100644
--- a/Database/Database-CommunicationTurnarounds.cs
+++ b/Database/Database-CommunicationTurnarounds.cs
@@ -11,8 +11,8 @@ namespace Swarmops.Database
#region Field reading code
private const string communicationTurnaroundFieldSequence =
- " OrganizationId,CommunicationTypeId,CommunicationId,DateTimeOpened,DateTimeFirstResponse," + // 0-4
- "PersonIdFirstResponse,DateTimeClosed,PersonIdClosed,Open,Responded " + // 5-9
+ " OrganizationId,CommunicationTypeId,CommunicationId,DateTimeOpened,DateTimeFirstResponse," + // 0-4
+ "PersonIdFirstResponse,DateTimeClosed,PersonIdClosed,Open,Responded " + // 5-9
"FROM CommunicationTurnarounds ";
private static BasicCommunicationTurnaround ReadCommunicationTurnaroundFromDataReader(IDataRecord reader)
@@ -28,17 +28,16 @@ namespace Swarmops.Database
bool open = reader.GetBoolean(8);
bool awaitingResponse = reader.GetBoolean(9);
- return new BasicCommunicationTurnaround(organizationId, communicationTypeId, communicationId, dateTimeOpened, dateTimeFirstResponse, personIdFirstResponse, dateTimeClosed, personIdClosed, open, awaitingResponse);
+ return new BasicCommunicationTurnaround(organizationId, communicationTypeId, communicationId, dateTimeOpened,
+ dateTimeFirstResponse, personIdFirstResponse, dateTimeClosed, personIdClosed, open, awaitingResponse);
}
#endregion
-
-
#region Record reading - SELECT statements
-
- public BasicCommunicationTurnaround GetCommunicationTurnaround (int organizationId, int communicationTypeId, int communicationId)
+ public BasicCommunicationTurnaround GetCommunicationTurnaround(int organizationId, int communicationTypeId,
+ int communicationId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -46,7 +45,9 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + communicationTurnaroundFieldSequence + "WHERE OrganizationId=" + organizationId.ToString() + " AND CommunicationTypeId=" + communicationTypeId.ToString() + " AND CommunicationId=" + communicationId.ToString() + ";", connection);
+ "SELECT" + communicationTurnaroundFieldSequence + "WHERE OrganizationId=" + organizationId +
+ " AND CommunicationTypeId=" + communicationTypeId + " AND CommunicationId=" + communicationId +
+ ";", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -55,7 +56,7 @@ namespace Swarmops.Database
return ReadCommunicationTurnaroundFromDataReader(reader);
}
- throw new ArgumentException("Unknown Communication Id: " + communicationId.ToString());
+ throw new ArgumentException("Unknown Communication Id: " + communicationId);
}
}
}
@@ -71,7 +72,9 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + communicationTurnaroundFieldSequence + ConstructWhereClause("CommunicationTurnarounds", conditions) + " ORDER BY DateTimeOpened", connection);
+ "SELECT" + communicationTurnaroundFieldSequence +
+ ConstructWhereClause("CommunicationTurnarounds", conditions) + " ORDER BY DateTimeOpened",
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -85,14 +88,12 @@ namespace Swarmops.Database
}
}
-
#endregion
-
-
#region Creation and manipulation - stored procedures
- public void CreateCommunicationTurnaround (int organizationId, int communicationTypeId, int communicationId, DateTime dateTimeOpened)
+ public void CreateCommunicationTurnaround(int organizationId, int communicationTypeId, int communicationId,
+ DateTime dateTimeOpened)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -111,7 +112,8 @@ namespace Swarmops.Database
}
- public void SetCommunicationTurnaroundResponded(int organizationId, int communicationTypeId, int communicationId, DateTime dateTimeResponded, int personIdResponded)
+ public void SetCommunicationTurnaroundResponded(int organizationId, int communicationTypeId, int communicationId,
+ DateTime dateTimeResponded, int personIdResponded)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -127,12 +129,12 @@ namespace Swarmops.Database
AddParameterWithName(command, "personIdResponded", personIdResponded);
command.ExecuteNonQuery();
-
}
}
- public void SetCommunicationTurnaroundClosed(int organizationId, int communicationTypeId, int communicationId, DateTime dateTimeClosed, int personIdClosed)
+ public void SetCommunicationTurnaroundClosed(int organizationId, int communicationTypeId, int communicationId,
+ DateTime dateTimeClosed, int personIdClosed)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -148,14 +150,9 @@ namespace Swarmops.Database
AddParameterWithName(command, "personIdClosed", personIdClosed);
command.ExecuteNonQuery();
-
}
}
-
-
-
#endregion
-
}
}
\ No newline at end of file
diff --git a/Database/Database-Conditions.cs b/Database/Database-Conditions.cs
index ea18f3b8..861b3bb6 100644
--- a/Database/Database-Conditions.cs
+++ b/Database/Database-Conditions.cs
@@ -8,7 +8,7 @@ namespace Swarmops.Database
public partial class SwarmDb
{
///
- /// Constructs a WHERE clause for a table.
+ /// Constructs a WHERE clause for a table.
///
/// The table name, exactly as in the database.
/// A sequence of IHasIdentity and/or DatabaseCondition objects.
@@ -17,7 +17,7 @@ namespace Swarmops.Database
// Example: ConstructWhereClause (Organization.FromIdentity (1), Database.OpenTrue) makes
// a WHERE clause that matches OrganizationId=1 and Open=1.
//
- private static string ConstructWhereClause (string tableName, params object[] conditionParameters)
+ private static string ConstructWhereClause(string tableName, params object[] conditionParameters)
{
List conditionList = ConstructWhereClauseRecurse(tableName, conditionParameters);
@@ -33,9 +33,9 @@ namespace Swarmops.Database
///
- /// Internal. Recurses for ConstructWhereClause.
+ /// Internal. Recurses for ConstructWhereClause.
///
- private static List ConstructWhereClauseRecurse (string tableName, params object[] conditionParameters)
+ private static List ConstructWhereClauseRecurse(string tableName, params object[] conditionParameters)
{
List result = new List();
@@ -51,16 +51,16 @@ namespace Swarmops.Database
}
else if (condition is DatabaseCondition)
{
- if ((DatabaseCondition)condition != DatabaseCondition.None)
+ if ((DatabaseCondition) condition != DatabaseCondition.None)
{
- result.Add(tableName + "." + GetWhereClauseForCondition((DatabaseCondition)condition));
+ result.Add(tableName + "." + GetWhereClauseForCondition((DatabaseCondition) condition));
}
}
else if (condition is string)
{
result.Add(condition as string);
}
- else if (condition is object[]) // params object inherited and added to -- recurse
+ else if (condition is object[]) // params object inherited and added to -- recurse
{
List recursed = ConstructWhereClauseRecurse(tableName, condition);
@@ -77,7 +77,7 @@ namespace Swarmops.Database
}
- private static string GetWhereClauseForObject (IHasIdentity foreignObject)
+ private static string GetWhereClauseForObject(IHasIdentity foreignObject)
{
// This is kind of dangerous and assumes that foreignObject has the same TYPE NAME,
// including casing, as part of the DATABASE FIELD used for primary key.
@@ -96,11 +96,11 @@ namespace Swarmops.Database
return string.Empty;
}
- return " " + GetForeignTypeString(foreignObject) + "Id=" + foreignObject.Identity.ToString() + " ";
+ return " " + GetForeignTypeString(foreignObject) + "Id=" + foreignObject.Identity + " ";
}
- private static string GetWhereClauseForObjectList (IHasIdentities foreignObjects)
+ private static string GetWhereClauseForObjectList(IHasIdentities foreignObjects)
{
// As above, but with a List object.
@@ -117,21 +117,22 @@ namespace Swarmops.Database
{
// No ids to match. Make sure that no record is returned by asking for identity 0, which doesn't exist
- identities = new int[1] { 0 };
+ identities = new int[1] {0};
}
- return " " + GetForeignTypeString(((List)foreignObjects)[0]) + "Id IN (" + JoinIds(identities) + ") ";
+ return " " + GetForeignTypeString(((List) foreignObjects)[0]) + "Id IN (" +
+ JoinIds(identities) + ") ";
}
- private static string GetForeignTypeString (IHasIdentity foreignObject)
+ private static string GetForeignTypeString(IHasIdentity foreignObject)
{
string typeString = "";
- foreach (object attribute in foreignObject.GetType().GetCustomAttributes(typeof(DbRecordType), true))
+ foreach (object attribute in foreignObject.GetType().GetCustomAttributes(typeof (DbRecordType), true))
{
if (attribute is DbRecordType)
{
- typeString = ((DbRecordType)attribute).TypeName;
+ typeString = ((DbRecordType) attribute).TypeName;
}
}
if (typeString == "")
@@ -149,7 +150,7 @@ namespace Swarmops.Database
}
- private static string GetWhereClauseForCondition (DatabaseCondition condition)
+ private static string GetWhereClauseForCondition(DatabaseCondition condition)
{
switch (condition)
{
@@ -168,12 +169,12 @@ namespace Swarmops.Database
default:
throw new InvalidOperationException(
"Undefined or unimplemented DatabaseCondition in GetWhereClauseForCondition: " +
- condition.ToString());
+ condition);
}
}
- private static string JoinWhereClauses (params string[] clauses)
+ private static string JoinWhereClauses(params string[] clauses)
{
string result = string.Empty;
@@ -198,37 +199,43 @@ namespace Swarmops.Database
public enum DatabaseCondition
{
///
- /// Undefined
+ /// Undefined
///
Unknown,
+
///
- /// Retrieve only records where Open is true.
+ /// Retrieve only records where Open is true.
///
OpenTrue,
+
///
- /// Retrieve only records where Open is false (closed records).
+ /// Retrieve only records where Open is false (closed records).
///
OpenFalse,
+
///
- /// Retrieve only records where Attested is true.
+ /// Retrieve only records where Attested is true.
///
AttestedTrue,
+
///
- /// Retreieve only records where Attested is false.
+ /// Retreieve only records where Attested is false.
///
AttestedFalse,
+
///
- /// Retrieve only records where activists, memberships etc. are active.
+ /// Retrieve only records where activists, memberships etc. are active.
///
ActiveTrue,
+
///
- /// Retrieve only records where activsts, memberships are closed/deactivated.
+ /// Retrieve only records where activsts, memberships are closed/deactivated.
///
ActiveFalse,
+
///
- /// No condition
+ /// No condition
///
None
}
-
}
\ No newline at end of file
diff --git a/Database/Database-ConnectionsCommands.cs b/Database/Database-ConnectionsCommands.cs
index 4f0f5c5f..4853b6d3 100644
--- a/Database/Database-ConnectionsCommands.cs
+++ b/Database/Database-ConnectionsCommands.cs
@@ -2,6 +2,7 @@ using System;
using System.Configuration;
using System.Data;
using System.Data.Common;
+using System.Data.SqlClient;
using System.Security;
using System.Text;
using MySql.Data.MySqlClient;
@@ -10,14 +11,14 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
- public DbConnection GetSqlServerDbConnection() // Temporarily public for migratory purposes
+ public DbConnection GetSqlServerDbConnection() // Temporarily public for migratory purposes
{
- DbConnection connection = ProviderFactory.CreateConnection();
- connection.ConnectionString = ConnectionString;
+ DbConnection connection = this.ProviderFactory.CreateConnection();
+ connection.ConnectionString = this.ConnectionString;
return connection;
}
- protected DbConnection GetMySqlDbConnection () // This is a temporary function used during transition to MySql.
+ protected DbConnection GetMySqlDbConnection() // This is a temporary function used during transition to MySql.
{
DbConnection connection = new MySqlConnection();
@@ -35,15 +36,16 @@ namespace Swarmops.Database
//-------- end change /JL
if (specialConnectString == "")
- specialConnectString = ConnectionString;
- specialConnectString = specialConnectString.Replace("192.168.0.5", "192.168.0.7"); // for dev & debug at Rick's
+ specialConnectString = this.ConnectionString;
+ specialConnectString = specialConnectString.Replace("192.168.0.5", "192.168.0.7");
+ // for dev & debug at Rick's
connection.ConnectionString = specialConnectString;
return connection;
}
- protected DbCommand GetDbCommand (string commandText, DbConnection connection)
+ protected DbCommand GetDbCommand(string commandText, DbConnection connection)
{
DbCommand command = connection.CreateCommand();
if (command.GetType().FullName == "System.Data.OleDb.OleDbCommand")
@@ -66,7 +68,7 @@ namespace Swarmops.Database
return command;
}
- protected void AddParameterWithName (DbCommand command, string parameterName, object value)
+ protected void AddParameterWithName(DbCommand command, string parameterName, object value)
{
if (command.Parameters.GetType().Name == "SqlParameterCollection")
{
@@ -76,27 +78,27 @@ namespace Swarmops.Database
if (value is Type)
{
- if ((Type) value == typeof(int))
+ if ((Type) value == typeof (int))
{
parameterType = SqlDbType.Int;
}
- else if ((Type)value == typeof(DateTime))
+ else if ((Type) value == typeof (DateTime))
{
parameterType = SqlDbType.DateTime;
}
- else if ((Type)value == typeof(bool))
+ else if ((Type) value == typeof (bool))
{
parameterType = SqlDbType.Bit;
}
- else if ((Type)value == typeof(double) || (Type)value == typeof(float))
+ else if ((Type) value == typeof (double) || (Type) value == typeof (float))
{
parameterType = SqlDbType.Float;
}
- else if ((Type)value == typeof(decimal))
+ else if ((Type) value == typeof (decimal))
{
parameterType = SqlDbType.Money;
}
- else if (!((Type)value == typeof(string)))
+ else if (!((Type) value == typeof (string)))
{
throw new Exception("Unhandled parameter type in AddParameterWithName: " + value.GetType().Name);
}
@@ -127,34 +129,34 @@ namespace Swarmops.Database
throw new Exception("Unhandled parameter type in AddParameterWithName: " + value.GetType().Name);
}
- System.Data.SqlClient.SqlParameter parameter = null;
+ SqlParameter parameter = null;
if (parameterType == SqlDbType.NText)
{
int textLength = 256*2;
if (value != DBNull.Value)
{
- textLength = (value as string).Length * 2; // ntext / unicode buffer
+ textLength = (value as string).Length*2; // ntext / unicode buffer
// establish a minimum amount of even 256-byte blocks that this string will fit in
textLength += 2; // terminating zero, in unicode
- textLength -= (textLength % 256);
+ textLength -= (textLength%256);
textLength += 256;
}
- parameter = new System.Data.SqlClient.SqlParameter("@" + parameterName, parameterType, textLength);
+ parameter = new SqlParameter("@" + parameterName, parameterType, textLength);
}
else
{
// For all other types, ignore the length parameter, let the default handle it
- parameter = new System.Data.SqlClient.SqlParameter("@" + parameterName, parameterType);
+ parameter = new SqlParameter("@" + parameterName, parameterType);
}
parameter.Value = value;
- System.Data.SqlClient.SqlParameterCollection sqlCollection =
- command.Parameters as System.Data.SqlClient.SqlParameterCollection;
+ SqlParameterCollection sqlCollection =
+ command.Parameters as SqlParameterCollection;
sqlCollection.Add(parameter);
}
@@ -179,7 +181,7 @@ namespace Swarmops.Database
}
// A common function used here and there. Placed here for convenience.
- private static string JoinIds (int[] ids)
+ private static string JoinIds(int[] ids)
{
if (ids.Length == 0)
{
@@ -200,7 +202,7 @@ namespace Swarmops.Database
}
// A common function used here and there. Placed here for convenience.
- private static string JoinStrings (string[] strs)
+ private static string JoinStrings(string[] strs)
{
if (strs.Length == 0)
{
@@ -219,9 +221,9 @@ namespace Swarmops.Database
return builder.ToString();
}
-
+
// A common function used here and there. Placed here for convenience.
- private static string MySqlDate (DateTime d)
+ private static string MySqlDate(DateTime d)
{
return d.ToString("yyyyMMddHHmmss");
}
@@ -229,7 +231,11 @@ namespace Swarmops.Database
private string SqlSanitize(string input)
{
- string[] forbiddenArray = {"\\", "--", ";", "/*", "*/", "select ", "drop ", "update ", "delete ", "insert ", "="};
+ string[] forbiddenArray =
+ {
+ "\\", "--", ";", "/*", "*/", "select ", "drop ", "update ", "delete ", "insert ",
+ "="
+ };
string output = input.Replace("'", "''"); // the typical case
string inputLower = input.ToLowerInvariant();
@@ -237,7 +243,8 @@ namespace Swarmops.Database
{
if (inputLower.Contains(forbidden))
{
- throw new SecurityException("Attempt at SQL injection: parameter passed to SELECT was '" + input + "'");
+ throw new SecurityException("Attempt at SQL injection: parameter passed to SELECT was '" + input +
+ "'");
}
}
diff --git a/Database/Database-Constructors.cs b/Database/Database-Constructors.cs
index 8eb0d3dd..86f1b305 100644
--- a/Database/Database-Constructors.cs
+++ b/Database/Database-Constructors.cs
@@ -7,10 +7,54 @@ using Swarmops.Basic.Diagnostics;
namespace Swarmops.Database
{
///
- /// A generic database handler
+ /// A generic database handler
///
public partial class SwarmDb
{
+ private const string AppConfigFile = @"database.config";
+ private const string WebConfigFile = @"~/database.config";
+ private const string MonoConfigFile = @"/etc/swarmops/database.config";
+
+ private const string DefaultProviderName = "MySql.Data.MySqlClient";
+
+ // The cached values used by GetDatabase()
+ private static string _cachedConnectionString;
+ private readonly string ConnectionString;
+ private readonly DbProviderFactory ProviderFactory;
+
+ [Obsolete("Do not use. Hardwireto MySQL.")]
+ public SwarmDb(DbProviderFactory ProviderFactory, string ConnectionString)
+ {
+ this.ProviderFactory = ProviderFactory;
+ this.ConnectionString = ConnectionString;
+ }
+
+ public SwarmDb(string connectionString)
+ {
+ this.ConnectionString = connectionString;
+ }
+
+ ///
+ /// The actual revision of the database (as told by the database).
+ ///
+ public static int DbVersion
+ {
+ get
+ {
+ // TODO: Cache for some ten minutes, perhaps?
+
+ string dbVersionString = GetDatabaseForReading().GetKeyValue("DbVersion");
+
+ if (string.IsNullOrEmpty(dbVersionString))
+ {
+ GetDatabaseForWriting().SetKeyValue("DbVersion", "1");
+ return 1;
+ }
+
+ return Int32.Parse(dbVersionString);
+ }
+ }
+
public static SwarmDb GetDatabaseForReading()
{
return new SwarmDb(ConstructConnectString(new Configuration().Get().Read));
@@ -32,47 +76,28 @@ namespace Swarmops.Database
if (Configuration.IsConfigured())
{
- throw new UnauthorizedAccessException("Cannot probe arbitrary database credentials once database initialized");
+ throw new UnauthorizedAccessException(
+ "Cannot probe arbitrary database credentials once database initialized");
}
return new SwarmDb(ConstructConnectString(credentials));
}
- private static string ConstructConnectString (Credentials credentials)
+ private static string ConstructConnectString(Credentials credentials)
{
- return "server=" + credentials.ServerSet.ServerPriorities[0].Split(';')[0] + ";database=" + credentials.Database +
- ";user=" + credentials.Username + ";password=" + credentials.Password;
+ return "server=" + credentials.ServerSet.ServerPriorities[0].Split(';')[0] + ";database=" +
+ credentials.Database +
+ ";user=" + credentials.Username + ";password=" + credentials.Password;
}
- ///
- /// The actual revision of the database (as told by the database).
- ///
- public static int DbVersion
- {
- get
- {
- // TODO: Cache for some ten minutes, perhaps?
-
- string dbVersionString = GetDatabaseForReading().GetKeyValue("DbVersion");
-
- if (string.IsNullOrEmpty(dbVersionString))
- {
- GetDatabaseForWriting().SetKeyValue("DbVersion", "1");
- return 1;
- }
-
- return Int32.Parse(dbVersionString);
- }
- }
-
- [Obsolete ("Do not use. Use SwarmDb.GetDatabaseForReading(), ...ForWriting() or ...ForAdmin().", true)]
+ [Obsolete("Do not use. Use SwarmDb.GetDatabaseForReading(), ...ForWriting() or ...ForAdmin().", true)]
public static SwarmDb GetDatabase()
{
throw new NotImplementedException("GetDatabase() is obsolete and has been deleted.");
}
- [Obsolete ("Do not use. Use GetDatabaseForAdmin().", true)]
+ [Obsolete("Do not use. Use GetDatabaseForAdmin().", true)]
public static SwarmDb GetDatabaseAsAdmin()
{
string connectionString = string.Empty;
@@ -88,21 +113,23 @@ namespace Swarmops.Database
connectionString = reader.ReadLine();
Logging.LogInformation(LogSource.PirateDb,
- "SwarmDb initialized for Linux Backend: [" + connectionString + "]");
+ "SwarmDb initialized for Linux Backend: [" + connectionString + "]");
}
}
else if (HttpContext.Current != null)
{
// We are running a web application, under Mono (production) or Windows (development)
- using (StreamReader reader = new StreamReader(HttpContext.Current.Server.MapPath(WebConfigFile.Replace(".config", "-admin.config")))
+ using (
+ StreamReader reader =
+ new StreamReader(
+ HttpContext.Current.Server.MapPath(WebConfigFile.Replace(".config", "-admin.config")))
)
{
connectionString = reader.ReadLine();
Logging.LogInformation(LogSource.PirateDb,
- "SwarmDb initialized for web: [" + connectionString + "]");
+ "SwarmDb initialized for web: [" + connectionString + "]");
}
-
}
else
{
@@ -113,8 +140,8 @@ namespace Swarmops.Database
connectionString = reader.ReadLine();
Logging.LogInformation(LogSource.PirateDb,
- "SwarmDb initialized for application: [" + connectionString +
- "]");
+ "SwarmDb initialized for application: [" + connectionString +
+ "]");
}
}
}
@@ -137,11 +164,15 @@ namespace Swarmops.Database
{
string hostName = HttpContext.Current.Request.Url.Host;
- connectionString = "server=peregrine;database=" + hostName + ";user=" + hostName + "-admin;password=" + hostName +"-admin"; // TODO: Replace "peregrine" with "localhost"
+ connectionString = "server=peregrine;database=" + hostName + ";user=" + hostName +
+ "-admin;password=" + hostName + "-admin";
+ // TODO: Replace "peregrine" with "localhost"
}
else
{
- throw new InvalidOperationException("No database-as-admin connection string found -- write a connect string into the \"ActivizrAdminConnect\" environment var, or on one line into a file named database-admin.config; see connectionstrings.com for examples"); // TODO: Replace with custom exception to present config screen
+ throw new InvalidOperationException(
+ "No database-as-admin connection string found -- write a connect string into the \"ActivizrAdminConnect\" environment var, or on one line into a file named database-admin.config; see connectionstrings.com for examples");
+ // TODO: Replace with custom exception to present config screen
}
}
@@ -153,31 +184,5 @@ namespace Swarmops.Database
return new SwarmDb(DbProviderFactories.GetFactory(DefaultProviderName), connectionString);
}
-
- [Obsolete ("Do not use. Hardwireto MySQL.")]
- public SwarmDb(DbProviderFactory ProviderFactory, string ConnectionString)
- {
- this.ProviderFactory = ProviderFactory;
- this.ConnectionString = ConnectionString;
- }
-
- public SwarmDb(string connectionString)
- {
- this.ConnectionString = connectionString;
- }
-
- // The instance connection details.
- private DbProviderFactory ProviderFactory;
- private string ConnectionString;
-
- // config file used by GetDatabase()
- private const string AppConfigFile = @"database.config";
- private const string WebConfigFile = @"~/database.config";
- private const string MonoConfigFile = @"/etc/swarmops/database.config";
-
- private const string DefaultProviderName = "MySql.Data.MySqlClient";
-
- // The cached values used by GetDatabase()
- private static string _cachedConnectionString = null;
}
-}
+}
\ No newline at end of file
diff --git a/Database/Database-Countries.cs b/Database/Database-Countries.cs
index 20b22c33..a7b23186 100644
--- a/Database/Database-Countries.cs
+++ b/Database/Database-Countries.cs
@@ -10,8 +10,8 @@ namespace Swarmops.Database
{
#region Field reading code
- private const string countryFieldSequence = " CountryId,Name,Code,Culture,CurrencyCode," + // 0-4
- "GeographyId,PostalCodeLength FROM Countries "; // 5-6
+ private const string countryFieldSequence = " CountryId,Name,Code,Culture,CurrencyCode," + // 0-4
+ "GeographyId,PostalCodeLength FROM Countries "; // 5-6
private static BasicCountry ReadCountryFromDataReader(DbDataReader reader)
@@ -29,18 +29,19 @@ namespace Swarmops.Database
#endregion
-
#region Record reading code
- public BasicCountry GetCountry (string countryCode)
+ public BasicCountry GetCountry(string countryCode)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command =
- GetDbCommand("SELECT " + countryFieldSequence + " WHERE Code='" + countryCode.ToUpperInvariant().Replace("'", "''") + "'",
- connection);
+ GetDbCommand(
+ "SELECT " + countryFieldSequence + " WHERE Code='" +
+ countryCode.ToUpperInvariant().Replace("'", "''") + "'",
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -54,14 +55,14 @@ namespace Swarmops.Database
}
}
- public BasicCountry GetCountry (int countryId)
+ public BasicCountry GetCountry(int countryId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
- DbCommand command = GetDbCommand("SELECT " + countryFieldSequence + " WHERE CountryId=" + countryId.ToString(),
- connection);
+ DbCommand command = GetDbCommand("SELECT " + countryFieldSequence + " WHERE CountryId=" + countryId,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -75,7 +76,7 @@ namespace Swarmops.Database
}
}
- public BasicCountry[] GetAllCountries ()
+ public BasicCountry[] GetAllCountries()
{
List result = new List();
@@ -97,7 +98,7 @@ namespace Swarmops.Database
}
}
- public BasicCountry[] GetCountriesInUse ()
+ public BasicCountry[] GetCountriesInUse()
{
return GetAllCountries(); // Migrate this once Organizations has moved, too
@@ -124,9 +125,8 @@ namespace Swarmops.Database
#endregion
-
-
- public int CreateCountry (string name, string code, string culture, int geographyId, int postalCodeLength, string collation)
+ public int CreateCountry(string name, string code, string culture, int geographyId, int postalCodeLength,
+ string collation)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -146,7 +146,7 @@ namespace Swarmops.Database
}
}
- public int SetCountryGeographyId (int countryId, int geographyId)
+ public int SetCountryGeographyId(int countryId, int geographyId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -157,11 +157,9 @@ namespace Swarmops.Database
AddParameterWithName(command, "countryId", countryId);
AddParameterWithName(command, "geographyId", geographyId);
-
+
return Convert.ToInt32(command.ExecuteScalar());
}
}
-
-
}
}
\ No newline at end of file
diff --git a/Database/Database-Currencies.cs b/Database/Database-Currencies.cs
index 9387ad0c..a747421f 100644
--- a/Database/Database-Currencies.cs
+++ b/Database/Database-Currencies.cs
@@ -11,7 +11,7 @@ namespace Swarmops.Database
#region Field reading code
private const string currencyFieldSequence =
- " CurrencyId,Code,Name,Sign " + // 0-3
+ " CurrencyId,Code,Name,Sign " + // 0-3
"FROM Currencies ";
private static BasicCurrency ReadCurrencyFromDataReader(IDataRecord reader)
@@ -26,8 +26,6 @@ namespace Swarmops.Database
#endregion
-
-
#region Record reading - SELECT statements
public BasicCurrency GetCurrency(int currencyId)
@@ -47,7 +45,7 @@ namespace Swarmops.Database
return ReadCurrencyFromDataReader(reader);
}
- throw new ArgumentException("Unknown Currency Id: " + currencyId.ToString());
+ throw new ArgumentException("Unknown Currency Id: " + currencyId);
}
}
}
@@ -60,7 +58,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + currencyFieldSequence + "WHERE Code='" + currencyCode.Replace("'", "''").ToUpperInvariant() + "';", connection);
+ "SELECT" + currencyFieldSequence + "WHERE Code='" +
+ currencyCode.Replace("'", "''").ToUpperInvariant() + "';", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -99,11 +98,8 @@ namespace Swarmops.Database
}
}
-
#endregion
-
-
#region Creation and manipulation - stored procedures
public int CreateCurrency(string code, string name, string sign)
@@ -126,7 +122,7 @@ namespace Swarmops.Database
}
- public int SetCurrencyExchangeRate (DateTime date, int currencyId, double eur100)
+ public int SetCurrencyExchangeRate(DateTime date, int currencyId, double eur100)
{
DateTime now = DateTime.Now;
@@ -144,6 +140,7 @@ namespace Swarmops.Database
return Convert.ToInt32(command.ExecuteScalar());
}
}
+
/*
public void SetSalaryNetPaid(int salaryId, bool netPaid)
@@ -223,8 +220,6 @@ namespace Swarmops.Database
}
*/
-
#endregion
-
}
}
\ No newline at end of file
diff --git a/Database/Database-Documents.cs b/Database/Database-Documents.cs
index 1a00979f..929bbe08 100644
--- a/Database/Database-Documents.cs
+++ b/Database/Database-Documents.cs
@@ -48,7 +48,7 @@ namespace Swarmops.Database
"SELECT Documents.DocumentId,Documents.ServerFileName,Documents.ClientFileName,Documents.Description,DocumentTypes.Name AS DocumentType,Documents.ForeignId,Documents.FileSize,Documents.UploadedByPersonId,Documents.UploadedDateTime From Documents,DocumentTypes " +
"WHERE Documents.DocumentTypeId=DocumentTypes.DocumentTypeId AND " +
"Documents.ForeignId = " + foreignId + " AND " +
- "DocumentTypes.Name = '" + documentType.ToString() + "';", connection);
+ "DocumentTypes.Name = '" + documentType + "';", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -75,7 +75,7 @@ namespace Swarmops.Database
"SELECT Documents.DocumentId,Documents.ServerFileName,Documents.ClientFileName,Documents.Description,DocumentTypes.Name AS DocumentType,Documents.ForeignId,Documents.FileSize,Documents.UploadedByPersonId,Documents.UploadedDateTime From Documents,DocumentTypes " +
"WHERE Documents.DocumentTypeId=DocumentTypes.DocumentTypeId AND " +
"Documents.Description = '" + description.Replace("'", "''") + "' AND " +
- "Documents.UploadedDateTime > '" + DateTime.UtcNow.AddDays (-1).ToString ("yyyy-MM-dd HH:mm") + "'";
+ "Documents.UploadedDateTime > '" + DateTime.UtcNow.AddDays(-1).ToString("yyyy-MM-dd HH:mm") + "'";
DbCommand command = GetDbCommand(sqlQuery, connection);
@@ -105,12 +105,12 @@ namespace Swarmops.Database
DateTime uploadedDateTime = reader.GetDateTime(8);
return new BasicDocument(documentId, serverFileName, clientFileName, description, docType,
- foreignId, fileSize, uploadedByPersonId, uploadedDateTime);
+ foreignId, fileSize, uploadedByPersonId, uploadedDateTime);
}
-
- public int CreateDocument(string serverFileName, string clientFileName, long fileSize, string description, DocumentType documentType, int foreignId, int uploadedByPersonId)
+ public int CreateDocument(string serverFileName, string clientFileName, long fileSize, string description,
+ DocumentType documentType, int foreignId, int uploadedByPersonId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -147,7 +147,6 @@ namespace Swarmops.Database
}
-
public void SetDocumentServerFileName(int documentId, string serverFileName)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -200,7 +199,6 @@ namespace Swarmops.Database
}
-
// The rest was copied from Database-Financials as template code.
/*
diff --git a/Database/Database-Events.cs b/Database/Database-Events.cs
index fb6e296f..443c797d 100644
--- a/Database/Database-Events.cs
+++ b/Database/Database-Events.cs
@@ -12,19 +12,21 @@ namespace Swarmops.Database
#region Field reading code
private const string pwEventFieldSequence =
- " PWEvents.EventId, PWEventTypes.Name AS EventType, PWEventSources.Name AS EventSource, PWEvents.ActingPersonId, PWEvents.AffectedPersonId, " + // 0-4
- " PWEvents.CreatedDateTime, PWEvents.ProcessedDateTime, PWEvents.Open, PWEvents.OrganizationId, PWEvents.GeographyId, " + // 5-9
+ " PWEvents.EventId, PWEventTypes.Name AS EventType, PWEventSources.Name AS EventSource, PWEvents.ActingPersonId, PWEvents.AffectedPersonId, " +
+ // 0-4
+ " PWEvents.CreatedDateTime, PWEvents.ProcessedDateTime, PWEvents.Open, PWEvents.OrganizationId, PWEvents.GeographyId, " +
+ // 5-9
" PWEvents.ParameterInt, PWEvents.ParameterText " + // 10-11
" FROM PWEvents " +
" JOIN PWEventTypes ON (PWEvents.EventTypeId=PWEventTypes.EventTypeId) " +
" JOIN PWEventSources ON (PWEvents.EventSourceId=PWEventSources.EventSourceId) ";
- private BasicPWEvent ReadPWEventFromDataReader (DbDataReader reader)
+ private BasicPWEvent ReadPWEventFromDataReader(DbDataReader reader)
{
int eventId = reader.GetInt32(0);
- EventType eventType = (EventType)Enum.Parse(typeof(EventType), reader.GetString(1));
- EventSource eventSource = (EventSource)Enum.Parse(typeof(EventSource), reader.GetString(2));
+ EventType eventType = (EventType) Enum.Parse(typeof (EventType), reader.GetString(1));
+ EventSource eventSource = (EventSource) Enum.Parse(typeof (EventSource), reader.GetString(2));
int actingPersonId = reader.GetInt32(3);
int affectedPersonId = reader.GetInt32(4);
DateTime eventDateTime = reader.GetDateTime(5);
@@ -35,36 +37,14 @@ namespace Swarmops.Database
int parameterInt = reader.GetInt32(10);
string parameterText = reader.GetString(11);
- return new BasicPWEvent(eventId, eventDateTime, open, processedDateTime, eventType, eventSource, actingPersonId,
+ return new BasicPWEvent(eventId, eventDateTime, open, processedDateTime, eventType, eventSource,
+ actingPersonId,
affectedPersonId, organizationId, geographyId, parameterInt, parameterText);
}
#endregion
-
- public BasicPWEvent[] GetTopUnprocessedEvents ()
- {
- List result = new List();
-
- using (DbConnection connection = GetMySqlDbConnection())
- {
- connection.Open();
-
- DbCommand command = GetDbCommand("SELECT " + pwEventFieldSequence + " WHERE Open=1 AND ProcessDateTime < NOW() LIMIT 10", connection);
-
- using (DbDataReader reader = command.ExecuteReader())
- {
- while (reader.Read())
- {
- result.Add(ReadPWEventFromDataReader(reader));
- }
-
- return result.ToArray();
- }
- }
- }
-
- public BasicPWEvent[] GetEventsForPerson (int personId)
+ public BasicPWEvent[] GetTopUnprocessedEvents()
{
List result = new List();
@@ -74,7 +54,7 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT " + pwEventFieldSequence + " WHERE AffectedPersonId=" + personId + " ORDER BY CreatedDateTime",
+ "SELECT " + pwEventFieldSequence + " WHERE Open=1 AND ProcessDateTime < NOW() LIMIT 10",
connection);
using (DbDataReader reader = command.ExecuteReader())
@@ -88,13 +68,40 @@ namespace Swarmops.Database
}
}
}
- public Dictionary> GetEventsForPersons (int[] personId, EventType[] eventTypes)
+
+ public BasicPWEvent[] GetEventsForPerson(int personId)
+ {
+ List result = new List();
+
+ using (DbConnection connection = GetMySqlDbConnection())
+ {
+ connection.Open();
+
+ DbCommand command =
+ GetDbCommand(
+ "SELECT " + pwEventFieldSequence + " WHERE AffectedPersonId=" + personId +
+ " ORDER BY CreatedDateTime",
+ connection);
+
+ using (DbDataReader reader = command.ExecuteReader())
+ {
+ while (reader.Read())
+ {
+ result.Add(ReadPWEventFromDataReader(reader));
+ }
+
+ return result.ToArray();
+ }
+ }
+ }
+
+ public Dictionary> GetEventsForPersons(int[] personId, EventType[] eventTypes)
{
Dictionary> result = new Dictionary>();
List eventTypesAsString = new List();
foreach (EventType et in eventTypes)
eventTypesAsString.Add(et.ToString());
-
+
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
@@ -103,7 +110,10 @@ namespace Swarmops.Database
GetDbCommand(
"SELECT " + pwEventFieldSequence
+ " WHERE AffectedPersonId IN (" + JoinIds(personId) + ") "
- + (eventTypes.Length > 0 ? " AND PWEventTypes.Name IN (" + JoinStrings(eventTypesAsString.ToArray()) + ") " : "")
+ +
+ (eventTypes.Length > 0
+ ? " AND PWEventTypes.Name IN (" + JoinStrings(eventTypesAsString.ToArray()) + ") "
+ : "")
+ " ORDER BY CreatedDateTime desc",
connection);
@@ -122,7 +132,7 @@ namespace Swarmops.Database
}
}
- public BasicPWEvent[] GetEventsOfType (EventType eventType)
+ public BasicPWEvent[] GetEventsOfType(EventType eventType)
{
List result = new List();
@@ -132,7 +142,7 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT " + pwEventFieldSequence + " WHERE PWEventTypes.Name='" + eventType.ToString() +
+ "SELECT " + pwEventFieldSequence + " WHERE PWEventTypes.Name='" + eventType +
"' ORDER BY CreatedDateTime", connection);
using (DbDataReader reader = command.ExecuteReader())
@@ -148,19 +158,18 @@ namespace Swarmops.Database
}
-
- public int CreateEvent (EventSource eventSource, EventType eventType, int actingPersonId,
- int organizationId,
- int geographyId, int affectedPersonId, int parameterInt, string parameterText)
+ public int CreateEvent(EventSource eventSource, EventType eventType, int actingPersonId,
+ int organizationId,
+ int geographyId, int affectedPersonId, int parameterInt, string parameterText)
{
return CreateEvent(eventSource, eventType, actingPersonId, organizationId, geographyId, affectedPersonId,
- parameterInt, parameterText, DateTime.Now);
+ parameterInt, parameterText, DateTime.Now);
}
- public int CreateEvent (EventSource eventSource, EventType eventType, int actingPersonId,
- int organizationId,
- int geographyId, int affectedPersonId, int parameterInt, string parameterText,
- DateTime processTime)
+ public int CreateEvent(EventSource eventSource, EventType eventType, int actingPersonId,
+ int organizationId,
+ int geographyId, int affectedPersonId, int parameterInt, string parameterText,
+ DateTime processTime)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -183,7 +192,7 @@ namespace Swarmops.Database
}
}
- public void SetEventProcessed (int eventId)
+ public void SetEventProcessed(int eventId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
diff --git a/Database/Database-ExceptionLog.cs b/Database/Database-ExceptionLog.cs
index 1abe53a0..42d4b955 100644
--- a/Database/Database-ExceptionLog.cs
+++ b/Database/Database-ExceptionLog.cs
@@ -8,11 +8,11 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
- private const string exceptionLogFieldSequence = " ExceptionID, ExceptionDateTime, Source,ExceptionText FROM ExceptionLog ";
+ private const string exceptionLogFieldSequence =
+ " ExceptionID, ExceptionDateTime, Source,ExceptionText FROM ExceptionLog ";
- private static BasicExceptionLog ExceptionLogFromDataReader (DbDataReader reader)
+ private static BasicExceptionLog ExceptionLogFromDataReader(DbDataReader reader)
{
-
int ExceptionId = reader.GetInt32(0);
DateTime ExceptionDateTime = reader.GetDateTime(1);
string Source = reader.GetString(2);
@@ -20,7 +20,7 @@ namespace Swarmops.Database
return new BasicExceptionLog(ExceptionId, ExceptionDateTime, Source, ExceptionText);
}
- public void CreateExceptionLogEntry (DateTime dateTime, string source, Exception e)
+ public void CreateExceptionLogEntry(DateTime dateTime, string source, Exception e)
{
try
{
@@ -42,13 +42,11 @@ namespace Swarmops.Database
{
//never fail from this routine, it is used in exceptionhandlig,
// and if it isn't possible log the error then so be it.
- return;
}
}
-
- public BasicExceptionLog[] GetExceptionLogTopEntries (int count)
+ public BasicExceptionLog[] GetExceptionLogTopEntries(int count)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -71,7 +69,6 @@ namespace Swarmops.Database
return result.ToArray();
}
}
-
}
}
}
\ No newline at end of file
diff --git a/Database/Database-Expenses.cs b/Database/Database-Expenses.cs
index 1f52658d..e9714ccf 100644
--- a/Database/Database-Expenses.cs
+++ b/Database/Database-Expenses.cs
@@ -9,7 +9,7 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
- public BasicExpenseClaim GetExpenseClaim (int expenseClaimId)
+ public BasicExpenseClaim GetExpenseClaim(int expenseClaimId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -19,7 +19,7 @@ namespace Swarmops.Database
"SELECT ExpenseClaimId,ClaimingPersonId,CreatedDateTime,Open,Attested," +
"Validated,Claimed,OrganizationId,GeographyId,BudgetId," +
"ExpenseDate,Description,PreApprovedAmount,AmountCents,Repaid,KeepSeparate " +
- "FROM ExpenseClaims WHERE ExpenseClaimId=" + expenseClaimId.ToString(),
+ "FROM ExpenseClaims WHERE ExpenseClaimId=" + expenseClaimId,
connection);
using (DbDataReader reader = command.ExecuteReader())
@@ -44,10 +44,10 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand("SELECT ExpenseClaimId,ClaimingPersonId,CreatedDateTime,Open,Attested," +
- "Validated,Claimed,OrganizationId,GeographyId,BudgetId," +
- "ExpenseDate,Description,PreApprovedAmount,AmountCents,Repaid,KeepSeparate " +
- "FROM ExpenseClaims " + ConstructWhereClause("ExpenseClaims", conditions),
- connection);
+ "Validated,Claimed,OrganizationId,GeographyId,BudgetId," +
+ "ExpenseDate,Description,PreApprovedAmount,AmountCents,Repaid,KeepSeparate " +
+ "FROM ExpenseClaims " + ConstructWhereClause("ExpenseClaims", conditions),
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -71,10 +71,10 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand("SELECT ExpenseClaimId,ClaimingPersonId,CreatedDateTime,Open,Attested," +
- "Validated,Claimed,OrganizationId,GeographyId,BudgetId," +
- "ExpenseDate,Description,PreApprovedAmount,AmountCents,Repaid,KeepSeparate " +
- "FROM ExpenseClaims WHERE ClaimingPersonId=" + claimingPersonId.ToString(),
- connection);
+ "Validated,Claimed,OrganizationId,GeographyId,BudgetId," +
+ "ExpenseDate,Description,PreApprovedAmount,AmountCents,Repaid,KeepSeparate " +
+ "FROM ExpenseClaims WHERE ClaimingPersonId=" + claimingPersonId,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -98,10 +98,11 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand("SELECT ExpenseClaimId,ClaimingPersonId,CreatedDateTime,Open,Attested," +
- "Validated,Claimed,OrganizationId,GeographyId,BudgetId," +
- "ExpenseDate,Description,PreApprovedAmount,AmountCents,Repaid,KeepSeparate " +
- "FROM ExpenseClaims WHERE ClaimingPersonId=" + claimingPersonId.ToString() + " AND OrganizationId=" + organizationId.ToString(),
- connection);
+ "Validated,Claimed,OrganizationId,GeographyId,BudgetId," +
+ "ExpenseDate,Description,PreApprovedAmount,AmountCents,Repaid,KeepSeparate " +
+ "FROM ExpenseClaims WHERE ClaimingPersonId=" + claimingPersonId +
+ " AND OrganizationId=" + organizationId,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -125,10 +126,10 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand("SELECT ExpenseClaimId,ClaimingPersonId,CreatedDateTime,Open,Attested," +
- "Validated,Claimed,OrganizationId,GeographyId,BudgetId," +
- "ExpenseDate,Description,PreApprovedAmount,AmountCents,Repaid,KeepSeparate " +
- "FROM ExpenseClaims WHERE BudgetId=" + budgetId.ToString() + " AND BudgetYear=" + budgetYear.ToString(),
- connection);
+ "Validated,Claimed,OrganizationId,GeographyId,BudgetId," +
+ "ExpenseDate,Description,PreApprovedAmount,AmountCents,Repaid,KeepSeparate " +
+ "FROM ExpenseClaims WHERE BudgetId=" + budgetId + " AND BudgetYear=" + budgetYear,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -152,10 +153,10 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand("SELECT ExpenseClaimId,ClaimingPersonId,CreatedDateTime,Open,Attested," +
- "Validated,Claimed,OrganizationId,GeographyId,BudgetId," +
- "ExpenseDate,Description,PreApprovedAmount,AmountCents,Repaid,KeepSeparate " +
- "FROM ExpenseClaims WHERE OrganizationId=" + organizationId.ToString(),
- connection);
+ "Validated,Claimed,OrganizationId,GeographyId,BudgetId," +
+ "ExpenseDate,Description,PreApprovedAmount,AmountCents,Repaid,KeepSeparate " +
+ "FROM ExpenseClaims WHERE OrganizationId=" + organizationId,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -170,7 +171,7 @@ namespace Swarmops.Database
}
- private BasicExpenseClaim ReadExpenseFromDataReader (DbDataReader reader)
+ private BasicExpenseClaim ReadExpenseFromDataReader(DbDataReader reader)
{
int expenseClaimId = reader.GetInt32(0);
int claimingPersonId = reader.GetInt32(1);
@@ -190,14 +191,14 @@ namespace Swarmops.Database
bool keepSeparate = reader.GetBoolean(15);
return new BasicExpenseClaim(expenseClaimId, claimingPersonId, createdDateTime,
- open, attested, documented, claimed, organizationId, geographyId,
- budgetId, expenseDate, description, preApprovedAmount,
- amountCents, repaid, keepSeparate);
+ open, attested, documented, claimed, organizationId, geographyId,
+ budgetId, expenseDate, description, preApprovedAmount,
+ amountCents, repaid, keepSeparate);
}
public int CreateExpenseClaim(int claimingPersonId, int organizationId, int budgetId,
- DateTime expenseDate, string description, double amount)
+ DateTime expenseDate, string description, double amount)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -218,7 +219,7 @@ namespace Swarmops.Database
}
public int CreateExpenseClaim(int claimingPersonId, int organizationId, int budgetId,
- DateTime expenseDate, string description, Int64 amountCents)
+ DateTime expenseDate, string description, Int64 amountCents)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -256,7 +257,7 @@ namespace Swarmops.Database
}
- public int SetExpenseClaimBudget (int expenseClaimId, int budgetId)
+ public int SetExpenseClaimBudget(int expenseClaimId, int budgetId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -273,7 +274,7 @@ namespace Swarmops.Database
}
- public int SetExpenseClaimBudgetYear (int expenseClaimId, int budgetYear)
+ public int SetExpenseClaimBudgetYear(int expenseClaimId, int budgetYear)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -290,7 +291,7 @@ namespace Swarmops.Database
}
- public int SetExpenseClaimDate (int expenseClaimId, DateTime expenseDate)
+ public int SetExpenseClaimDate(int expenseClaimId, DateTime expenseDate)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -324,7 +325,6 @@ namespace Swarmops.Database
}
-
public int SetExpenseClaimAmount(int expenseClaimId, Int64 amountCents)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -342,7 +342,6 @@ namespace Swarmops.Database
}
-
public int SetExpenseClaimAttested(int expenseClaimId, bool attested)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -360,7 +359,6 @@ namespace Swarmops.Database
}
-
public int SetExpenseClaimValidated(int expenseClaimId, bool validated)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -378,7 +376,6 @@ namespace Swarmops.Database
}
-
public int SetExpenseClaimKeepSeparate(int expenseClaimId, bool keepSeparate)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -396,7 +393,6 @@ namespace Swarmops.Database
}
-
public int SetExpenseClaimClaimed(int expenseClaimId, bool claimed)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -414,8 +410,6 @@ namespace Swarmops.Database
}
-
-
public int SetExpenseClaimOpen(int expenseClaimId, bool open)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -433,8 +427,6 @@ namespace Swarmops.Database
}
-
-
public int SetExpenseClaimRepaid(int expenseClaimId, bool repaid)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -452,8 +444,6 @@ namespace Swarmops.Database
}
-
-
public int CreateExpenseEvent(int expenseId, ExpenseEventType eventType, int personId)
{
throw new NotImplementedException("Not migrated to version 4");
@@ -476,8 +466,5 @@ namespace Swarmops.Database
return Convert.ToInt32(command.ExecuteScalar());
}*/
}
-
-
-
}
}
\ No newline at end of file
diff --git a/Database/Database-ExternalActivities.cs b/Database/Database-ExternalActivities.cs
index abc0fa74..1b64a7e5 100644
--- a/Database/Database-ExternalActivities.cs
+++ b/Database/Database-ExternalActivities.cs
@@ -12,38 +12,38 @@ namespace Swarmops.Database
#region Field reading code
private const string externalActivityFieldSequence =
- " ExternalActivityId,OrganizationId,GeographyId,DateTime,ExternalActivityTypes.Name," + // 0-4
+ " ExternalActivityId,OrganizationId,GeographyId,DateTime,ExternalActivityTypes.Name," + // 0-4
" Description,CreatedDateTime,CreatedByPersonId,DupeOfActivityId" +
" FROM ExternalActivities JOIN ExternalActivityTypes USING (ExternalActivityTypeId) ";
- private static BasicExternalActivity ReadExternalActivityFromDataReader (IDataRecord reader)
+ private static BasicExternalActivity ReadExternalActivityFromDataReader(IDataRecord reader)
{
int externalActivityId = reader.GetInt32(0);
int organizationId = reader.GetInt32(1);
int geographyId = reader.GetInt32(2);
DateTime dateTime = reader.GetDateTime(3);
- ExternalActivityType type = (ExternalActivityType)Enum.Parse(typeof(ExternalActivityType), reader.GetString(4));
+ ExternalActivityType type =
+ (ExternalActivityType) Enum.Parse(typeof (ExternalActivityType), reader.GetString(4));
string description = reader.GetString(5);
DateTime createdDateTime = reader.GetDateTime(6);
int createdByPersonId = reader.GetInt32(7);
int dupeOfActivityId = reader.GetInt32(8);
- return new BasicExternalActivity(externalActivityId, organizationId, geographyId, type, dateTime, description, createdByPersonId, createdDateTime, dupeOfActivityId);
+ return new BasicExternalActivity(externalActivityId, organizationId, geographyId, type, dateTime,
+ description, createdByPersonId, createdDateTime, dupeOfActivityId);
}
#endregion
-
-
#region Record reading - SELECT statements
///
- /// Gets an external activity from the database.
+ /// Gets an external activity from the database.
///
/// The external activity database identity.
/// The requested external activity.
/// Thrown if there is no such identity.
- public BasicExternalActivity GetExternalActivity (int externalActivityId)
+ public BasicExternalActivity GetExternalActivity(int externalActivityId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -51,7 +51,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + externalActivityFieldSequence + "WHERE ExternalActivityId=" + externalActivityId + ";", connection);
+ "SELECT" + externalActivityFieldSequence + "WHERE ExternalActivityId=" + externalActivityId +
+ ";", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -60,27 +61,34 @@ namespace Swarmops.Database
return ReadExternalActivityFromDataReader(reader);
}
- throw new ArgumentException("Unknown External Activity Id: " + externalActivityId.ToString());
+ throw new ArgumentException("Unknown External Activity Id: " + externalActivityId);
}
}
}
///
- /// Gets ExternalActivities from the database.
+ /// Gets ExternalActivities from the database.
///
- /// An optional combination of a Person and/or Organization object and/or DatabaseCondition specifiers.
+ ///
+ /// An optional combination of a Person and/or Organization object and/or DatabaseCondition
+ /// specifiers.
+ ///
/// A list of matching ExternalActivities.
- public BasicExternalActivity[] GetExternalActivities (params object[] conditions)
+ public BasicExternalActivity[] GetExternalActivities(params object[] conditions)
{
return GetExternalActivitiesSorted("", 0, conditions);
}
///
- /// Gets ExternalActivities from the database.
+ /// Gets ExternalActivities from the database.
///
- /// An optional combination of a Person and/or Organization object and/or DatabaseCondition specifiers.
+ ///
+ /// An optional combination of a Person and/or Organization object and/or DatabaseCondition
+ /// specifiers.
+ ///
/// A list of matching ExternalActivities.
- public BasicExternalActivity[] GetExternalActivitiesSorted (string sortOrder, int limitCount, params object[] conditions)
+ public BasicExternalActivity[] GetExternalActivitiesSorted(string sortOrder, int limitCount,
+ params object[] conditions)
{
List result = new List();
@@ -107,7 +115,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + externalActivityFieldSequence + ConstructWhereClause("ExternalActivities", conditions) + sort + limit, connection);
+ "SELECT" + externalActivityFieldSequence +
+ ConstructWhereClause("ExternalActivities", conditions) + sort + limit, connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -121,14 +130,12 @@ namespace Swarmops.Database
}
}
-
#endregion
-
-
#region Creation and manipulation - stored procedures
- public int CreateExternalActivity (int organizationId, int geographyId, DateTime dateTime, ExternalActivityType type, string description, int createdByPersonId)
+ public int CreateExternalActivity(int organizationId, int geographyId, DateTime dateTime,
+ ExternalActivityType type, string description, int createdByPersonId)
{
if (description.Length > 256)
{
@@ -154,9 +161,6 @@ namespace Swarmops.Database
}
}
-
-
#endregion
-
}
}
\ No newline at end of file
diff --git a/Database/Database-ExternalCredentials.cs b/Database/Database-ExternalCredentials.cs
index b6879297..5433b877 100644
--- a/Database/Database-ExternalCredentials.cs
+++ b/Database/Database-ExternalCredentials.cs
@@ -6,7 +6,7 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
- public BasicExternalCredential GetExternalCredential (string serviceName)
+ public BasicExternalCredential GetExternalCredential(string serviceName)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -14,7 +14,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT ExternalCredentialId,ServiceName,Login,Password From ExternalCredentials WHERE ServiceName='" + serviceName.Replace("'", "''") + "'",
+ "SELECT ExternalCredentialId,ServiceName,Login,Password From ExternalCredentials WHERE ServiceName='" +
+ serviceName.Replace("'", "''") + "'",
connection);
using (DbDataReader reader = command.ExecuteReader())
@@ -30,7 +31,7 @@ namespace Swarmops.Database
}
- private BasicExternalCredential ReadExternalCredentialFromDataReader (DbDataReader reader)
+ private BasicExternalCredential ReadExternalCredentialFromDataReader(DbDataReader reader)
{
int externalCredentialId = reader.GetInt32(0);
string serviceName = reader.GetString(1);
diff --git a/Database/Database-ExternalIdentities.cs b/Database/Database-ExternalIdentities.cs
index 097a1f68..e0e71c93 100644
--- a/Database/Database-ExternalIdentities.cs
+++ b/Database/Database-ExternalIdentities.cs
@@ -13,7 +13,7 @@ namespace Swarmops.Database
@" ExternalIdentityIdentity, ExternalIdentityTypeName, ExternalSystem, UserID, `Password`, AttachedToPerson
FROM ExternalIdentities inner join ExternalIdentityTypes on TypeOfAccount=ExternalIdentityTypeId";
- public BasicExternalIdentity GetExternalIdentity (int identity)
+ public BasicExternalIdentity GetExternalIdentity(int identity)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -37,7 +37,7 @@ namespace Swarmops.Database
}
}
- public BasicExternalIdentity GetExternalIdentityFromPersonIdAndType (int persId, ExternalIdentityType type)
+ public BasicExternalIdentity GetExternalIdentityFromPersonIdAndType(int persId, ExternalIdentityType type)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -45,7 +45,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT " + readFieldsSQL + " WHERE AttachedToPerson= @persId and ExternalIdentityTypeName = @typeName",
+ "SELECT " + readFieldsSQL +
+ " WHERE AttachedToPerson= @persId and ExternalIdentityTypeName = @typeName",
connection);
AddParameterWithName(command, "persId", persId);
AddParameterWithName(command, "typeName", type.ToString());
@@ -62,7 +63,7 @@ namespace Swarmops.Database
}
}
- public BasicExternalIdentity GetExternalIdentityFromUserIdAndType (string userid, ExternalIdentityType type)
+ public BasicExternalIdentity GetExternalIdentityFromUserIdAndType(string userid, ExternalIdentityType type)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -87,7 +88,7 @@ namespace Swarmops.Database
}
}
- public List GetExternalIdentities (int persId)
+ public List GetExternalIdentities(int persId)
{
List retval = new List();
using (DbConnection connection = GetMySqlDbConnection())
@@ -112,7 +113,7 @@ namespace Swarmops.Database
}
///
- /// Update/Insert if id == 0 it is an insert
+ /// Update/Insert if id == 0 it is an insert
///
///
///
@@ -121,7 +122,7 @@ namespace Swarmops.Database
///
///
///
- public BasicExternalIdentity SetExternalIdentity (
+ public BasicExternalIdentity SetExternalIdentity(
int externalIdentityIdentity,
ExternalIdentityType typeOfAccount,
string externalSystem,
@@ -138,8 +139,8 @@ namespace Swarmops.Database
AddParameterWithName(command, "pExternalIdentityIdentity", externalIdentityIdentity);
AddParameterWithName(command, "pTypeOfAccount", typeOfAccount.ToString());
- AddParameterWithName(command, "pExternalSystem", externalSystem.ToString());
- AddParameterWithName(command, "pUserID", userID.ToString());
+ AddParameterWithName(command, "pExternalSystem", externalSystem);
+ AddParameterWithName(command, "pUserID", userID);
AddParameterWithName(command, "pPassword", password);
AddParameterWithName(command, "pAttachedToPerson", attachedToPerson);
@@ -155,18 +156,19 @@ namespace Swarmops.Database
}
-
-
- private BasicExternalIdentity ReadExternalIdentityFromDataReader (DbDataReader reader)
+ private BasicExternalIdentity ReadExternalIdentityFromDataReader(DbDataReader reader)
{
- int externalIdentityId = (int)reader["ExternalIdentityIdentity"];
- ExternalIdentityType typeOfAccount = (ExternalIdentityType)Enum.Parse(typeof(ExternalIdentityType), reader["ExternalIdentityTypeName"].ToString());
- string externalSystem = (string)reader["ExternalSystem"];
- string userID = (string)reader["UserID"];
- string password = (string)reader["Password"];
- int attachedToPerson = (int)reader["AttachedToPerson"];
+ int externalIdentityId = (int) reader["ExternalIdentityIdentity"];
+ ExternalIdentityType typeOfAccount =
+ (ExternalIdentityType)
+ Enum.Parse(typeof (ExternalIdentityType), reader["ExternalIdentityTypeName"].ToString());
+ string externalSystem = (string) reader["ExternalSystem"];
+ string userID = (string) reader["UserID"];
+ string password = (string) reader["Password"];
+ int attachedToPerson = (int) reader["AttachedToPerson"];
- return new BasicExternalIdentity(externalIdentityId, typeOfAccount, externalSystem, userID, password, attachedToPerson);
+ return new BasicExternalIdentity(externalIdentityId, typeOfAccount, externalSystem, userID, password,
+ attachedToPerson);
}
}
}
\ No newline at end of file
diff --git a/Database/Database-FinancialTransactionTagSetTypes.cs b/Database/Database-FinancialTransactionTagSetTypes.cs
index b4928ba4..06c6d20f 100644
--- a/Database/Database-FinancialTransactionTagSetTypes.cs
+++ b/Database/Database-FinancialTransactionTagSetTypes.cs
@@ -9,15 +9,14 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
-
#region Database field reading
-
private const string financialTransactionTagSetTypeFieldSequence =
- " FinancialTransactionTagSetTypeId,ResourceName " + // 0-1
+ " FinancialTransactionTagSetTypeId,ResourceName " + // 0-1
"FROM FinancialTransactionTagSetTypes ";
- private static BasicFinancialTransactionTagSetType ReadFinancialTransactionTagSetTypeFromDataReader(IDataRecord reader)
+ private static BasicFinancialTransactionTagSetType ReadFinancialTransactionTagSetTypeFromDataReader(
+ IDataRecord reader)
{
int financialTransactionTagSetTypeId = reader.GetInt32(0);
string resourceName = reader.GetString(1);
@@ -27,30 +26,32 @@ namespace Swarmops.Database
#endregion
-
#region Database record reading -- SELECT clauses
-
- public BasicFinancialTransactionTagSetType GetFinancialTransactionTagSetType (int financialTransactionTagSetTypeId)
+ public BasicFinancialTransactionTagSetType GetFinancialTransactionTagSetType(
+ int financialTransactionTagSetTypeId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command =
- GetDbCommand("SELECT" + financialTransactionTagSetTypeFieldSequence + " WHERE FinancialTransactionTagSetTypeId=" + financialTransactionTagSetTypeId.ToString(CultureInfo.InvariantCulture), connection);
+ GetDbCommand(
+ "SELECT" + financialTransactionTagSetTypeFieldSequence +
+ " WHERE FinancialTransactionTagSetTypeId=" +
+ financialTransactionTagSetTypeId.ToString(CultureInfo.InvariantCulture), connection);
using (DbDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
- return ReadFinancialTransactionTagSetTypeFromDataReader (reader);
+ return ReadFinancialTransactionTagSetTypeFromDataReader(reader);
}
- throw new ArgumentException("No such FinancialTransactionSetTypeId: " + financialTransactionTagSetTypeId.ToString(CultureInfo.InvariantCulture));
+ throw new ArgumentException("No such FinancialTransactionSetTypeId: " +
+ financialTransactionTagSetTypeId.ToString(CultureInfo.InvariantCulture));
}
}
-
}
@@ -68,7 +69,7 @@ namespace Swarmops.Database
{
while (reader.Read())
{
- result.Add (ReadFinancialTransactionTagSetTypeFromDataReader (reader));
+ result.Add(ReadFinancialTransactionTagSetTypeFromDataReader(reader));
}
return result.ToArray();
@@ -76,13 +77,10 @@ namespace Swarmops.Database
}
}
-
#endregion
-
#region Creation and manipulation -- stored procedures
-
/* TODO
*
*
@@ -173,10 +171,8 @@ namespace Swarmops.Database
}
}*/
-
#endregion
-
#region Dead template code
/*
@@ -520,7 +516,5 @@ namespace Swarmops.Database
*/
#endregion
-
-
}
}
\ No newline at end of file
diff --git a/Database/Database-FinancialTransactionTagSets.cs b/Database/Database-FinancialTransactionTagSets.cs
index 695b654b..53868ec2 100644
--- a/Database/Database-FinancialTransactionTagSets.cs
+++ b/Database/Database-FinancialTransactionTagSets.cs
@@ -9,34 +9,32 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
-
#region Database field reading
-
private const string financialTransactionTagSetFieldSequence =
- " FinancialTransactionTagSetId,FinancialTransactionTagSetTypeId,OrganizationId,DisplayOrder,AllowUntagged," + // 0-4
- "VisibilityLevel,ProfitLossType " + // 5-6
+ " FinancialTransactionTagSetId,FinancialTransactionTagSetTypeId,OrganizationId,DisplayOrder,AllowUntagged," +
+ // 0-4
+ "VisibilityLevel,ProfitLossType " + // 5-6
"FROM FinancialTransactionTagSets ";
private static BasicFinancialTransactionTagSet ReadFinancialTransactionTagSetFromDataReader(IDataRecord reader)
{
int financialTransactionTagSetId = reader.GetInt32(0);
- int financialTransactionTagSetTypeId = reader.GetInt32 (1);
- int organizationId = reader.GetInt32 (2);
- int order = reader.GetInt32 (3);
- bool allowUntagged = reader.GetBoolean (4);
+ int financialTransactionTagSetTypeId = reader.GetInt32(1);
+ int organizationId = reader.GetInt32(2);
+ int order = reader.GetInt32(3);
+ bool allowUntagged = reader.GetBoolean(4);
int visibilityLevel = reader.GetInt32(5);
int profitLossType = reader.GetInt32(6);
- return new BasicFinancialTransactionTagSet(financialTransactionTagSetId, financialTransactionTagSetTypeId, organizationId, order, allowUntagged, visibilityLevel, profitLossType);
+ return new BasicFinancialTransactionTagSet(financialTransactionTagSetId, financialTransactionTagSetTypeId,
+ organizationId, order, allowUntagged, visibilityLevel, profitLossType);
}
#endregion
-
#region Database record reading -- SELECT clauses
-
public BasicFinancialTransactionTagSet GetFinancialTransactionTagSet(int financialTransactionTagSetId)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -44,7 +42,9 @@ namespace Swarmops.Database
connection.Open();
DbCommand command =
- GetDbCommand("SELECT" + financialTransactionTagSetFieldSequence + " WHERE FinancialTransactionTagSetId=" + financialTransactionTagSetId.ToString(CultureInfo.InvariantCulture), connection);
+ GetDbCommand(
+ "SELECT" + financialTransactionTagSetFieldSequence + " WHERE FinancialTransactionTagSetId=" +
+ financialTransactionTagSetId.ToString(CultureInfo.InvariantCulture), connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -53,10 +53,10 @@ namespace Swarmops.Database
return ReadFinancialTransactionTagSetFromDataReader(reader);
}
- throw new ArgumentException("No such FinancialTransactionSetTypeId: " + financialTransactionTagSetId.ToString(CultureInfo.InvariantCulture));
+ throw new ArgumentException("No such FinancialTransactionSetTypeId: " +
+ financialTransactionTagSetId.ToString(CultureInfo.InvariantCulture));
}
}
-
}
@@ -68,7 +68,11 @@ namespace Swarmops.Database
{
connection.Open();
- DbCommand command = GetDbCommand("SELECT" + financialTransactionTagSetFieldSequence + ConstructWhereClause ("FinancialTransactionTagSets", conditions) + " ORDER BY DisplayOrder", connection);
+ DbCommand command =
+ GetDbCommand(
+ "SELECT" + financialTransactionTagSetFieldSequence +
+ ConstructWhereClause("FinancialTransactionTagSets", conditions) + " ORDER BY DisplayOrder",
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -82,13 +86,10 @@ namespace Swarmops.Database
}
}
-
#endregion
-
#region Creation and manipulation -- stored procedures
-
/* TODO
*
*
@@ -179,10 +180,8 @@ namespace Swarmops.Database
}
}*/
-
#endregion
-
#region Dead template code
/*
@@ -526,7 +525,5 @@ namespace Swarmops.Database
*/
#endregion
-
-
}
}
\ No newline at end of file
diff --git a/Database/Database-FinancialTransactionTagTypes.cs b/Database/Database-FinancialTransactionTagTypes.cs
index 3227657d..71ee4bef 100644
--- a/Database/Database-FinancialTransactionTagTypes.cs
+++ b/Database/Database-FinancialTransactionTagTypes.cs
@@ -9,36 +9,32 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
-
#region Database field reading
-
private const string financialTransactionTagTypeFieldSequence =
- " FinancialTransactionTagTypeId,ParentFinancialTransactionTagTypeId,FinancialTransactionTagSetId,Name,Active," + // 0-4
- "OpenedYear,ClosedYear " + // 5-6
+ " FinancialTransactionTagTypeId,ParentFinancialTransactionTagTypeId,FinancialTransactionTagSetId,Name,Active," +
+ // 0-4
+ "OpenedYear,ClosedYear " + // 5-6
"FROM FinancialTransactionTagTypes ";
private static BasicFinancialTransactionTagType ReadFinancialTransactionTagTypeFromDataReader(IDataRecord reader)
{
- int financialTransactionTagTypeId = reader.GetInt32 (0);
- int parentFinancialTransactionTagTypeId = reader.GetInt32 (1);
- int financialTransactionTagSetId = reader.GetInt32 (2);
- string name = reader.GetString (3);
- bool active = reader.GetBoolean (4);
- int openedYear = reader.GetInt32 (5);
- int closedYear = reader.GetInt32 (6);
+ int financialTransactionTagTypeId = reader.GetInt32(0);
+ int parentFinancialTransactionTagTypeId = reader.GetInt32(1);
+ int financialTransactionTagSetId = reader.GetInt32(2);
+ string name = reader.GetString(3);
+ bool active = reader.GetBoolean(4);
+ int openedYear = reader.GetInt32(5);
+ int closedYear = reader.GetInt32(6);
- return new BasicFinancialTransactionTagType(financialTransactionTagTypeId, parentFinancialTransactionTagTypeId, financialTransactionTagSetId, name, active, openedYear, closedYear);
+ return new BasicFinancialTransactionTagType(financialTransactionTagTypeId,
+ parentFinancialTransactionTagTypeId, financialTransactionTagSetId, name, active, openedYear, closedYear);
}
-
-
#endregion
-
#region Database record reading -- SELECT clauses
-
public BasicFinancialTransactionTagType GetFinancialTransactionTagType(int financialTransactionTagTypeId)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -46,7 +42,9 @@ namespace Swarmops.Database
connection.Open();
DbCommand command =
- GetDbCommand("SELECT" + financialTransactionTagTypeFieldSequence + " WHERE FinancialTransactionTagTypeId=" + financialTransactionTagTypeId.ToString(CultureInfo.InvariantCulture), connection);
+ GetDbCommand(
+ "SELECT" + financialTransactionTagTypeFieldSequence + " WHERE FinancialTransactionTagTypeId=" +
+ financialTransactionTagTypeId.ToString(CultureInfo.InvariantCulture), connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -55,10 +53,10 @@ namespace Swarmops.Database
return ReadFinancialTransactionTagTypeFromDataReader(reader);
}
- throw new ArgumentException("No such FinancialTransactionSetTypeId: " + financialTransactionTagTypeId.ToString(CultureInfo.InvariantCulture));
+ throw new ArgumentException("No such FinancialTransactionSetTypeId: " +
+ financialTransactionTagTypeId.ToString(CultureInfo.InvariantCulture));
}
}
-
}
@@ -70,7 +68,10 @@ namespace Swarmops.Database
{
connection.Open();
- DbCommand command = GetDbCommand("SELECT" + financialTransactionTagTypeFieldSequence + ConstructWhereClause("FinancialTransactionTagTypes", conditions), connection);
+ DbCommand command =
+ GetDbCommand(
+ "SELECT" + financialTransactionTagTypeFieldSequence +
+ ConstructWhereClause("FinancialTransactionTagTypes", conditions), connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -85,7 +86,7 @@ namespace Swarmops.Database
}
- public BasicFinancialTransactionTagType[] GetFinancialTransactionTagTypesByIdentity (int[] identities)
+ public BasicFinancialTransactionTagType[] GetFinancialTransactionTagTypesByIdentity(int[] identities)
{
List result = new List();
@@ -93,7 +94,10 @@ namespace Swarmops.Database
{
connection.Open();
- DbCommand command = GetDbCommand("SELECT" + financialTransactionTagTypeFieldSequence + " WHERE FinancialTransactionTagTypeId IN (" + JoinIds(identities) + ")", connection);
+ DbCommand command =
+ GetDbCommand(
+ "SELECT" + financialTransactionTagTypeFieldSequence +
+ " WHERE FinancialTransactionTagTypeId IN (" + JoinIds(identities) + ")", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -107,13 +111,10 @@ namespace Swarmops.Database
}
}
-
#endregion
-
#region Creation and manipulation -- stored procedures
-
/* TODO
*
*
@@ -204,10 +205,8 @@ namespace Swarmops.Database
}
}*/
-
#endregion
-
#region Dead template code
/*
@@ -551,7 +550,5 @@ namespace Swarmops.Database
*/
#endregion
-
-
}
}
\ No newline at end of file
diff --git a/Database/Database-FinancialTransactionTags.cs b/Database/Database-FinancialTransactionTags.cs
index f25c1248..eba99104 100644
--- a/Database/Database-FinancialTransactionTags.cs
+++ b/Database/Database-FinancialTransactionTags.cs
@@ -8,18 +8,15 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
-
#region Database field reading
// None for this type
#endregion
-
#region Database record reading -- SELECT clauses
-
- public int[] GetFinancialTransactionTagTypes (int financialTransactionId)
+ public int[] GetFinancialTransactionTagTypes(int financialTransactionId)
{
List result = new List();
using (DbConnection connection = GetMySqlDbConnection())
@@ -27,28 +24,27 @@ namespace Swarmops.Database
connection.Open();
DbCommand command =
- GetDbCommand("SELECT FinancialTransactionTagTypeId FROM FinancialTransactionTags WHERE FinancialTransactionId=" + financialTransactionId.ToString(CultureInfo.InvariantCulture), connection);
+ GetDbCommand(
+ "SELECT FinancialTransactionTagTypeId FROM FinancialTransactionTags WHERE FinancialTransactionId=" +
+ financialTransactionId.ToString(CultureInfo.InvariantCulture), connection);
using (DbDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
- result.Add(reader.GetInt32(0)); // This is a tag type IDENTITY. Need another db call to read the actual tag types.
+ result.Add(reader.GetInt32(0));
+ // This is a tag type IDENTITY. Need another db call to read the actual tag types.
}
return result.ToArray();
}
}
-
}
-
#endregion
-
#region Creation and manipulation -- stored procedures
-
public int CreateFinancialTransactionTag(int financialTransactionId, int financialTransactionTagTypeId)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -61,7 +57,7 @@ namespace Swarmops.Database
AddParameterWithName(command, "financialTransactionId", financialTransactionId);
AddParameterWithName(command, "financialTransactionTagTypeId", financialTransactionTagTypeId);
- return Convert.ToInt32(command.ExecuteScalar()); // returns identity, but it's not used - yet, anyway
+ return Convert.ToInt32(command.ExecuteScalar()); // returns identity, but it's not used - yet, anyway
}
}
@@ -95,11 +91,8 @@ namespace Swarmops.Database
}
}
-
-
#endregion
-
#region Dead template code
/*
@@ -443,7 +436,5 @@ namespace Swarmops.Database
*/
#endregion
-
-
}
}
\ No newline at end of file
diff --git a/Database/Database-FinancialValidations.cs b/Database/Database-FinancialValidations.cs
index 387c98a9..a222d37c 100644
--- a/Database/Database-FinancialValidations.cs
+++ b/Database/Database-FinancialValidations.cs
@@ -12,8 +12,9 @@ namespace Swarmops.Database
#region Field reading code
private const string financialValidationFieldSequence =
- " FinancialValidationId,FinancialValidationTypes.Name AS ValidationType,FinancialDependencyTypes.Name AS DependencyType,ForeignId,ValidatedDateTime," + // 0-4
- " PersonId,Amount " + // 5-6
+ " FinancialValidationId,FinancialValidationTypes.Name AS ValidationType,FinancialDependencyTypes.Name AS DependencyType,ForeignId,ValidatedDateTime," +
+ // 0-4
+ " PersonId,Amount " + // 5-6
" FROM FinancialValidations JOIN FinancialValidationTypes ON (FinancialValidations.TypeId=FinancialValidationTypes.FinancialValidationTypeId) " +
" JOIN FinancialDependencyTypes USING (FinancialDependencyTypeId)";
@@ -23,21 +24,20 @@ namespace Swarmops.Database
{
int financialValidationId = reader.GetInt32(0);
FinancialValidationType validationType =
- (FinancialValidationType)(Enum.Parse(typeof(FinancialValidationType), reader.GetString(1)));
+ (FinancialValidationType) (Enum.Parse(typeof (FinancialValidationType), reader.GetString(1)));
FinancialDependencyType dependencyType =
- (FinancialDependencyType)(Enum.Parse(typeof(FinancialDependencyType), reader.GetString(2)));
+ (FinancialDependencyType) (Enum.Parse(typeof (FinancialDependencyType), reader.GetString(2)));
int foreignId = reader.GetInt32(3);
DateTime dateTime = reader.GetDateTime(4);
int personId = reader.GetInt32(5);
double amount = reader.GetDouble(6); // not yet used
- return new BasicFinancialValidation(financialValidationId, validationType, personId, dateTime, dependencyType, foreignId);
+ return new BasicFinancialValidation(financialValidationId, validationType, personId, dateTime,
+ dependencyType, foreignId);
}
#endregion
-
-
#region Record reading - SELECT statements
public BasicFinancialValidation[] GetFinancialValidations(FinancialDependencyType dependencyType, int foreignId)
@@ -50,7 +50,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT " + financialValidationFieldSequence + " WHERE FinancialDependencyTypes.Name='" + dependencyType.ToString() + "' AND ForeignId=" + foreignId.ToString() + " " + financialValidationOrder, connection);
+ "SELECT " + financialValidationFieldSequence + " WHERE FinancialDependencyTypes.Name='" +
+ dependencyType + "' AND ForeignId=" + foreignId + " " + financialValidationOrder, connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -64,9 +65,6 @@ namespace Swarmops.Database
}
}
-
#endregion
-
-
}
}
\ No newline at end of file
diff --git a/Database/Database-Financials.cs b/Database/Database-Financials.cs
index 3681e7e7..82565930 100644
--- a/Database/Database-Financials.cs
+++ b/Database/Database-Financials.cs
@@ -16,12 +16,13 @@ namespace Swarmops.Database
public partial class SwarmDb
{
private const string financialAccountFieldSequence =
- " FinancialAccountId,Name,OrganizationId,AccountType,ParentFinancialAccountId," + // 0-4
- " OwnerPersonId,Open,OpenedYear,ClosedYear,Expensable," + // 5-9
+ " FinancialAccountId,Name,OrganizationId,AccountType,ParentFinancialAccountId," + // 0-4
+ " OwnerPersonId,Open,OpenedYear,ClosedYear,Expensable," + // 5-9
" Administrative,Active,LinkBackward,LinkForward " + // 10-13
" FROM FinancialAccounts ";
- public int CreateFinancialAccount(int pOrganizationId, string pName, FinancialAccountType pAccountType, int pParentFinancialAccountId)
+ public int CreateFinancialAccount(int pOrganizationId, string pName, FinancialAccountType pAccountType,
+ int pParentFinancialAccountId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -32,7 +33,7 @@ namespace Swarmops.Database
AddParameterWithName(command, "pOrganizationId", pOrganizationId);
AddParameterWithName(command, "pName", pName);
- AddParameterWithName(command, "pAccountType", (int)pAccountType);
+ AddParameterWithName(command, "pAccountType", (int) pAccountType);
AddParameterWithName(command, "pParentFinancialAccountId", pParentFinancialAccountId);
return Convert.ToInt32(command.ExecuteScalar());
@@ -69,7 +70,7 @@ namespace Swarmops.Database
public BasicFinancialAccount[] GetFinancialAccountsForOrganization(int organizationId)
{
- var result = new List();
+ List result = new List();
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -94,7 +95,7 @@ namespace Swarmops.Database
public BasicFinancialAccount[] GetFinancialAccountsOwnedByPerson(int ownerPersonId)
{
- var result = new List();
+ List result = new List();
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -119,7 +120,7 @@ namespace Swarmops.Database
public BasicFinancialAccount[] GetFinancialAccounts(int[] financialAccountIds)
{
- var result = new List();
+ List result = new List();
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -144,7 +145,7 @@ namespace Swarmops.Database
public BasicFinancialTransaction GetFinancialTransaction(int financialTransactionId)
{
- var array = GetFinancialTransactions(new int[] {financialTransactionId});
+ BasicFinancialTransaction[] array = GetFinancialTransactions(new[] {financialTransactionId});
if (array.Length == 0)
{
@@ -154,7 +155,7 @@ namespace Swarmops.Database
return array[0];
}
- public BasicFinancialTransaction[] GetFinancialTransactions (int[] financialTransactionIds)
+ public BasicFinancialTransaction[] GetFinancialTransactions(int[] financialTransactionIds)
{
List result = new List();
@@ -165,7 +166,7 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
"SELECT FinancialTransactionId,OrganizationId,DateTime,Comment,ImportHash From FinancialTransactions WHERE FinancialTransactionId IN (" +
- JoinIds (financialTransactionIds) + ");", connection);
+ JoinIds(financialTransactionIds) + ");", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -179,7 +180,7 @@ namespace Swarmops.Database
}
}
- public BasicFinancialTransaction GetFinancialTransactionFromImportKey (int organizationId, string importKey)
+ public BasicFinancialTransaction GetFinancialTransactionFromImportKey(int organizationId, string importKey)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -187,7 +188,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT FinancialTransactionId,OrganizationId,DateTime,Comment,ImportHash From FinancialTransactions WHERE OrganizationId=" + organizationId.ToString() + " AND ImportHash='" + importKey.Replace("'", "''") + "';", connection);
+ "SELECT FinancialTransactionId,OrganizationId,DateTime,Comment,ImportHash From FinancialTransactions WHERE OrganizationId=" +
+ organizationId + " AND ImportHash='" + importKey.Replace("'", "''") + "';", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -217,7 +219,7 @@ namespace Swarmops.Database
{
if (reader.Read())
{
- return reader.GetInt64(0) / 100.0;
+ return reader.GetInt64(0)/100.0;
}
throw new ArgumentException("Unknown Account Id");
@@ -281,7 +283,8 @@ namespace Swarmops.Database
}
}
- public Int64 GetFinancialAccountBalanceDeltaCents(int[] financialAccountIds, DateTime startDate, DateTime endDate)
+ public Int64 GetFinancialAccountBalanceDeltaCents(int[] financialAccountIds, DateTime startDate,
+ DateTime endDate)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -320,16 +323,16 @@ namespace Swarmops.Database
return GetFinancialAccountBalanceDeltaCents(financialAccountId, startDate, endDate)/100.0m;
}
- public BasicFinancialAccountRow[] GetFinancialAccountRows (int financialAccountId, DateTime startDateTime,
- DateTime endDateTime, bool selectFar)
+ public BasicFinancialAccountRow[] GetFinancialAccountRows(int financialAccountId, DateTime startDateTime,
+ DateTime endDateTime, bool selectFar)
{
- return GetFinancialAccountRows(new int[] {financialAccountId}, startDateTime, endDateTime, selectFar);
+ return GetFinancialAccountRows(new[] {financialAccountId}, startDateTime, endDateTime, selectFar);
}
public BasicFinancialAccountRow[] GetFinancialAccountRows(int[] financialAccountIds, DateTime startDateTime,
- DateTime endDateTime, bool selectFar)
+ DateTime endDateTime, bool selectFar)
{
- var result = new List();
+ List result = new List();
// initialize to near selector (equal sign by the lower bound
@@ -351,7 +354,8 @@ namespace Swarmops.Database
"select FinancialTransactionRows.FinancialAccountId,FinancialTransactionRows.FinancialTransactionId,FinancialTransactions.DateTime,FinancialTransactions.Comment,FinancialTransactionRows.AmountCents,FinancialTransactionRows.CreatedDateTime,FinancialTransactionRows.CreatedByPersonId FROM FinancialTransactions,FinancialTransactionRows WHERE FinancialTransactionRows.Deleted=0 AND FinancialTransactions.FinancialTransactionId=FinancialTransactionRows.FinancialTransactionId AND FinancialTransactionRows.FinancialAccountId IN (" +
JoinIds(financialAccountIds) + ") AND DateTime " + selectorLower + " '" +
startDateTime.ToString("yyyy-MM-dd HH:mm:ss") +
- "' AND DateTime " + selectorUpper + " '" + endDateTime.ToString("yyyy-MM-dd HH:mm:ss") + "' ORDER BY DateTime,FinancialTransactions.FinancialTransactionId,FinancialTransactionRows.CreatedDateTime;",
+ "' AND DateTime " + selectorUpper + " '" + endDateTime.ToString("yyyy-MM-dd HH:mm:ss") +
+ "' ORDER BY DateTime,FinancialTransactions.FinancialTransactionId,FinancialTransactionRows.CreatedDateTime;",
connection);
using (DbDataReader reader = command.ExecuteReader())
@@ -367,14 +371,14 @@ namespace Swarmops.Database
}
- public BasicFinancialAccountRow[] GetLastFinancialAccountRows (int financialAccountId, int rowCount)
+ public BasicFinancialAccountRow[] GetLastFinancialAccountRows(int financialAccountId, int rowCount)
{
- return GetLastFinancialAccountRows(new int[] {financialAccountId}, rowCount);
+ return GetLastFinancialAccountRows(new[] {financialAccountId}, rowCount);
}
- public BasicFinancialAccountRow[] GetLastFinancialAccountRows (int[] financialAccountIds, int rowCount)
+ public BasicFinancialAccountRow[] GetLastFinancialAccountRows(int[] financialAccountIds, int rowCount)
{
- var result = new List();
+ List result = new List();
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -383,7 +387,9 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
"select FinancialTransactionRows.FinancialAccountId,FinancialTransactionRows.FinancialTransactionId,FinancialTransactions.DateTime,FinancialTransactions.Comment,FinancialTransactionRows.AmountCents,FinancialTransactionRows.CreatedDateTime,FinancialTransactionRows.CreatedByPersonId FROM FinancialTransactions,FinancialTransactionRows WHERE FinancialTransactionRows.Deleted=0 AND FinancialTransactions.FinancialTransactionId=FinancialTransactionRows.FinancialTransactionId AND FinancialTransactionRows.FinancialAccountId IN (" +
- JoinIds(financialAccountIds) + ") ORDER BY DateTime DESC,FinancialTransactions.FinancialTransactionId,FinancialTransactionRows.CreatedDateTime LIMIT " + rowCount.ToString() + ";",
+ JoinIds(financialAccountIds) +
+ ") ORDER BY DateTime DESC,FinancialTransactions.FinancialTransactionId,FinancialTransactionRows.CreatedDateTime LIMIT " +
+ rowCount + ";",
connection);
using (DbDataReader reader = command.ExecuteReader())
@@ -401,7 +407,7 @@ namespace Swarmops.Database
public BasicFinancialTransactionRow[] GetFinancialTransactionRows(int financialTransactionId)
{
- var result = new List();
+ List result = new List();
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -425,7 +431,7 @@ namespace Swarmops.Database
}
}
- public BasicFinancialTransactionRow GetFinancialTransactionRow (int financialTransactionRowId)
+ public BasicFinancialTransactionRow GetFinancialTransactionRow(int financialTransactionRowId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -449,9 +455,9 @@ namespace Swarmops.Database
}
- public BasicFinancialTransaction[] GetUnbalancedFinancialTransactions (int organizationId)
+ public BasicFinancialTransaction[] GetUnbalancedFinancialTransactions(int organizationId)
{
- var result = new List();
+ List result = new List();
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -483,7 +489,7 @@ namespace Swarmops.Database
}
- public BasicFinancialTransaction GetFinancialTransactionFromDependency (IHasIdentity foreignObject)
+ public BasicFinancialTransaction GetFinancialTransactionFromDependency(IHasIdentity foreignObject)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -492,7 +498,8 @@ namespace Swarmops.Database
string commandString = "SELECT FinancialTransactionId FROM FinancialTransactionDependencies " +
"JOIN FinancialDependencyTypes ON (FinancialDependencyTypes.FinancialDependencyTypeId=FinancialTransactionDependencies.FinancialDependencyTypeId) " +
"WHERE FinancialDependencyTypes.Name='" + GetForeignTypeString(foreignObject) +
- "' AND FinancialTransactionDependencies.ForeignId=" + foreignObject.Identity + ";";
+ "' AND FinancialTransactionDependencies.ForeignId=" + foreignObject.Identity +
+ ";";
DbCommand command = GetDbCommand(commandString, connection);
@@ -501,28 +508,26 @@ namespace Swarmops.Database
{
if (reader.Read())
{
- return GetFinancialTransaction(reader.GetInt32(0)); // Warning: opens another datareader before closing both
+ return GetFinancialTransaction(reader.GetInt32(0));
+ // Warning: opens another datareader before closing both
}
throw new ArgumentException(
String.Format("No financial transaction for specified dependency: {0} #{1}",
- GetForeignTypeString(foreignObject), foreignObject.Identity));
+ GetForeignTypeString(foreignObject), foreignObject.Identity));
}
}
-
-
-
}
///
- /// Gets all undocumented transactions that lowers assets for a particular organization
+ /// Gets all undocumented transactions that lowers assets for a particular organization
///
/// The organization owning the transactions
/// A list of all such transactions
public BasicFinancialTransaction[] GetUndocumentedFinancialTransactions(int organizationId)
{
- var result = new List();
+ List result = new List();
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -535,7 +540,8 @@ namespace Swarmops.Database
"FROM FinancialTransactions " +
"JOIN FinancialTransactionRows ON (FinancialTransactions.FinancialTransactionId=FinancialTransactionRows.FinancialTransactionId) " +
"JOIN FinancialAccounts ON (FinancialAccounts.FinancialAccountId=FinancialTransactionRows.FinancialAccountId) " +
- "WHERE FinancialTransactions.OrganizationId=" + organizationId + " AND FinancialAccounts.AccountType IN (1,2) " +
+ "WHERE FinancialTransactions.OrganizationId=" + organizationId +
+ " AND FinancialAccounts.AccountType IN (1,2) " +
"AND NOT EXISTS (SELECT DocumentId FROM Documents JOIN DocumentTypes ON (DocumentTypes.DocumentTypeId=Documents.DocumentTypeId) WHERE Documents.ForeignId=FinancialTransactions.FinancialTransactionId AND DocumentTypes.Name='FinancialTransaction') " +
"AND NOT EXISTS (SELECT FinancialTransactionId FROM FinancialTransactionDependencies WHERE FinancialTransactionDependencies.FinancialTransactionId=FinancialTransactions.FinancialTransactionId) " +
"GROUP BY FinancialTransactionId HAVING BalanceDelta < 0;";
@@ -563,7 +569,7 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
"select SUM(Amount) from FinancialAccountBudgets where Year=" + year +
- " AND FinancialAccountId IN (" +JoinIds(financialAccountIds) + ");", connection);
+ " AND FinancialAccountId IN (" + JoinIds(financialAccountIds) + ");", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -847,15 +853,16 @@ namespace Swarmops.Database
DateTime createdDateTime = reader.GetDateTime(4);
int createdByPersonId = reader.GetInt32(5);
- return new BasicFinancialTransactionRow(rowId, accountId, transactionId, amountCents, createdDateTime, createdByPersonId);
+ return new BasicFinancialTransactionRow(rowId, accountId, transactionId, amountCents, createdDateTime,
+ createdByPersonId);
}
- private BasicFinancialAccount ReadFinancialAccountFromDataReader (DbDataReader reader)
+ private BasicFinancialAccount ReadFinancialAccountFromDataReader(DbDataReader reader)
{
int accountId = reader.GetInt32(0);
string name = reader.GetString(1);
int organizationId = reader.GetInt32(2);
- var accountType = (FinancialAccountType) reader.GetInt32(3);
+ FinancialAccountType accountType = (FinancialAccountType) reader.GetInt32(3);
int parentFinancialAccountId = reader.GetInt32(4);
int ownerPersonId = reader.GetInt32(5);
bool open = reader.GetBoolean(6);
@@ -867,10 +874,12 @@ namespace Swarmops.Database
int linkBackward = reader.GetInt32(12);
int linkForward = reader.GetInt32(13);
- return new BasicFinancialAccount(accountId, name, accountType, organizationId, parentFinancialAccountId, ownerPersonId, open, openedYear, closedYear, active, expensable, administrative, linkBackward, linkForward);
+ return new BasicFinancialAccount(accountId, name, accountType, organizationId, parentFinancialAccountId,
+ ownerPersonId, open, openedYear, closedYear, active, expensable, administrative, linkBackward,
+ linkForward);
}
- private BasicFinancialAccountRow ReadFinancialAccountRowFromDataReader (DbDataReader reader)
+ private BasicFinancialAccountRow ReadFinancialAccountRowFromDataReader(DbDataReader reader)
{
int accountId = reader.GetInt32(0);
int transactionId = reader.GetInt32(1);
@@ -880,11 +889,12 @@ namespace Swarmops.Database
DateTime rowDateTime = reader.GetDateTime(5);
int rowCreatedByPersonId = reader.GetInt32(6);
- return new BasicFinancialAccountRow(accountId, transactionId, transactionDateTime, comment, amountCents, rowDateTime, rowCreatedByPersonId);
+ return new BasicFinancialAccountRow(accountId, transactionId, transactionDateTime, comment, amountCents,
+ rowDateTime, rowCreatedByPersonId);
}
- private BasicFinancialTransaction ReadFinancialTransactionFromDataReader (DbDataReader reader)
+ private BasicFinancialTransaction ReadFinancialTransactionFromDataReader(DbDataReader reader)
{
int transactionId = reader.GetInt32(0);
int organizationId = reader.GetInt32(1);
@@ -895,7 +905,7 @@ namespace Swarmops.Database
return new BasicFinancialTransaction(transactionId, organizationId, dateTime, comment, importHash);
}
- public int CreateFinancialTransaction (int organizationId, DateTime dateTime, string comment)
+ public int CreateFinancialTransaction(int organizationId, DateTime dateTime, string comment)
{
if (comment.Length > 127)
{
@@ -917,8 +927,8 @@ namespace Swarmops.Database
}
}
- public int CreateFinancialTransactionStub (int organizationId, DateTime dateTime, int financialAccountId,
- Int64 amountCents, string comment, string importHash, int personId)
+ public int CreateFinancialTransactionStub(int organizationId, DateTime dateTime, int financialAccountId,
+ Int64 amountCents, string comment, string importHash, int personId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -940,7 +950,7 @@ namespace Swarmops.Database
}
public void CreateFinancialTransactionRow(int financialTransactionId, int financialAccountId, double amount,
- int personId)
+ int personId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -960,7 +970,7 @@ namespace Swarmops.Database
}
public void CreateFinancialTransactionRow(int financialTransactionId, int financialAccountId, Int64 amountCents,
- int personId)
+ int personId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -996,7 +1006,8 @@ namespace Swarmops.Database
}
- public void SetFinancialTransactionDependency(int financialTransactionId, FinancialDependencyType dependencyType, int foreignId)
+ public void SetFinancialTransactionDependency(int financialTransactionId, FinancialDependencyType dependencyType,
+ int foreignId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -1030,7 +1041,6 @@ namespace Swarmops.Database
}
-
public DateTime GetFinancialAccountFirstTransactionDate(int financialAccountId)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -1040,9 +1050,10 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
"SELECT FinancialTransactions.DateTime FROM FinancialTransactions,FinancialTransactionRows " +
- "WHERE FinancialTransactions.FinancialTransactionId=FinancialTransactionRows.FinancialTransactionId " +
- "AND FinancialTransactionRows.FinancialAccountId = " + financialAccountId.ToString(CultureInfo.InvariantCulture) + " " +
- "ORDER BY FinancialTransactions.DateTime LIMIT 1;", connection);
+ "WHERE FinancialTransactions.FinancialTransactionId=FinancialTransactionRows.FinancialTransactionId " +
+ "AND FinancialTransactionRows.FinancialAccountId = " +
+ financialAccountId.ToString(CultureInfo.InvariantCulture) + " " +
+ "ORDER BY FinancialTransactions.DateTime LIMIT 1;", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -1050,15 +1061,15 @@ namespace Swarmops.Database
{
return reader.GetDateTime(0);
}
- else
- {
- throw new Exception("No transactions for this account yet"); // need better type here than "Exception"
- };
+ throw new Exception("No transactions for this account yet");
+ // need better type here than "Exception"
+ ;
}
}
}
- public BasicFinancialTransaction[] GetDependentFinancialTransactions(FinancialDependencyType dependencyType, int foreignId)
+ public BasicFinancialTransaction[] GetDependentFinancialTransactions(FinancialDependencyType dependencyType,
+ int foreignId)
{
List transactionIds = new List();
@@ -1069,9 +1080,9 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
"SELECT FinancialTransactionId FROM FinancialTransactionDependencies,FinancialDependencyTypes " +
- "WHERE FinancialDependencyTypes.Name='" + dependencyType.ToString() + "' AND " +
+ "WHERE FinancialDependencyTypes.Name='" + dependencyType + "' AND " +
"FinancialDependencyTypes.FinancialDependencyTypeId=FinancialTransactionDependencies.FinancialDependencyTypeId AND " +
- "FinancialTransactionDependencies.ForeignId=" + foreignId.ToString(), connection);
+ "FinancialTransactionDependencies.ForeignId=" + foreignId, connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -1095,7 +1106,8 @@ namespace Swarmops.Database
// Fix this by introducing the BasicFinancialDependency type in the semi-near future, and
// using it as a return type.
- public void GetFinancialTransactionDependency (int financialTransactionId, out FinancialDependencyType dependencyType, out int foreignId)
+ public void GetFinancialTransactionDependency(int financialTransactionId,
+ out FinancialDependencyType dependencyType, out int foreignId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -1106,7 +1118,8 @@ namespace Swarmops.Database
"SELECT FinancialDependencyTypes.Name,FinancialTransactionDependencies.ForeignId " +
"FROM FinancialTransactionDependencies,FinancialDependencyTypes " +
"WHERE FinancialDependencyTypes.FinancialDependencyTypeId=FinancialTransactionDependencies.FinancialDependencyTypeId " +
- "AND FinancialTransactionDependencies.FinancialTransactionId=" + financialTransactionId.ToString(), connection);
+ "AND FinancialTransactionDependencies.FinancialTransactionId=" + financialTransactionId,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -1114,7 +1127,8 @@ namespace Swarmops.Database
{
// Set OUT parameters
- dependencyType = (FinancialDependencyType) Enum.Parse(typeof (FinancialDependencyType), reader.GetString(0));
+ dependencyType =
+ (FinancialDependencyType) Enum.Parse(typeof (FinancialDependencyType), reader.GetString(0));
foreignId = reader.GetInt32(1);
}
else
@@ -1126,14 +1140,13 @@ namespace Swarmops.Database
}
}
}
-
}
-
// TODO: Return BasicFinancialValidation object
- public void CreateFinancialValidation (FinancialValidationType validationType, FinancialDependencyType dependencyType, int foreignId,
+ public void CreateFinancialValidation(FinancialValidationType validationType,
+ FinancialDependencyType dependencyType, int foreignId,
DateTime validatedDateTime, int personId, double amount)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -1155,10 +1168,6 @@ namespace Swarmops.Database
}
-
-
-
-
// -- lines and trees and children --
@@ -1172,14 +1181,15 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT " + financialAccountFieldSequence + " WHERE ParentFinancialAccountId = " + parentFinancialAccountId.ToString() +
+ "SELECT " + financialAccountFieldSequence + " WHERE ParentFinancialAccountId = " +
+ parentFinancialAccountId +
" ORDER BY \"Name\"", connection);
using (DbDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
- result.Add(ReadFinancialAccountFromDataReader (reader));
+ result.Add(ReadFinancialAccountFromDataReader(reader));
}
return result.ToArray();
@@ -1259,7 +1269,7 @@ namespace Swarmops.Database
}
- public BasicFinancialAccount[] GetFinancialAccountTreeForOrganization (int organizationId)
+ public BasicFinancialAccount[] GetFinancialAccountTreeForOrganization(int organizationId)
{
Dictionary> nodes = GetHashedFinancialAccounts(organizationId);
@@ -1282,8 +1292,9 @@ namespace Swarmops.Database
}*/
- private BasicFinancialAccount[] GetFinancialAccountTree(Dictionary> financialAccounts, int startNodeId,
- int generation)
+ private BasicFinancialAccount[] GetFinancialAccountTree(
+ Dictionary> financialAccounts, int startNodeId,
+ int generation)
{
List result = new List();
@@ -1297,7 +1308,8 @@ namespace Swarmops.Database
// Add recursively
- BasicFinancialAccount[] children = GetFinancialAccountTree(financialAccounts, node.FinancialAccountId, generation + 1);
+ BasicFinancialAccount[] children = GetFinancialAccountTree(financialAccounts,
+ node.FinancialAccountId, generation + 1);
if (children.Length > 0)
{
@@ -1317,6 +1329,5 @@ namespace Swarmops.Database
return result.ToArray();
}
-
}
}
\ No newline at end of file
diff --git a/Database/Database-FlatData.cs b/Database/Database-FlatData.cs
index f71be63f..1e9b2d83 100644
--- a/Database/Database-FlatData.cs
+++ b/Database/Database-FlatData.cs
@@ -6,14 +6,15 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
- public string GetKeyValue (string key)
+ public string GetKeyValue(string key)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command =
- GetDbCommand("SELECT DataValue FROM FlatData WHERE DataKey='" + key.Replace("'", "''") + "'", connection);
+ GetDbCommand("SELECT DataValue FROM FlatData WHERE DataKey='" + key.Replace("'", "''") + "'",
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -28,7 +29,7 @@ namespace Swarmops.Database
}
- public void SetKeyValue (string key, string value)
+ public void SetKeyValue(string key, string value)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -45,7 +46,7 @@ namespace Swarmops.Database
}
- public Dictionary GetOldKeyValues()
+ public Dictionary GetOldKeyValues()
{
/*
Dictionary result = new Dictionary();
diff --git a/Database/Database-Geographies.cs b/Database/Database-Geographies.cs
index f6c682e9..179a7c4a 100644
--- a/Database/Database-Geographies.cs
+++ b/Database/Database-Geographies.cs
@@ -12,15 +12,15 @@ namespace Swarmops.Database
#region Field reading code
private const string geographyFieldSequence =
- " GeographyId, ParentGeographyId, Name " + // 0-2
+ " GeographyId, ParentGeographyId, Name " + // 0-2
" FROM Geographies ";
private const string geographyDesignationFieldSequence =
- " GeographyId, CountryId, Designation, GeographyLevelId " + // 0-3
+ " GeographyId, CountryId, Designation, GeographyLevelId " + // 0-3
" FROM GeographyDesignations ";
- private static BasicGeography ReadGeographyFromDataReader (DbDataReader reader)
+ private static BasicGeography ReadGeographyFromDataReader(DbDataReader reader)
{
int geographyId = reader.GetInt32(0);
int parentGeographyId = reader.GetInt32(1);
@@ -29,7 +29,7 @@ namespace Swarmops.Database
return new BasicGeography(geographyId, parentGeographyId, name);
}
- private static BasicGeographyDesignation ReadGeographyDesignationFromDataReader (DbDataReader reader)
+ private static BasicGeographyDesignation ReadGeographyDesignationFromDataReader(DbDataReader reader)
{
int geographyId = reader.GetInt32(0);
int countryId = reader.GetInt32(1);
@@ -39,12 +39,9 @@ namespace Swarmops.Database
return new BasicGeographyDesignation(geographyId, countryId, designation, level);
}
-
-
#endregion
-
- public BasicGeography[] GetAllGeographies ()
+ public BasicGeography[] GetAllGeographies()
{
List result = new List();
@@ -53,7 +50,9 @@ namespace Swarmops.Database
connection.Open();
DbCommand command =
- GetDbCommand("SELECT " + geographyFieldSequence + " WHERE ParentGeographyId >= 0 ORDER BY \"Name\"", connection);
+ GetDbCommand(
+ "SELECT " + geographyFieldSequence + " WHERE ParentGeographyId >= 0 ORDER BY \"Name\"",
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -68,7 +67,7 @@ namespace Swarmops.Database
}
- public BasicGeography[] GetGeographies (int[] ids)
+ public BasicGeography[] GetGeographies(int[] ids)
{
List result = new List();
@@ -78,7 +77,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT " + geographyFieldSequence + " WHERE ParentGeographyId >= 0 AND GeographyId in (" + JoinIds(ids) +
+ "SELECT " + geographyFieldSequence + " WHERE ParentGeographyId >= 0 AND GeographyId in (" +
+ JoinIds(ids) +
") ORDER BY \"Name\"", connection);
using (DbDataReader reader = command.ExecuteReader())
@@ -94,7 +94,7 @@ namespace Swarmops.Database
}
- public BasicGeography[] GetGeographyChildren (int parentGeographyId)
+ public BasicGeography[] GetGeographyChildren(int parentGeographyId)
{
List result = new List();
@@ -104,7 +104,7 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT " + geographyFieldSequence + " WHERE ParentGeographyId=" + parentGeographyId.ToString() +
+ "SELECT " + geographyFieldSequence + " WHERE ParentGeographyId=" + parentGeographyId +
" ORDER BY \"Name\"", connection);
using (DbDataReader reader = command.ExecuteReader())
@@ -120,7 +120,7 @@ namespace Swarmops.Database
}
- public Dictionary> GetHashedGeographies ()
+ public Dictionary> GetHashedGeographies()
{
// This generates a Dictionary >.
//
@@ -158,7 +158,7 @@ namespace Swarmops.Database
}
- public BasicGeography[] GetGeographyLine (int leafGeographyId)
+ public BasicGeography[] GetGeographyLine(int leafGeographyId)
{
List result = new List();
@@ -188,13 +188,13 @@ namespace Swarmops.Database
}
- public BasicGeography[] GetGeographyTree ()
+ public BasicGeography[] GetGeographyTree()
{
return GetGeographyTree(1);
}
- public BasicGeography[] GetGeographyTree (int startGeographyId)
+ public BasicGeography[] GetGeographyTree(int startGeographyId)
{
Dictionary> nodes = GetHashedGeographies();
@@ -202,7 +202,7 @@ namespace Swarmops.Database
}
- public Dictionary GetGeographyHashtable (int startGeographyId)
+ public Dictionary GetGeographyHashtable(int startGeographyId)
{
BasicGeography[] nodes = GetGeographyTree(startGeographyId);
@@ -217,8 +217,8 @@ namespace Swarmops.Database
}
- private BasicGeography[] GetGeographyTree (Dictionary> geographies, int startNodeId,
- int generation)
+ private BasicGeography[] GetGeographyTree(Dictionary> geographies, int startNodeId,
+ int generation)
{
List result = new List();
@@ -254,14 +254,14 @@ namespace Swarmops.Database
}
- public BasicGeography GetGeography (int geographyId)
+ public BasicGeography GetGeography(int geographyId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command = GetDbCommand(
- "SELECT " + geographyFieldSequence + " WHERE GeographyId=" + geographyId.ToString(), connection);
+ "SELECT " + geographyFieldSequence + " WHERE GeographyId=" + geographyId, connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -270,13 +270,13 @@ namespace Swarmops.Database
return ReadGeographyFromDataReader(reader);
}
- throw new ArgumentException("No such GeographyId: " + geographyId.ToString());
+ throw new ArgumentException("No such GeographyId: " + geographyId);
}
}
}
- public BasicGeography GetGeographyByName (string geographyName)
+ public BasicGeography GetGeographyByName(string geographyName)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -284,7 +284,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT " + geographyFieldSequence + " WHERE Name like '" + geographyName.Replace("'", "''") + "%'",
+ "SELECT " + geographyFieldSequence + " WHERE Name like '" + geographyName.Replace("'", "''") +
+ "%'",
connection);
using (DbDataReader reader = command.ExecuteReader())
@@ -300,7 +301,7 @@ namespace Swarmops.Database
}
- public void SetGeographyName (int geographyId, string name)
+ public void SetGeographyName(int geographyId, string name)
{
throw new NotImplementedException("Renaming geographies is not migrated to MySQL");
/*
@@ -318,7 +319,7 @@ namespace Swarmops.Database
}*/
}
- public Dictionary GetGeographyVoterCounts ()
+ public Dictionary GetGeographyVoterCounts()
{
throw new NotImplementedException("Not Migrated to MySQL");
/*
@@ -345,8 +346,8 @@ namespace Swarmops.Database
}*/
}
- public void CreateGeographyOfficialDesignation (int geographyId, GeographyLevel level, int countryId,
- string designation)
+ public void CreateGeographyOfficialDesignation(int geographyId, GeographyLevel level, int countryId,
+ string designation)
{
throw new NotImplementedException("Not Migrated to MySQL");
/*
@@ -366,7 +367,7 @@ namespace Swarmops.Database
}*/
}
- public int GetGeographyIdFromOfficialDesignation (int countryId, GeographyLevel level, string designation)
+ public int GetGeographyIdFromOfficialDesignation(int countryId, GeographyLevel level, string designation)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -374,8 +375,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "select GeographyId FROM GeographyDesignations WHERE CountryId=" + countryId.ToString() +
- " AND GeographyLevelId= " + ((int)level).ToString() + " AND Designation='" +
+ "select GeographyId FROM GeographyDesignations WHERE CountryId=" + countryId +
+ " AND GeographyLevelId= " + ((int) level) + " AND Designation='" +
designation.Replace("'", "''") + "'", connection);
using (DbDataReader reader = command.ExecuteReader())
@@ -384,15 +385,12 @@ namespace Swarmops.Database
{
return reader.GetInt32(0);
}
- else
- {
- throw new ArgumentException("No such designation: " + designation);
- }
+ throw new ArgumentException("No such designation: " + designation);
}
}
}
- public GeographyLevel[] GetGeographyLevelsAtGeographyId (int geographyId)
+ public GeographyLevel[] GetGeographyLevelsAtGeographyId(int geographyId)
{
List result = new List();
@@ -403,13 +401,13 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
"select GeographyLevelId FROM GeographyDesignations WHERE GeographyId=" +
- geographyId.ToString(), connection);
+ geographyId, connection);
using (DbDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
- result.Add((GeographyLevel)reader.GetInt32(0));
+ result.Add((GeographyLevel) reader.GetInt32(0));
}
}
}
@@ -417,7 +415,7 @@ namespace Swarmops.Database
return result.ToArray();
}
- public BasicGeographyDesignation[] GetGeographyDesignationsForGeographyId (int geographyId)
+ public BasicGeographyDesignation[] GetGeographyDesignationsForGeographyId(int geographyId)
{
List result = new List();
@@ -427,7 +425,7 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT " + geographyDesignationFieldSequence + " WHERE GeographyId=" + geographyId.ToString(), connection);
+ "SELECT " + geographyDesignationFieldSequence + " WHERE GeographyId=" + geographyId, connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -441,7 +439,7 @@ namespace Swarmops.Database
return result.ToArray();
}
- public int[] GetGeographyIdsFromLevel (int countryId, GeographyLevel level)
+ public int[] GetGeographyIdsFromLevel(int countryId, GeographyLevel level)
{
List result = new List();
@@ -452,7 +450,7 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
"select GeographyId FROM GeographyDesignations WHERE GeographyLevelId=" +
- ((int)level).ToString() + " AND CountryId=" + countryId.ToString(), connection);
+ ((int) level) + " AND CountryId=" + countryId, connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -466,7 +464,7 @@ namespace Swarmops.Database
return result.ToArray();
}
- public int CreateGeography (string name, int parentGeographyId)
+ public int CreateGeography(string name, int parentGeographyId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -481,7 +479,5 @@ namespace Swarmops.Database
return Convert.ToInt32(command.ExecuteScalar());
}
}
-
-
}
}
\ No newline at end of file
diff --git a/Database/Database-InboundInvoices.cs b/Database/Database-InboundInvoices.cs
index 8cc6793f..f60628ca 100644
--- a/Database/Database-InboundInvoices.cs
+++ b/Database/Database-InboundInvoices.cs
@@ -37,14 +37,12 @@ namespace Swarmops.Database
int closedByPersonId = reader.GetInt32(14);
return new BasicInboundInvoice(inboundInvoiceId, organizationId, createdDateTime, dueDate,
- amountCents, budgetId, supplier, payToAccount, ocr, invoiceReference,
- attested, open, closedDateTime, closedByPersonId);
+ amountCents, budgetId, supplier, payToAccount, ocr, invoiceReference,
+ attested, open, closedDateTime, closedByPersonId);
}
#endregion
-
-
#region Record reading - SELECT statements
public BasicInboundInvoice GetInboundInvoice(int inboundInvoiceId)
@@ -55,7 +53,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + inboundInvoiceFieldSequence + "WHERE InboundInvoiceId=" + inboundInvoiceId + ";", connection);
+ "SELECT" + inboundInvoiceFieldSequence + "WHERE InboundInvoiceId=" + inboundInvoiceId + ";",
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -71,11 +70,11 @@ namespace Swarmops.Database
///
- /// Gets a list of inbound invoices.
+ /// Gets a list of inbound invoices.
///
/// Optional Organization object and/or DatabaseConditions.
/// The inbound invoice list.
- public BasicInboundInvoice[] GetInboundInvoices (params object[] conditions)
+ public BasicInboundInvoice[] GetInboundInvoices(params object[] conditions)
{
List result = new List();
@@ -85,7 +84,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + inboundInvoiceFieldSequence + ConstructWhereClause("InboundInvoices", conditions) + " ORDER BY DueDate;", connection);
+ "SELECT" + inboundInvoiceFieldSequence + ConstructWhereClause("InboundInvoices", conditions) +
+ " ORDER BY DueDate;", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -99,14 +99,10 @@ namespace Swarmops.Database
}
}
-
#endregion
-
-
#region Creation and manipulation - stored procedures
-
/* -- UNUSED
public int CreateInboundInvoice(int organizationId, DateTime dueDate, int budgetId,
string supplier, string payToAccount, string ocr, string invoiceReference, double amount, int createdByPersonId)
@@ -134,7 +130,8 @@ namespace Swarmops.Database
}*/
- public int CreateInboundInvoice(int organizationId, DateTime dueDate, int budgetId, string supplier, string payToAccount, string ocr, string invoiceReference, Int64 amountCents, int createdByPersonId)
+ public int CreateInboundInvoice(int organizationId, DateTime dueDate, int budgetId, string supplier,
+ string payToAccount, string ocr, string invoiceReference, Int64 amountCents, int createdByPersonId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -193,7 +190,6 @@ namespace Swarmops.Database
}
-
public void SetInboundInvoiceAmount(int inboundInvoiceId, double amount)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -211,7 +207,6 @@ namespace Swarmops.Database
}
-
public void SetInboundInvoiceAmount(int inboundInvoiceId, Int64 amountCents)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -229,7 +224,6 @@ namespace Swarmops.Database
}
-
public void SetInboundInvoiceBudget(int inboundInvoiceId, int budgetId)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -247,7 +241,6 @@ namespace Swarmops.Database
}
-
public void SetInboundInvoiceDueDate(int inboundInvoiceId, DateTime dueDate)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -264,16 +257,10 @@ namespace Swarmops.Database
}
}
-
-
#endregion
-
-
-
#region Dead template code
-
/*
public int CreateFinancialAccount(int pOrganizationId, string pName, FinancialAccountType pAccountType, int pParentFinancialAccountId)
{
diff --git a/Database/Database-Initialization.cs b/Database/Database-Initialization.cs
index 77b1d3a6..aa9a3f27 100644
--- a/Database/Database-Initialization.cs
+++ b/Database/Database-Initialization.cs
@@ -23,7 +23,7 @@ namespace Swarmops.Database
}
}
- public int ExecuteAdminCommandScalar (string sqlSequence)
+ public int ExecuteAdminCommandScalar(string sqlSequence)
{
// TODO: Verify that we're in admin mode
@@ -44,6 +44,5 @@ namespace Swarmops.Database
return Convert.ToInt32(result);
}
}
-
}
}
\ No newline at end of file
diff --git a/Database/Database-InternalPollCandidates.cs b/Database/Database-InternalPollCandidates.cs
index 274c1bd0..996a4963 100644
--- a/Database/Database-InternalPollCandidates.cs
+++ b/Database/Database-InternalPollCandidates.cs
@@ -11,7 +11,7 @@ namespace Swarmops.Database
#region Field reading code
private const string internalPollCandidateFieldSequence =
- " InternalPollCandidateId,InternalPollId,PersonId,CandidacyStatement " + // 0-3
+ " InternalPollCandidateId,InternalPollId,PersonId,CandidacyStatement " + // 0-3
"FROM InternalPollCandidates ";
private static BasicInternalPollCandidate ReadInternalPollCandidateFromDataReader(IDataRecord reader)
@@ -26,8 +26,6 @@ namespace Swarmops.Database
#endregion
-
-
#region Record reading - SELECT statements
public BasicInternalPollCandidate GetInternalPollCandidate(int internalPollCandidateId)
@@ -38,7 +36,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + internalPollCandidateFieldSequence + "WHERE InternalPollCandidateId=" + internalPollCandidateId + ";", connection);
+ "SELECT" + internalPollCandidateFieldSequence + "WHERE InternalPollCandidateId=" +
+ internalPollCandidateId + ";", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -47,15 +46,18 @@ namespace Swarmops.Database
return ReadInternalPollCandidateFromDataReader(reader);
}
- throw new ArgumentException("Unknown Id: " + internalPollCandidateId.ToString());
+ throw new ArgumentException("Unknown Id: " + internalPollCandidateId);
}
}
}
///
- /// Gets salaries from the database.
+ /// Gets salaries from the database.
///
- /// An optional combination of a Person and/or Organization object and/or DatabaseCondition specifiers.
+ ///
+ /// An optional combination of a Person and/or Organization object and/or DatabaseCondition
+ /// specifiers.
+ ///
/// A list of matching salaries.
public BasicInternalPollCandidate[] GetInternalPollCandidates(params object[] conditions)
{
@@ -67,7 +69,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + internalPollCandidateFieldSequence + ConstructWhereClause("InternalPollCandidates", conditions) + " ORDER BY SortOrder", connection);
+ "SELECT" + internalPollCandidateFieldSequence +
+ ConstructWhereClause("InternalPollCandidates", conditions) + " ORDER BY SortOrder", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -81,11 +84,8 @@ namespace Swarmops.Database
}
}
-
#endregion
-
-
#region Creation and manipulation - stored procedures
public int CreateInternalPollCandidate(int internalPollId, int personId, string candidacyStatement)
@@ -137,8 +137,6 @@ namespace Swarmops.Database
}
}
-
#endregion
-
}
}
\ No newline at end of file
diff --git a/Database/Database-InternalPollVotes.cs b/Database/Database-InternalPollVotes.cs
index 9f5d3573..2b46436e 100644
--- a/Database/Database-InternalPollVotes.cs
+++ b/Database/Database-InternalPollVotes.cs
@@ -11,9 +11,13 @@ namespace Swarmops.Database
#region Field reading code
private const string internalPollVoteFieldSequence =
- " InternalPollVoteId,InternalPollId,VerificationCode " + // 0-3
+ " InternalPollVoteId,InternalPollId,VerificationCode " + // 0-3
"FROM InternalPollVotes ";
+ private const string internalPollVoterFieldSequence =
+ " PersonId,InternalPollId,Open,ClosedDateTime " + // 0-3
+ "FROM InternalPollVoters ";
+
private static BasicInternalPollVote ReadInternalPollVoteFromDataReader(IDataRecord reader)
{
int internalPollVoteId = reader.GetInt32(0);
@@ -23,10 +27,6 @@ namespace Swarmops.Database
return new BasicInternalPollVote(internalPollVoteId, internalPollId, verificationCode);
}
- private const string internalPollVoterFieldSequence =
- " PersonId,InternalPollId,Open,ClosedDateTime " + // 0-3
- "FROM InternalPollVoters ";
-
private static BasicInternalPollVoter ReadInternalPollVoterFromDataReader(IDataRecord reader)
{
int personId = reader.GetInt32(0);
@@ -39,8 +39,6 @@ namespace Swarmops.Database
#endregion
-
-
#region Record reading - SELECT statements
public BasicInternalPollVote GetInternalPollVote(int internalPollVoteId)
@@ -51,7 +49,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + internalPollVoteFieldSequence + "WHERE InternalPollVoteId=" + internalPollVoteId + ";", connection);
+ "SELECT" + internalPollVoteFieldSequence + "WHERE InternalPollVoteId=" + internalPollVoteId +
+ ";", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -60,13 +59,13 @@ namespace Swarmops.Database
return ReadInternalPollVoteFromDataReader(reader);
}
- throw new ArgumentException("Unknown Id: " + internalPollVoteId.ToString());
+ throw new ArgumentException("Unknown Id: " + internalPollVoteId);
}
}
}
- public BasicInternalPollVote GetInternalPollVote (string verificationCode)
+ public BasicInternalPollVote GetInternalPollVote(string verificationCode)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -74,7 +73,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + internalPollVoteFieldSequence + "WHERE VerificationCode='" + verificationCode.Replace("'", "''") + "';", connection);
+ "SELECT" + internalPollVoteFieldSequence + "WHERE VerificationCode='" +
+ verificationCode.Replace("'", "''") + "';", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -83,7 +83,7 @@ namespace Swarmops.Database
return ReadInternalPollVoteFromDataReader(reader);
}
- throw new ArgumentException("Unknown Verification Code: " + verificationCode.ToString());
+ throw new ArgumentException("Unknown Verification Code: " + verificationCode);
}
}
}
@@ -99,7 +99,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + internalPollVoteFieldSequence + ConstructWhereClause("InternalPollVotes", conditions) + " ORDER BY VerificationCode", connection);
+ "SELECT" + internalPollVoteFieldSequence + ConstructWhereClause("InternalPollVotes", conditions) +
+ " ORDER BY VerificationCode", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -114,7 +115,7 @@ namespace Swarmops.Database
}
- public InternalPollVoterStatus GetInternalPollVoterStatus (int internalPollId, int personId)
+ public InternalPollVoterStatus GetInternalPollVoterStatus(int internalPollId, int personId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -122,13 +123,16 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT Open FROM InternalPollVoters WHERE InternalPollId=" + internalPollId.ToString() + " AND PersonId=" + personId.ToString(), connection);
+ "SELECT Open FROM InternalPollVoters WHERE InternalPollId=" + internalPollId + " AND PersonId=" +
+ personId, connection);
using (DbDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
- return reader.GetBoolean(0)? InternalPollVoterStatus.CanVote : InternalPollVoterStatus.HasAlreadyVoted;
+ return reader.GetBoolean(0)
+ ? InternalPollVoterStatus.CanVote
+ : InternalPollVoterStatus.HasAlreadyVoted;
}
return InternalPollVoterStatus.NotEligibleForPoll;
@@ -137,7 +141,7 @@ namespace Swarmops.Database
}
- public int[] GetInternalPollVoteDetails (int internalPollVoteId)
+ public int[] GetInternalPollVoteDetails(int internalPollVoteId)
{
List result = new List();
@@ -147,8 +151,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT InternalPollCandidateId FROM InternalPollVoteDetails WHERE InternalPollVoteId=" +
- internalPollVoteId.ToString() + " ORDER BY Position", connection);
+ "SELECT InternalPollCandidateId FROM InternalPollVoteDetails WHERE InternalPollVoteId=" +
+ internalPollVoteId + " ORDER BY Position", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -163,7 +167,7 @@ namespace Swarmops.Database
}
- public BasicInternalPollVoter[] GetInternalPollVoters (params object[] conditions)
+ public BasicInternalPollVoter[] GetInternalPollVoters(params object[] conditions)
{
List result = new List();
@@ -172,7 +176,8 @@ namespace Swarmops.Database
connection.Open();
DbCommand command = GetDbCommand(
- "SELECT" + internalPollVoterFieldSequence + ConstructWhereClause("InternalPollVoters", conditions), connection);
+ "SELECT" + internalPollVoterFieldSequence + ConstructWhereClause("InternalPollVoters", conditions),
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -184,11 +189,10 @@ namespace Swarmops.Database
return result.ToArray();
}
}
-
}
- public Dictionary GetCandidateIdPersonIdMap (int pollId)
+ public Dictionary GetCandidateIdPersonIdMap(int pollId)
{
Dictionary result = new Dictionary();
@@ -198,7 +202,7 @@ namespace Swarmops.Database
DbCommand command = GetDbCommand(
"SELECT InternalPollCandidateId,PersonId FROM InternalPollCandidates WHERE InternalPollId=" +
- pollId.ToString(), connection);
+ pollId, connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -212,11 +216,8 @@ namespace Swarmops.Database
}
}
-
#endregion
-
-
#region Creation and manipulation - stored procedures
public int CreateInternalPollVote(int internalPollId, int voteGeographyId, string verificationCode)
@@ -255,7 +256,6 @@ namespace Swarmops.Database
}
-
public void ClearInternalPollVote(int internalPollVoteId)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -272,8 +272,6 @@ namespace Swarmops.Database
}
-
-
public int CreateInternalPollVoter(int internalPollId, int personId)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -309,9 +307,6 @@ namespace Swarmops.Database
}
}
-
-
#endregion
-
}
}
\ No newline at end of file
diff --git a/Database/Database-InternalPolls.cs b/Database/Database-InternalPolls.cs
index 6e345e6a..da803b9c 100644
--- a/Database/Database-InternalPolls.cs
+++ b/Database/Database-InternalPolls.cs
@@ -34,17 +34,16 @@ namespace Swarmops.Database
InternalPollResultsType resultsType = (InternalPollResultsType) resultsTypeId;
- return new BasicInternalPoll(internalPollId, createdByPersonId, organizationId, geographyId, name, runningOpen, votingOpen, maxVoteLength, runningOpens, runningCloses, votingOpens, votingCloses, resultsType);
+ return new BasicInternalPoll(internalPollId, createdByPersonId, organizationId, geographyId, name,
+ runningOpen, votingOpen, maxVoteLength, runningOpens, runningCloses, votingOpens, votingCloses,
+ resultsType);
}
#endregion
-
-
-
#region Record reading - SELECT statements
- public BasicInternalPoll GetInternalPoll (int internalPollId)
+ public BasicInternalPoll GetInternalPoll(int internalPollId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -52,7 +51,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + internalPollFieldSequence + "WHERE InternalPollId=" + internalPollId + ";", connection);
+ "SELECT" + internalPollFieldSequence + "WHERE InternalPollId=" + internalPollId + ";",
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -61,14 +61,14 @@ namespace Swarmops.Database
return ReadInternalPollFromDataReader(reader);
}
- throw new ArgumentException("Unknown InternalPollId: " + internalPollId.ToString());
+ throw new ArgumentException("Unknown InternalPollId: " + internalPollId);
}
}
}
///
- /// Gets a list of internal polls.
+ /// Gets a list of internal polls.
///
/// Optional Organization object and/or DatabaseConditions.
/// The inbound invoice list.
@@ -82,7 +82,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT " + internalPollFieldSequence + ConstructWhereClause("InternalPoll", conditions), connection);
+ "SELECT " + internalPollFieldSequence + ConstructWhereClause("InternalPoll", conditions),
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -96,18 +97,14 @@ namespace Swarmops.Database
}
}
-
#endregion
-
-
-
#region Creation and manipulation - stored procedures
public int CreateInternalPoll(int organizationId, int geographyId, string name, int maxVoteLength,
- InternalPollResultsType resultsType, int createdByPersonId,
- DateTime runningOpens, DateTime runningCloses, DateTime votingOpens,
- DateTime votingCloses)
+ InternalPollResultsType resultsType, int createdByPersonId,
+ DateTime runningOpens, DateTime runningCloses, DateTime votingOpens,
+ DateTime votingCloses)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -165,6 +162,5 @@ namespace Swarmops.Database
}
#endregion
-
}
}
\ No newline at end of file
diff --git a/Database/Database-MailTemplates.cs b/Database/Database-MailTemplates.cs
index 9777399e..61c249e6 100644
--- a/Database/Database-MailTemplates.cs
+++ b/Database/Database-MailTemplates.cs
@@ -8,7 +8,7 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
- public BasicMailTemplate[] GetMailTemplatesByName (string templatename)
+ public BasicMailTemplate[] GetMailTemplatesByName(string templatename)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -32,15 +32,12 @@ namespace Swarmops.Database
}
return retlist.ToArray();
}
- else
- {
- throw new ArgumentException("No mailtemplate named: " + templatename + " exists.");
- }
+ throw new ArgumentException("No mailtemplate named: " + templatename + " exists.");
}
}
}
- public BasicMailTemplate GetMailTemplateById (int templateId)
+ public BasicMailTemplate GetMailTemplateById(int templateId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -48,7 +45,7 @@ namespace Swarmops.Database
string sql = "SELECT * from MailTemplates where TemplateId={0}";
- sql = string.Format(sql, templateId.ToString());
+ sql = string.Format(sql, templateId);
DbCommand command = GetDbCommand(sql, connection);
@@ -58,18 +55,19 @@ namespace Swarmops.Database
{
return ReadMailTemplate(reader);
}
- throw new ArgumentException("No mailtemplate with id: " + templateId.ToString() + " exists.");
+ throw new ArgumentException("No mailtemplate with id: " + templateId + " exists.");
}
}
}
- public BasicMailTemplate[] GetAllMailTemplates ()
+ public BasicMailTemplate[] GetAllMailTemplates()
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
- string sql = "SELECT * from MailTemplates order by templateName, CountryCode, LanguageCode, OrganizationId";
+ string sql =
+ "SELECT * from MailTemplates order by templateName, CountryCode, LanguageCode, OrganizationId";
DbCommand command = GetDbCommand(sql, connection);
@@ -85,23 +83,23 @@ namespace Swarmops.Database
}
}
- private static BasicMailTemplate ReadMailTemplate (DbDataReader reader)
+ private static BasicMailTemplate ReadMailTemplate(DbDataReader reader)
{
- int templateId = (int)reader["templateId"];
- string templateName = reader["templateName"] != DBNull.Value ? (string)reader["templateName"] : "";
- string langCode = reader["languageCode"] != DBNull.Value ? (string)reader["languageCode"] : "";
- string crtyCode = reader["countryCode"] != DBNull.Value ? (string)reader["countryCode"] : "";
- int orgId = reader["organizationId"] != DBNull.Value ? (int)reader["organizationId"] : 0;
- string templateBody = reader["templateBody"] != DBNull.Value ? (string)reader["templateBody"] : "";
+ int templateId = (int) reader["templateId"];
+ string templateName = reader["templateName"] != DBNull.Value ? (string) reader["templateName"] : "";
+ string langCode = reader["languageCode"] != DBNull.Value ? (string) reader["languageCode"] : "";
+ string crtyCode = reader["countryCode"] != DBNull.Value ? (string) reader["countryCode"] : "";
+ int orgId = reader["organizationId"] != DBNull.Value ? (int) reader["organizationId"] : 0;
+ string templateBody = reader["templateBody"] != DBNull.Value ? (string) reader["templateBody"] : "";
return new BasicMailTemplate(templateId, templateName, langCode, crtyCode, orgId, templateBody);
}
- public int SetMailTemplate (int templateId,
- string templateName,
- string languageCode,
- string countryCode,
- int organizationId,
- string templateBody)
+ public int SetMailTemplate(int templateId,
+ string templateName,
+ string languageCode,
+ string countryCode,
+ int organizationId,
+ string templateBody)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -122,14 +120,14 @@ namespace Swarmops.Database
}
- public int SetMailTemplate (BasicMailTemplate mailTemplate)
+ public int SetMailTemplate(BasicMailTemplate mailTemplate)
{
return SetMailTemplate(mailTemplate.TemplateId,
- mailTemplate.TemplateName,
- mailTemplate.LanguageCode,
- mailTemplate.CountryCode,
- mailTemplate.OrganizationId,
- mailTemplate.TemplateBody);
+ mailTemplate.TemplateName,
+ mailTemplate.LanguageCode,
+ mailTemplate.CountryCode,
+ mailTemplate.OrganizationId,
+ mailTemplate.TemplateBody);
}
}
}
\ No newline at end of file
diff --git a/Database/Database-Media.cs b/Database/Database-Media.cs
index 1b5f710b..ac6c9054 100644
--- a/Database/Database-Media.cs
+++ b/Database/Database-Media.cs
@@ -9,8 +9,8 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
- public int CreateMediaEntryFromKeyword (string keyword, string mediaName, bool isBlog, string url, string title,
- DateTime dateTime)
+ public int CreateMediaEntryFromKeyword(string keyword, string mediaName, bool isBlog, string url, string title,
+ DateTime dateTime)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -39,7 +39,7 @@ namespace Swarmops.Database
}
- public BasicMediaEntry[] GetBlogEntriesForKeyword (string keyword, DateTime minAge) // NOT ok
+ public BasicMediaEntry[] GetBlogEntriesForKeyword(string keyword, DateTime minAge) // NOT ok
{
throw new NotImplementedException("Not yet migrated to MySQL: GetBlogEntriesForKeyword");
/*
@@ -49,7 +49,7 @@ namespace Swarmops.Database
"' AND IsBlog %ISTRUE% ORDER BY MediaEntryDateTime DESC");*/
}
- public BasicMediaEntry[] GetOldMediaEntriesForKeyword (string keyword, DateTime minAge) // NOT ok
+ public BasicMediaEntry[] GetOldMediaEntriesForKeyword(string keyword, DateTime minAge) // NOT ok
{
throw new NotImplementedException("Not yet migrated to MySQL: GetOldMediaEntriesForKeyword");
@@ -60,7 +60,7 @@ namespace Swarmops.Database
"' AND IsBlog %ISFALSE% ORDER BY MediaEntryDateTime DESC");*/
}
- private BasicMediaEntry[] ExecuteMediaDbQuery (string commandString)
+ private BasicMediaEntry[] ExecuteMediaDbQuery(string commandString)
{
List result = new List();
@@ -83,7 +83,7 @@ namespace Swarmops.Database
}
- public BasicMediaEntry[] GetMediaEntriesForKeywordIdsSimplified (int[] keywordIds) // migrated RF 2010-May-07
+ public BasicMediaEntry[] GetMediaEntriesForKeywordIdsSimplified(int[] keywordIds) // migrated RF 2010-May-07
{
List result = new List();
@@ -100,7 +100,8 @@ namespace Swarmops.Database
{
while (reader.Read())
{
- result.Add(new BasicMediaEntry(reader.GetInt32(0), reader.GetInt32(1), reader.GetInt32(2).ToString(), false, "N/A", "N/A", reader.GetDateTime(3)));
+ result.Add(new BasicMediaEntry(reader.GetInt32(0), reader.GetInt32(1),
+ reader.GetInt32(2).ToString(), false, "N/A", "N/A", reader.GetDateTime(3)));
}
}
}
@@ -109,21 +110,22 @@ namespace Swarmops.Database
}
- private BasicMediaEntry ReadMediaEntryFromReader (DbDataReader reader) // NOT ok -- will need to migrate; any dependencies also won't work
+ private BasicMediaEntry ReadMediaEntryFromReader(DbDataReader reader)
+ // NOT ok -- will need to migrate; any dependencies also won't work
{
- int id = (int)reader["MediaKeywordEntryId"];
- int keywordId = (int)reader["MediaKeywordId"];
- string mediaName = (string)reader["MediaName"];
- bool isBlog = (bool)reader["IsBlog"];
- string mediaEntryTitle = (string)reader["MediaEntryTitle"];
- string mediaEntryUrl = (string)reader["MediaEntryUrl"];
- DateTime mediaEntryDateTime = (DateTime)reader["MediaEntryDateTime"];
+ int id = (int) reader["MediaKeywordEntryId"];
+ int keywordId = (int) reader["MediaKeywordId"];
+ string mediaName = (string) reader["MediaName"];
+ bool isBlog = (bool) reader["IsBlog"];
+ string mediaEntryTitle = (string) reader["MediaEntryTitle"];
+ string mediaEntryUrl = (string) reader["MediaEntryUrl"];
+ DateTime mediaEntryDateTime = (DateTime) reader["MediaEntryDateTime"];
object translatedUrlObject = reader["TranslatedUrl"];
- if (!(translatedUrlObject is System.DBNull))
+ if (!(translatedUrlObject is DBNull))
{
- string translatedUrl = (string)translatedUrlObject;
+ string translatedUrl = (string) translatedUrlObject;
if (translatedUrl != null && translatedUrl.Trim().Length > 0)
{
@@ -132,11 +134,11 @@ namespace Swarmops.Database
}
return new BasicMediaEntry(id, keywordId, mediaName, isBlog, mediaEntryTitle, mediaEntryUrl,
- mediaEntryDateTime);
+ mediaEntryDateTime);
}
- public string[] GetBlogKeywords () // OK
+ public string[] GetBlogKeywords() // OK
{
List result = new List();
@@ -145,7 +147,7 @@ namespace Swarmops.Database
connection.Open();
DbCommand command = GetDbCommand("SELECT MediaKeyword From MediaKeywords WHERE SearchBlogs=1",
- connection);
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -158,7 +160,7 @@ namespace Swarmops.Database
return result.ToArray();
}
- public string[] GetOldMediaKeywords () // OK
+ public string[] GetOldMediaKeywords() // OK
{
List result = new List();
@@ -167,7 +169,7 @@ namespace Swarmops.Database
connection.Open();
DbCommand command = GetDbCommand("SELECT MediaKeyword From MediaKeywords WHERE SearchOldMedia=1",
- connection);
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -181,7 +183,7 @@ namespace Swarmops.Database
}
- public Dictionary GetMediaTypeTable () // OK Todo: create enum instead of bool
+ public Dictionary GetMediaTypeTable() // OK Todo: create enum instead of bool
{
Dictionary result = new Dictionary();
@@ -202,7 +204,7 @@ namespace Swarmops.Database
return result;
}
- public int GetMediaKeywordId (string keyword) // OK
+ public int GetMediaKeywordId(string keyword) // OK
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -219,16 +221,13 @@ namespace Swarmops.Database
{
return reader.GetInt32(0);
}
- else
- {
- return 0;
- }
+ return 0;
}
}
}
- public Dictionary GetMediaKeywordTable () // OK
+ public Dictionary GetMediaKeywordTable() // OK
{
Dictionary result = new Dictionary();
@@ -250,7 +249,7 @@ namespace Swarmops.Database
}
- public BasicMediaCategory GetMediaCategory (int mediaCategoryId) // OK
+ public BasicMediaCategory GetMediaCategory(int mediaCategoryId) // OK
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -258,7 +257,7 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT Name FROM MediaCategories WHERE MediaCategoryId=" + mediaCategoryId.ToString(),
+ "SELECT Name FROM MediaCategories WHERE MediaCategoryId=" + mediaCategoryId,
connection);
using (DbDataReader reader = command.ExecuteReader())
@@ -268,13 +267,13 @@ namespace Swarmops.Database
return new BasicMediaCategory(mediaCategoryId, reader.GetString(0));
}
- throw new ArgumentException("No such MediaCategoryId: " + mediaCategoryId.ToString());
+ throw new ArgumentException("No such MediaCategoryId: " + mediaCategoryId);
}
}
}
- public BasicMediaCategory GetMediaCategoryByName (string mediaCategoryName) // OK
+ public BasicMediaCategory GetMediaCategoryByName(string mediaCategoryName) // OK
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -298,7 +297,7 @@ namespace Swarmops.Database
}
- public BasicMediaCategory[] GetMediaCategories (int[] mediaCategoryIds)
+ public BasicMediaCategory[] GetMediaCategories(int[] mediaCategoryIds)
{
List result = new List();
@@ -324,7 +323,7 @@ namespace Swarmops.Database
}
- public BasicMediaCategory[] GetMediaCategories ()
+ public BasicMediaCategory[] GetMediaCategories()
{
List result = new List();
@@ -349,7 +348,7 @@ namespace Swarmops.Database
}
- public BasicMedium[] GetBlogTopList (DateTime date) // OK - migrated
+ public BasicMedium[] GetBlogTopList(DateTime date) // OK - migrated
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -379,7 +378,7 @@ namespace Swarmops.Database
command =
GetDbCommand(
"select BlogRankings.MediaId,Media.Name from BlogRankings JOIN Media USING (MediaId) WHERE BlogRankings.BlogRankingDateId=" +
- dateId.ToString() + " ORDER BY Ranking", connection);
+ dateId + " ORDER BY Ranking", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -397,7 +396,7 @@ namespace Swarmops.Database
}
}
- public void StoreBlogTopList (DateTime date, string[] rankedBlogNames) // OK - migrated
+ public void StoreBlogTopList(DateTime date, string[] rankedBlogNames) // OK - migrated
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -425,7 +424,7 @@ namespace Swarmops.Database
}
- private string LimitStringLength (string input, int maxLength)
+ private string LimitStringLength(string input, int maxLength)
{
if (input.Length > maxLength)
{
diff --git a/Database/Database-Meetings.cs b/Database/Database-Meetings.cs
index 73817e65..35f3b112 100644
--- a/Database/Database-Meetings.cs
+++ b/Database/Database-Meetings.cs
@@ -11,8 +11,8 @@ namespace Swarmops.Database
#region Field reading code
private const string meetingFieldSequence =
- " MeetingId,OrganizationId,Name,MotionSubmissionEnds,AmendmentSubmissionEnds," + // 0-4
- "AmendmentVotingStarts,AmendmentVotingEnds,MotionVotingStarts,MotionVotingEnds " + // 5-8
+ " MeetingId,OrganizationId,Name,MotionSubmissionEnds,AmendmentSubmissionEnds," + // 0-4
+ "AmendmentVotingStarts,AmendmentVotingEnds,MotionVotingStarts,MotionVotingEnds " + // 5-8
"FROM Meetings ";
private static BasicMeeting ReadMeetingFromDataReader(IDataRecord reader)
@@ -28,13 +28,11 @@ namespace Swarmops.Database
DateTime motionVotingEnds = reader.GetDateTime(8);
return new BasicMeeting(meetingId, organizationId, name, motionSubmissionEnds, amendmentSubmissionEnds,
- amendmentVotingStarts, amendmentVotingEnds, motionVotingStarts, motionVotingEnds);
+ amendmentVotingStarts, amendmentVotingEnds, motionVotingStarts, motionVotingEnds);
}
#endregion
-
-
#region Record reading - SELECT statements
public BasicMeeting GetMeeting(int meetingId)
@@ -54,7 +52,7 @@ namespace Swarmops.Database
return ReadMeetingFromDataReader(reader);
}
- throw new ArgumentException("Unknown Meeting Id: " + meetingId.ToString());
+ throw new ArgumentException("Unknown Meeting Id: " + meetingId);
}
}
}
@@ -83,11 +81,8 @@ namespace Swarmops.Database
}
}
-
#endregion
-
-
#region Creation and manipulation - stored procedures
/*
@@ -192,8 +187,6 @@ namespace Swarmops.Database
}
*/
-
#endregion
-
}
}
\ No newline at end of file
diff --git a/Database/Database-Memberships.cs b/Database/Database-Memberships.cs
index fec03f15..82fc0dbc 100644
--- a/Database/Database-Memberships.cs
+++ b/Database/Database-Memberships.cs
@@ -29,7 +29,17 @@ namespace Swarmops.Database
}
}*/
- public int[] GetMembersForOrganizations (int[] organizationIds)
+ private const string membershipFieldSequence =
+ " Memberships.MembershipId, Memberships.PersonId, Memberships.OrganizationId, Memberships.Active, Memberships.Expires, " +
+ // 0-4
+ " Memberships.MemberSince, Memberships.DateTimeTerminated, Memberships.TerminatedAsInvalid " + // 5-7
+ " FROM Memberships ";
+
+ private const string membershipPaymentStatusFieldSequence =
+ " MembershipPayments.MembershipId, MembershipPayments.MembershipPaymentStatusId, MembershipPayments.StatusDateTime " +
+ " FROM MembershipPayments ";
+
+ public int[] GetMembersForOrganizations(int[] organizationIds)
{
if (organizationIds == null || organizationIds.Length == 0)
{
@@ -53,7 +63,7 @@ namespace Swarmops.Database
}
- public int[] GetMembersForOrganizationsAndGeographies (int[] organizationIds, int[] geographyIds)
+ public int[] GetMembersForOrganizationsAndGeographies(int[] organizationIds, int[] geographyIds)
{
if (organizationIds == null || organizationIds.Length == 0)
{
@@ -83,7 +93,7 @@ namespace Swarmops.Database
}
- public BasicMembership[] GetMemberships (params object[] conditions)
+ public BasicMembership[] GetMemberships(params object[] conditions)
{
List result = new List();
@@ -91,7 +101,9 @@ namespace Swarmops.Database
{
connection.Open();
- DbCommand command = GetDbCommand("SELECT " + membershipFieldSequence + ConstructWhereClause("Memberships", conditions), connection);
+ DbCommand command =
+ GetDbCommand("SELECT " + membershipFieldSequence + ConstructWhereClause("Memberships", conditions),
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -103,15 +115,15 @@ namespace Swarmops.Database
return result.ToArray();
}
}
-
}
- public BasicMembership[] GetValidMembershipsForOrganizationAndPaymentStatus (int[] organizationIds, int paymentStatus)
+ public BasicMembership[] GetValidMembershipsForOrganizationAndPaymentStatus(int[] organizationIds,
+ int paymentStatus)
{
string sqlCommand =
- @"SELECT " + membershipFieldSequence +
- @" LEFT OUTER JOIN
+ @"SELECT " + membershipFieldSequence +
+ @" LEFT OUTER JOIN
MembershipPayments ON Memberships.MembershipId = MembershipPayments.MembershipId
WHERE (Memberships.Active = 1)
AND (coalesce(MembershipPayments.MembershipPaymentStatusId, 0) = " + paymentStatus + @")
@@ -140,9 +152,7 @@ namespace Swarmops.Database
}
-
-
- public int GetMembershipCountForOrganizations (int[] organizationIds)
+ public int GetMembershipCountForOrganizations(int[] organizationIds)
{
if (organizationIds == null || organizationIds.Length == 0)
{
@@ -162,7 +172,7 @@ namespace Swarmops.Database
}
}
- public int GetMembershipCountForOrganizationsSince (int[] organizationIds, DateTime sinceWhen)
+ public int GetMembershipCountForOrganizationsSince(int[] organizationIds, DateTime sinceWhen)
{
if (organizationIds == null || organizationIds.Length == 0)
{
@@ -183,7 +193,7 @@ namespace Swarmops.Database
}
}
- public int GetMemberCountForOrganizations (int[] organizationIds)
+ public int GetMemberCountForOrganizations(int[] organizationIds)
{
if (organizationIds == null || organizationIds.Length == 0)
{
@@ -203,7 +213,7 @@ namespace Swarmops.Database
}
}
- public int GetMemberCountForOrganizationsAndGeographies (int[] organizationIds, int[] geographyIds)
+ public int GetMemberCountForOrganizationsAndGeographies(int[] organizationIds, int[] geographyIds)
{
if (organizationIds == null || organizationIds.Length == 0)
{
@@ -230,7 +240,7 @@ namespace Swarmops.Database
}
- private static int[] ReadIntegersAtZeroFromDataReader (DbDataReader reader)
+ private static int[] ReadIntegersAtZeroFromDataReader(DbDataReader reader)
{
List result = new List();
@@ -243,13 +253,13 @@ namespace Swarmops.Database
}
- public Dictionary> GetMembershipsForPeople (int[] personIds)
+ public Dictionary> GetMembershipsForPeople(int[] personIds)
{
return GetMembershipsForPeople(personIds, 0);
}
- public Dictionary> GetMembershipsForPeople (int[] personIds, int gracePeriod)
+ public Dictionary> GetMembershipsForPeople(int[] personIds, int gracePeriod)
{
Dictionary> result = new Dictionary>();
@@ -271,9 +281,11 @@ namespace Swarmops.Database
connection.Open();
string commandString = "SELECT " + membershipFieldSequence + " WHERE "
- + (gracePeriod == 0 ? "Active=1"
- : " (Expires > DATE_ADD(NOW(),INTERVAL -" + gracePeriod + " Day) AND (Expires < DATE_ADD(DateTimeTerminated,INTERVAL 1 Day) OR Active=1))")
- + " AND PersonId in (" + JoinIds(personIds) + ")";
+ + (gracePeriod == 0
+ ? "Active=1"
+ : " (Expires > DATE_ADD(NOW(),INTERVAL -" + gracePeriod +
+ " Day) AND (Expires < DATE_ADD(DateTimeTerminated,INTERVAL 1 Day) OR Active=1))")
+ + " AND PersonId in (" + JoinIds(personIds) + ")";
DbCommand command = GetDbCommand(commandString, connection);
command.CommandTimeout = 30; // If 30s is too short, something needs optimization.
@@ -299,7 +311,8 @@ namespace Swarmops.Database
return result;
}
- private Dictionary> GetMembershipsForPeopleOptimizedForLargeSets (int[] personIds, int gracePeriod)
+ private Dictionary> GetMembershipsForPeopleOptimizedForLargeSets(int[] personIds,
+ int gracePeriod)
{
// This version is optimized for larger data sets. Rather than asking the database
// for the correct set of people, ALL memberships are retrieved, and the filtering is
@@ -337,7 +350,8 @@ namespace Swarmops.Database
else if (gracePeriod != 0)
{
//Within graceperiod?
- if (membership.Expires.AddDays(gracePeriod) > DateTime.Now && membership.DateTerminated.AddDays(1) > membership.Expires)
+ if (membership.Expires.AddDays(gracePeriod) > DateTime.Now &&
+ membership.DateTerminated.AddDays(1) > membership.Expires)
{
if (personIdLookup.ContainsKey(membership.PersonId))
{
@@ -353,13 +367,11 @@ namespace Swarmops.Database
}
-
return result;
}
-
- public BasicMembership GetActiveMembership (int personId, int organizationId)
+ public BasicMembership GetActiveMembership(int personId, int organizationId)
{
if (personId == 0)
{
@@ -379,8 +391,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT " + membershipFieldSequence + " WHERE Active=1 AND PersonId=" + personId.ToString() +
- " AND OrganizationId=" + organizationId.ToString(), connection);
+ "SELECT " + membershipFieldSequence + " WHERE Active=1 AND PersonId=" + personId +
+ " AND OrganizationId=" + organizationId, connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -389,14 +401,14 @@ namespace Swarmops.Database
return ReadMembershipFromDataReader(reader);
}
- throw new ArgumentException("No active membership for personid " + personId.ToString() +
- ", organizationid " + organizationId.ToString());
+ throw new ArgumentException("No active membership for personid " + personId +
+ ", organizationid " + organizationId);
}
}
}
- public bool IsPersonMember (int personId, int organizationId)
+ public bool IsPersonMember(int personId, int organizationId)
{
try
{
@@ -410,14 +422,14 @@ namespace Swarmops.Database
}
- public BasicMembership GetMembership (int membershipId)
+ public BasicMembership GetMembership(int membershipId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command =
- GetDbCommand("SELECT " + membershipFieldSequence + " WHERE MembershipId=" + membershipId.ToString(), connection);
+ GetDbCommand("SELECT " + membershipFieldSequence + " WHERE MembershipId=" + membershipId, connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -426,19 +438,13 @@ namespace Swarmops.Database
return ReadMembershipFromDataReader(reader);
}
- throw new ArgumentOutOfRangeException("No such MembershipId: " + membershipId.ToString());
+ throw new ArgumentOutOfRangeException("No such MembershipId: " + membershipId);
}
}
}
- private const string membershipFieldSequence =
- " Memberships.MembershipId, Memberships.PersonId, Memberships.OrganizationId, Memberships.Active, Memberships.Expires, " + // 0-4
- " Memberships.MemberSince, Memberships.DateTimeTerminated, Memberships.TerminatedAsInvalid " + // 5-7
- " FROM Memberships ";
-
-
- private static BasicMembership ReadMembershipFromDataReader (DbDataReader reader)
+ private static BasicMembership ReadMembershipFromDataReader(DbDataReader reader)
{
int membershipId = reader.GetInt32(0);
int personId = reader.GetInt32(1);
@@ -450,19 +456,20 @@ namespace Swarmops.Database
// bool terminatedAsInvalid = reader.GetBoolean(7); Ignore this field for now
return new BasicMembership(membershipId, personId, organizationId, memberSince, expires, active,
- dateTerminated);
+ dateTerminated);
}
-
- public BasicMembershipPaymentStatus GetMembershipPaymentStatus (int membershipId)
+ public BasicMembershipPaymentStatus GetMembershipPaymentStatus(int membershipId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command =
- GetDbCommand("SELECT " + membershipPaymentStatusFieldSequence + " WHERE MembershipPayments.MembershipId=" + membershipId.ToString() + " ORDER BY StatusDateTime DESC LIMIT 1", connection);
+ GetDbCommand(
+ "SELECT " + membershipPaymentStatusFieldSequence + " WHERE MembershipPayments.MembershipId=" +
+ membershipId + " ORDER BY StatusDateTime DESC LIMIT 1", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -473,12 +480,13 @@ namespace Swarmops.Database
// No payment status -- return undefined
- return new BasicMembershipPaymentStatus(membershipId, MembershipPaymentStatus.Unknown, new DateTime(1900, 1, 1));
+ return new BasicMembershipPaymentStatus(membershipId, MembershipPaymentStatus.Unknown,
+ new DateTime(1900, 1, 1));
}
}
}
- public Dictionary GetMembershipPaymentStatuses (int[] membershipIds)
+ public Dictionary GetMembershipPaymentStatuses(int[] membershipIds)
{
Dictionary retVal = new Dictionary();
if (membershipIds.Length == 0)
@@ -488,7 +496,9 @@ namespace Swarmops.Database
connection.Open();
DbCommand command =
- GetDbCommand("SELECT " + membershipPaymentStatusFieldSequence + " WHERE MembershipPayments.MembershipId IN (" + JoinIds(membershipIds) + ") ORDER BY StatusDateTime ASC ", connection);
+ GetDbCommand(
+ "SELECT " + membershipPaymentStatusFieldSequence + " WHERE MembershipPayments.MembershipId IN (" +
+ JoinIds(membershipIds) + ") ORDER BY StatusDateTime ASC ", connection);
using (DbDataReader reader = command.ExecuteReader())
{
while (reader.Read())
@@ -499,8 +509,8 @@ namespace Swarmops.Database
foreach (int i in membershipIds)
{
if (!retVal.ContainsKey(i))
- retVal[i] = new BasicMembershipPaymentStatus(i, MembershipPaymentStatus.Unknown, new DateTime(1900, 1, 1));
-
+ retVal[i] = new BasicMembershipPaymentStatus(i, MembershipPaymentStatus.Unknown,
+ new DateTime(1900, 1, 1));
}
return retVal;
}
@@ -508,24 +518,18 @@ namespace Swarmops.Database
}
-
-
- private const string membershipPaymentStatusFieldSequence =
- " MembershipPayments.MembershipId, MembershipPayments.MembershipPaymentStatusId, MembershipPayments.StatusDateTime " +
- " FROM MembershipPayments ";
-
-
- private BasicMembershipPaymentStatus ReadMembershipPaymentStatusFromDataReader (DbDataReader reader)
+ private BasicMembershipPaymentStatus ReadMembershipPaymentStatusFromDataReader(DbDataReader reader)
{
int membershipId = reader.GetInt32(0);
int membershipPaymentStatusId = reader.GetInt32(1);
DateTime statusDateTime = reader.GetDateTime(2);
- return new BasicMembershipPaymentStatus(membershipId, (MembershipPaymentStatus)membershipPaymentStatusId, statusDateTime);
+ return new BasicMembershipPaymentStatus(membershipId, (MembershipPaymentStatus) membershipPaymentStatusId,
+ statusDateTime);
}
- public void SetMembershipExpires (int membershipId, DateTime newExpiry)
+ public void SetMembershipExpires(int membershipId, DateTime newExpiry)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -541,7 +545,8 @@ namespace Swarmops.Database
}
}
- public void SetMembershipPaymentStatus (int membershipId, MembershipPaymentStatus paymentStatus, DateTime statusDateTime)
+ public void SetMembershipPaymentStatus(int membershipId, MembershipPaymentStatus paymentStatus,
+ DateTime statusDateTime)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -550,7 +555,7 @@ namespace Swarmops.Database
command.CommandType = CommandType.StoredProcedure;
AddParameterWithName(command, "membershipId", membershipId);
- AddParameterWithName(command, "paymentStatusId", (int)paymentStatus);
+ AddParameterWithName(command, "paymentStatusId", (int) paymentStatus);
AddParameterWithName(command, "statusDateTime", statusDateTime);
command.ExecuteNonQuery();
@@ -558,7 +563,7 @@ namespace Swarmops.Database
}
- public int CreateMembership (int personId, int organizationId, DateTime expires)
+ public int CreateMembership(int personId, int organizationId, DateTime expires)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -575,7 +580,7 @@ namespace Swarmops.Database
}
}
- public int ImportMembership (int personId, int organizationId, DateTime memberSince, DateTime expires)
+ public int ImportMembership(int personId, int organizationId, DateTime memberSince, DateTime expires)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -595,13 +600,13 @@ namespace Swarmops.Database
}
- public void TerminateMembership (int membershipId)
+ public void TerminateMembership(int membershipId)
{
TerminateMembership(membershipId, false);
}
- public void TerminateMembership (int membershipId, bool asInvalid)
+ public void TerminateMembership(int membershipId, bool asInvalid)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -617,24 +622,26 @@ namespace Swarmops.Database
}
}
- public BasicMembership[] GetExpiringMemberships (IHasIdentity organization, DateTime expiry)
+ public BasicMembership[] GetExpiringMemberships(IHasIdentity organization, DateTime expiry)
{
return GetExpiringMemberships(organization, expiry, expiry);
}
- public BasicMembership[] GetExpiringMemberships (IHasIdentity organization, DateTime lowerBound, DateTime upperBound)
+ public BasicMembership[] GetExpiringMemberships(IHasIdentity organization, DateTime lowerBound,
+ DateTime upperBound)
{
return GetExpiringMemberships(organization, lowerBound, upperBound, DatabaseCondition.ActiveTrue);
}
- public BasicMembership[] GetExpiringMemberships (IHasIdentity organization, DateTime lowerBound, DateTime upperBound, DatabaseCondition condition)
+ public BasicMembership[] GetExpiringMemberships(IHasIdentity organization, DateTime lowerBound,
+ DateTime upperBound, DatabaseCondition condition)
{
// Since I don't trust SQL Server to make correct date comparisons, especially given
// that the dates are passed in text in SQL, we get ALL the memberships and do
// the comparison in code instead. This is a run-seldom function, anyway, and getting
// some 50k records with four short unlinked fields isn't that expensive.
- BasicMembership[] memberships = this.GetMemberships(organization, condition);
+ BasicMembership[] memberships = GetMemberships(organization, condition);
DateTime minimumDateTime = lowerBound.Date;
DateTime maximumDateTime = upperBound.Date.AddDays(1);
diff --git a/Database/Database-MotionAmendments.cs b/Database/Database-MotionAmendments.cs
index c2e89387..abd876c0 100644
--- a/Database/Database-MotionAmendments.cs
+++ b/Database/Database-MotionAmendments.cs
@@ -11,9 +11,11 @@ namespace Swarmops.Database
#region Field reading code
private const string motionAmendmentFieldSequence =
- " MotionAmendmentId,MotionAmendments.MotionId,MotionAmendments.SequenceNumber,MotionAmendments.SubmittedByPersonId,MotionAmendments.CreatedByPersonId," + // 0-4
- "MotionAmendments.CreatedDateTime,MotionAmendments.Title,MotionAmendments.Text,MotionAmendments.DecisionPoint,MotionAmendments.Open," + // 5-9
- "MotionAmendments.Carried " + // 10
+ " MotionAmendmentId,MotionAmendments.MotionId,MotionAmendments.SequenceNumber,MotionAmendments.SubmittedByPersonId,MotionAmendments.CreatedByPersonId," +
+ // 0-4
+ "MotionAmendments.CreatedDateTime,MotionAmendments.Title,MotionAmendments.Text,MotionAmendments.DecisionPoint,MotionAmendments.Open," +
+ // 5-9
+ "MotionAmendments.Carried " + // 10
"FROM MotionAmendments ";
private static BasicMotionAmendment ReadMotionAmendmentFromDataReader(IDataRecord reader)
@@ -30,13 +32,12 @@ namespace Swarmops.Database
bool open = reader.GetBoolean(9);
bool carried = reader.GetBoolean(10);
- return new BasicMotionAmendment(motionAmendmentId, motionId, sequenceNumber, submittedByPersonId, createdByPersonId, createdDateTime, title, text, decisionPoint, open, carried);
+ return new BasicMotionAmendment(motionAmendmentId, motionId, sequenceNumber, submittedByPersonId,
+ createdByPersonId, createdDateTime, title, text, decisionPoint, open, carried);
}
#endregion
-
-
#region Record reading - SELECT statements
public BasicMotionAmendment GetMotionAmendment(int motionAmendmentId)
@@ -47,7 +48,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + motionAmendmentFieldSequence + "WHERE MotionAmendmentId=" + motionAmendmentId + ";", connection);
+ "SELECT" + motionAmendmentFieldSequence + "WHERE MotionAmendmentId=" + motionAmendmentId + ";",
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -56,7 +58,7 @@ namespace Swarmops.Database
return ReadMotionAmendmentFromDataReader(reader);
}
- throw new ArgumentException("Unknown MotionAmendment Id: " + motionAmendmentId.ToString());
+ throw new ArgumentException("Unknown MotionAmendment Id: " + motionAmendmentId);
}
}
}
@@ -71,7 +73,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + motionAmendmentFieldSequence + ConstructWhereClause("MotionAmendments", conditions), connection);
+ "SELECT" + motionAmendmentFieldSequence + ConstructWhereClause("MotionAmendments", conditions),
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -96,7 +99,9 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + motionAmendmentFieldSequence + " JOIN Motions ON (Motions.MotionId=MotionAmendments.MotionId) WHERE Motions.MeetingId=" + meetingId.ToString(), connection);
+ "SELECT" + motionAmendmentFieldSequence +
+ " JOIN Motions ON (Motions.MotionId=MotionAmendments.MotionId) WHERE Motions.MeetingId=" +
+ meetingId, connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -110,16 +115,12 @@ namespace Swarmops.Database
}
}
-
-
-
#endregion
-
-
#region Creation and manipulation - stored procedures
- public int CreateMotionAmendment(int motionId, int submittingPersonId, int createdByPersonId, string title, string text, string decisionPoint)
+ public int CreateMotionAmendment(int motionId, int submittingPersonId, int createdByPersonId, string title,
+ string text, string decisionPoint)
{
DateTime now = DateTime.Now;
@@ -141,6 +142,7 @@ namespace Swarmops.Database
return Convert.ToInt32(command.ExecuteScalar());
}
}
+
/*
public void SetSalaryNetPaid(int salaryId, bool netPaid)
@@ -220,8 +222,6 @@ namespace Swarmops.Database
}
*/
-
#endregion
-
}
}
\ No newline at end of file
diff --git a/Database/Database-Motions.cs b/Database/Database-Motions.cs
index 28efe89a..c3789fdf 100644
--- a/Database/Database-Motions.cs
+++ b/Database/Database-Motions.cs
@@ -11,10 +11,10 @@ namespace Swarmops.Database
#region Field reading code
private const string motionFieldSequence =
- " MotionId,MeetingId,Designation,SubmittedByPersonId,CreatedByPersonId," + // 0-4
- "CreatedDateTime,AmendedByPersonId,AmendedDateTime,Title,Text," + // 5-9
- "AmendedText,DecisionPoints,AmendedDecisionPoints,Open,Carried," + // 10-14
- "ThreadUrl,Amended,SequenceNumber " + // 15-17
+ " MotionId,MeetingId,Designation,SubmittedByPersonId,CreatedByPersonId," + // 0-4
+ "CreatedDateTime,AmendedByPersonId,AmendedDateTime,Title,Text," + // 5-9
+ "AmendedText,DecisionPoints,AmendedDecisionPoints,Open,Carried," + // 10-14
+ "ThreadUrl,Amended,SequenceNumber " + // 15-17
"FROM Motions ";
private static BasicMotion ReadMotionFromDataReader(IDataRecord reader)
@@ -38,13 +38,13 @@ namespace Swarmops.Database
bool amended = reader.GetBoolean(16);
int sequenceNumber = reader.GetInt32(17);
- return new BasicMotion(motionId, meetingId, sequenceNumber, designation, submittedByPersonId, createdByPersonId, createdDateTime, amended, amendedByPersonId, amendedDateTime, title, text, amendedText, decisionPoints, amendedDecisionPoints, threadUrl, open, passed);
+ return new BasicMotion(motionId, meetingId, sequenceNumber, designation, submittedByPersonId,
+ createdByPersonId, createdDateTime, amended, amendedByPersonId, amendedDateTime, title, text,
+ amendedText, decisionPoints, amendedDecisionPoints, threadUrl, open, passed);
}
#endregion
-
-
#region Record reading - SELECT statements
public BasicMotion GetMotion(int motionId)
@@ -64,7 +64,7 @@ namespace Swarmops.Database
return ReadMotionFromDataReader(reader);
}
- throw new ArgumentException("Unknown Motion Id: " + motionId.ToString());
+ throw new ArgumentException("Unknown Motion Id: " + motionId);
}
}
}
@@ -93,14 +93,12 @@ namespace Swarmops.Database
}
}
-
#endregion
-
-
#region Creation and manipulation - stored procedures
- public int CreateMotion(int meetingId, int submittingPersonId, int creatingPersonId, string title, string text, string decisionPoints)
+ public int CreateMotion(int meetingId, int submittingPersonId, int creatingPersonId, string title, string text,
+ string decisionPoints)
{
DateTime now = DateTime.Now;
@@ -122,6 +120,7 @@ namespace Swarmops.Database
return Convert.ToInt32(command.ExecuteScalar());
}
}
+
/*
public void SetSalaryNetPaid(int salaryId, bool netPaid)
@@ -201,8 +200,6 @@ namespace Swarmops.Database
}
*/
-
#endregion
-
}
}
\ No newline at end of file
diff --git a/Database/Database-Newsletters.cs b/Database/Database-Newsletters.cs
index 49c834e1..e3613220 100644
--- a/Database/Database-Newsletters.cs
+++ b/Database/Database-Newsletters.cs
@@ -9,17 +9,17 @@ namespace Swarmops.Database
public partial class SwarmDb
{
///
- /// Gets all subscribed people for a certain newsletter.
+ /// Gets all subscribed people for a certain newsletter.
///
/// The Report Id.
/// An int array of PersonId.
- public int[] GetSubscribersForNewsletterFeed (int newsletterFeedId)
+ public int[] GetSubscribersForNewsletterFeed(int newsletterFeedId)
{
- System.Collections.Generic.Dictionary hash = new Dictionary();
+ Dictionary hash = new Dictionary();
// First, we get the newsletter feed we're working with.
- BasicNewsletterFeed newsletterFeed = this.GetNewsletterFeed(newsletterFeedId);
+ BasicNewsletterFeed newsletterFeed = GetNewsletterFeed(newsletterFeedId);
if (newsletterFeed.DefaultSubscribed)
{
@@ -31,7 +31,7 @@ namespace Swarmops.Database
// Note that the individual preferences may have people not in the organization,
// and so the final list may include subscribers that are nonmembers.
- BasicOrganization[] orgTree = this.GetOrganizationTree(newsletterFeed.OrganizationId);
+ BasicOrganization[] orgTree = GetOrganizationTree(newsletterFeed.OrganizationId);
List organizationIds = new List();
@@ -40,7 +40,7 @@ namespace Swarmops.Database
organizationIds.Add(org.Identity);
}
- int[] personIds = this.GetMembersForOrganizations(organizationIds.ToArray());
+ int[] personIds = GetMembersForOrganizations(organizationIds.ToArray());
foreach (int personId in personIds)
{
@@ -92,19 +92,21 @@ namespace Swarmops.Database
///
- /// Gets data about a specific newsletter.
+ /// Gets data about a specific newsletter.
///
/// The newsletter id.
/// A Newsletter instance.
- public BasicNewsletterFeed GetNewsletterFeed (int newsletterFeedId)
+ public BasicNewsletterFeed GetNewsletterFeed(int newsletterFeedId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command =
- GetDbCommand("SELECT OrganizationId,DefaultSubscribed,Name FROM NewsletterFeeds WHERE NewsletterFeedId=" + newsletterFeedId.ToString(),
- connection);
+ GetDbCommand(
+ "SELECT OrganizationId,DefaultSubscribed,Name FROM NewsletterFeeds WHERE NewsletterFeedId=" +
+ newsletterFeedId.ToString(),
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -125,11 +127,11 @@ namespace Swarmops.Database
}
///
- /// Returns all newsletterfeeds for organisation + those with org =0
+ /// Returns all newsletterfeeds for organisation + those with org =0
///
///
///
- public BasicNewsletterFeed[] GetNewsletterFeedsForOrganization (int organizationId)
+ public BasicNewsletterFeed[] GetNewsletterFeedsForOrganization(int organizationId)
{
List feeds = new List();
@@ -140,7 +142,7 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
"SELECT NewsletterFeedId, Name, DefaultSubscribed FROM NewsletterFeeds WHERE OrganizationId =" +
- organizationId.ToString() , connection);
+ organizationId.ToString(), connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -150,7 +152,7 @@ namespace Swarmops.Database
string reportName = reader.GetString(1);
bool defaultSubscribed = reader.GetBoolean(2);
feeds.Add(new BasicNewsletterFeed(newsletterFeedId, organizationId, defaultSubscribed,
- reportName));
+ reportName));
}
}
}
@@ -158,10 +160,10 @@ namespace Swarmops.Database
return feeds.ToArray();
}
- public System.Collections.Generic.Dictionary GetNewsletterFeedsForSubscriber (int personId)
+ public Dictionary GetNewsletterFeedsForSubscriber(int personId)
{
- System.Collections.Generic.Dictionary subs =
- new System.Collections.Generic.Dictionary();
+ Dictionary subs =
+ new Dictionary();
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -186,7 +188,7 @@ namespace Swarmops.Database
return subs;
}
- public void SetNewsletterSubscription (int personId, int newsletterFeedId, bool subscribed)
+ public void SetNewsletterSubscription(int personId, int newsletterFeedId, bool subscribed)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -203,7 +205,7 @@ namespace Swarmops.Database
}
}
- public void DeletePersonNewsletterSubscriptions (int personId) // reverts to default
+ public void DeletePersonNewsletterSubscriptions(int personId) // reverts to default
{
using (DbConnection connection = GetMySqlDbConnection())
{
diff --git a/Database/Database-Optimizations.cs b/Database/Database-Optimizations.cs
index d6b38495..d0e5faae 100644
--- a/Database/Database-Optimizations.cs
+++ b/Database/Database-Optimizations.cs
@@ -11,9 +11,9 @@ namespace Swarmops.Database
public partial class SwarmDb
{
///
- /// Optimization function.
+ /// Optimization function.
///
- public Dictionary GetPeopleWhoDeclineLocalMail (int[] personIds)
+ public Dictionary GetPeopleWhoDeclineLocalMail(int[] personIds)
{
Array.Sort(personIds);
Dictionary result = new Dictionary();
@@ -59,7 +59,7 @@ namespace Swarmops.Database
// Step 2 - find people who have "NeverMail" set
- int[] neverMailPersonIds = this.GetObjectsByOptionalData(ObjectType.Person, ObjectOptionalDataType.NeverMail, "1");
+ int[] neverMailPersonIds = GetObjectsByOptionalData(ObjectType.Person, ObjectOptionalDataType.NeverMail, "1");
// BasicPerson[] neverMailPeople = this.GetPeopleFromOptionalData(PersonOptionalDataKey.NeverMail, "1");
// For each of these people (they're not that many), if they are present in the personIds array, add them to the dictionary
@@ -76,8 +76,7 @@ namespace Swarmops.Database
}
-
- public Dictionary GetPeopleGeographies()
+ public Dictionary GetPeopleGeographies()
{
Dictionary result = new Dictionary();
@@ -106,7 +105,7 @@ namespace Swarmops.Database
}
- public Dictionary GetInternalPollVoteCountsPerGeography(int pollId)
+ public Dictionary GetInternalPollVoteCountsPerGeography(int pollId)
{
Dictionary result = new Dictionary();
@@ -116,7 +115,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "select count(*) AS VoteCount,VoteGeographyId from InternalPollVotes where InternalPollId=" + pollId.ToString() + " GROUP BY VoteGeographyId",
+ "select count(*) AS VoteCount,VoteGeographyId from InternalPollVotes where InternalPollId=" +
+ pollId + " GROUP BY VoteGeographyId",
connection);
using (DbDataReader reader = command.ExecuteReader())
@@ -133,6 +133,5 @@ namespace Swarmops.Database
return result;
}
-
}
}
\ No newline at end of file
diff --git a/Database/Database-OptionalData.cs b/Database/Database-OptionalData.cs
index 946fbd6d..73c3daa9 100644
--- a/Database/Database-OptionalData.cs
+++ b/Database/Database-OptionalData.cs
@@ -15,10 +15,9 @@ namespace Swarmops.Database
"JOIN ObjectTypes ON (ObjectTypes.ObjectTypeId=ObjectOptionalData.ObjectTypeId) " +
"JOIN ObjectOptionalDataTypes ON (ObjectOptionalData.ObjectOptionalDataTypeId=ObjectOptionalDataTypes.ObjectOptionalDataTypeId) ";
-
#region Select statements - reading data
- public BasicObjectOptionalData GetObjectOptionalData (IHasIdentity forObject)
+ public BasicObjectOptionalData GetObjectOptionalData(IHasIdentity forObject)
{
Dictionary initialData = new Dictionary();
ObjectType objectType = GetObjectTypeForObject(forObject);
@@ -30,8 +29,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + objectOptionalDataFieldSequence + "WHERE ObjectTypes.Name='" + objectType.ToString() + "' " +
- "AND ObjectOptionalData.ObjectId=" + objectId.ToString() + ";", connection);
+ "SELECT" + objectOptionalDataFieldSequence + "WHERE ObjectTypes.Name='" + objectType + "' " +
+ "AND ObjectOptionalData.ObjectId=" + objectId + ";", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -40,11 +39,11 @@ namespace Swarmops.Database
string objectOptionalDataTypeString = reader.GetString(2);
string data = reader.GetString(3);
- try
+ try
{
ObjectOptionalDataType objectOptionalDataType =
(ObjectOptionalDataType)
- Enum.Parse(typeof(ObjectOptionalDataType), objectOptionalDataTypeString);
+ Enum.Parse(typeof (ObjectOptionalDataType), objectOptionalDataTypeString);
initialData[objectOptionalDataType] = data;
}
@@ -60,7 +59,7 @@ namespace Swarmops.Database
}
- public int[] GetObjectsByOptionalData (ObjectType objectType, ObjectOptionalDataType dataType, string data)
+ public int[] GetObjectsByOptionalData(ObjectType objectType, ObjectOptionalDataType dataType, string data)
{
List objectIds = new List();
@@ -70,8 +69,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + objectOptionalDataFieldSequence + "WHERE ObjectTypes.Name='" + objectType.ToString() + "' " +
- "AND ObjectOptionalDataTypes.Name='" + dataType.ToString() + "' " +
+ "SELECT" + objectOptionalDataFieldSequence + "WHERE ObjectTypes.Name='" + objectType + "' " +
+ "AND ObjectOptionalDataTypes.Name='" + dataType + "' " +
"AND ObjectOptionalData.Data='" + data.Replace("'", "''") + "';", connection);
using (DbDataReader reader = command.ExecuteReader())
@@ -87,7 +86,7 @@ namespace Swarmops.Database
}
- static private ObjectType GetObjectTypeForObject (IHasIdentity objectToIdentify)
+ private static ObjectType GetObjectTypeForObject(IHasIdentity objectToIdentify)
{
//string objectTypeString = objectToIdentify.GetType().ToString();
@@ -101,17 +100,17 @@ namespace Swarmops.Database
// At this point, we should be able to cast the string to an ObjectType enum
try
{
- return (ObjectType)Enum.Parse(typeof(ObjectType), objectTypeString);
+ return (ObjectType) Enum.Parse(typeof (ObjectType), objectTypeString);
}
catch
{
//That failed. This could be a subclass, try upwards.
- Type parentType = objectToIdentify.GetType().BaseType;
- while (parentType != typeof(Object))
+ Type parentType = objectToIdentify.GetType().BaseType;
+ while (parentType != typeof (Object))
{
try
{
- return (ObjectType)Enum.Parse(typeof(ObjectType), parentType.Name);
+ return (ObjectType) Enum.Parse(typeof (ObjectType), parentType.Name);
}
catch
{
@@ -119,15 +118,15 @@ namespace Swarmops.Database
}
}
}
- throw new InvalidCastException("GetObjectTypeForObject could not identify object of type " + objectToIdentify.GetType().Name);
+ throw new InvalidCastException("GetObjectTypeForObject could not identify object of type " +
+ objectToIdentify.GetType().Name);
}
#endregion
-
#region Stored procedures for modifying data
- public void SetObjectOptionalData (IHasIdentity thisObject, ObjectOptionalDataType dataType, string data)
+ public void SetObjectOptionalData(IHasIdentity thisObject, ObjectOptionalDataType dataType, string data)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -145,7 +144,6 @@ namespace Swarmops.Database
}
}
-
#endregion
}
-}
+}
\ No newline at end of file
diff --git a/Database/Database-OrganizationFinancialAccounts.cs b/Database/Database-OrganizationFinancialAccounts.cs
index 5a5aa625..a737c431 100644
--- a/Database/Database-OrganizationFinancialAccounts.cs
+++ b/Database/Database-OrganizationFinancialAccounts.cs
@@ -10,10 +10,10 @@ namespace Swarmops.Database
" OrganizationFinancialAccountTypes.Name AS OrganizationFinancialAccountType,OrganizationFinancialAccounts.OrganizationId,OrganizationFinancialAccounts.FinancialAccountId FROM OrganizationFinancialAccounts " +
"JOIN OrganizationFinancialAccountTypes ON (OrganizationFinancialAccounts.OrganizationFinancialAccountTypeId=OrganizationFinancialAccountTypes.OrganizationFinancialAccountTypeId) ";
-
#region Select statements - reading data
- public int GetOrganizationFinancialAccountId(int organizationId, OrganizationFinancialAccountType organizationFinancialAccountType)
+ public int GetOrganizationFinancialAccountId(int organizationId,
+ OrganizationFinancialAccountType organizationFinancialAccountType)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -21,8 +21,9 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + organizationFinancialAccountsDataFieldSequence + "WHERE OrganizationFinancialAccountTypes.Name='" + organizationFinancialAccountType.ToString() + "' " +
- "AND OrganizationFinancialAccounts.Organizationid=" + organizationId.ToString() + ";", connection);
+ "SELECT" + organizationFinancialAccountsDataFieldSequence +
+ "WHERE OrganizationFinancialAccountTypes.Name='" + organizationFinancialAccountType + "' " +
+ "AND OrganizationFinancialAccounts.Organizationid=" + organizationId + ";", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -39,6 +40,7 @@ namespace Swarmops.Database
}
}
}
+
/*
public int[] GetObjectsByOptionalData(ObjectType objectType, ObjectOptionalDataType dataType, string data)
@@ -105,10 +107,10 @@ namespace Swarmops.Database
#endregion
-
#region Stored procedures for modifying data
- public void SetOrganizationFinancialAccountId(int organizationId, OrganizationFinancialAccountType accountType, int financialAccountId)
+ public void SetOrganizationFinancialAccountId(int organizationId, OrganizationFinancialAccountType accountType,
+ int financialAccountId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -125,7 +127,6 @@ namespace Swarmops.Database
}
}
-
#endregion
}
-}
+}
\ No newline at end of file
diff --git a/Database/Database-Organizations.cs b/Database/Database-Organizations.cs
index 100f644f..795a8c08 100644
--- a/Database/Database-Organizations.cs
+++ b/Database/Database-Organizations.cs
@@ -11,12 +11,12 @@ namespace Swarmops.Database
#region Field reading code
private const string organizationFieldSequence =
- " OrganizationId, ParentOrganizationId, Name, NameInternational, NameShort, " + // 0-4
+ " OrganizationId, ParentOrganizationId, Name, NameInternational, NameShort, " + // 0-4
"Domain, MailPrefix, AnchorGeographyId, AcceptsMembers, AutoAssignNewMembers, " + // 5-9
"DefaultCountryId " + // 10
"FROM Organizations ";
- private static BasicOrganization ReadOrganizationFromDataReader (DbDataReader reader)
+ private static BasicOrganization ReadOrganizationFromDataReader(DbDataReader reader)
{
int organizationId = reader.GetInt32(0);
int parentOrganizationId = reader.GetInt32(1);
@@ -31,17 +31,16 @@ namespace Swarmops.Database
int defaultCountryId = reader.GetInt32(10);
return new BasicOrganization(organizationId, parentOrganizationId, name, nameInternational, nameShort,
- domain, mailPrefix, anchorGeographyId, acceptsMembers, autoAssignNewMembers,
- defaultCountryId);
+ domain, mailPrefix, anchorGeographyId, acceptsMembers, autoAssignNewMembers,
+ defaultCountryId);
}
-
#endregion
-
- public int CreateOrganization (int ParentOrganizationId, string NameInternational, string Name, string NameShort, string Domain, string MailPrefix, int AnchorGeographyId, bool AcceptsMembers, bool AutoAssignNewMembers, int DefaultCountryId)
+ public int CreateOrganization(int ParentOrganizationId, string NameInternational, string Name, string NameShort,
+ string Domain, string MailPrefix, int AnchorGeographyId, bool AcceptsMembers, bool AutoAssignNewMembers,
+ int DefaultCountryId)
{
-
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
@@ -64,7 +63,7 @@ namespace Swarmops.Database
}
}
- public void DeleteOrganization (int OrganizationId)
+ public void DeleteOrganization(int OrganizationId)
{
int deletedOrganizationsID = 98;
BasicOrganization org = GetOrganization(OrganizationId);
@@ -81,12 +80,12 @@ namespace Swarmops.Database
org.AutoAssignNewMembers,
org.DefaultCountryId,
OrganizationId);
-
}
- public void UpdateOrganization (int ParentOrganizationId, string NameInternational, string Name, string NameShort, string Domain, string MailPrefix, int AnchorGeographyId, bool AcceptsMembers, bool AutoAssignNewMembers, int DefaultCountryId, int OrganizationId)
+ public void UpdateOrganization(int ParentOrganizationId, string NameInternational, string Name, string NameShort,
+ string Domain, string MailPrefix, int AnchorGeographyId, bool AcceptsMembers, bool AutoAssignNewMembers,
+ int DefaultCountryId, int OrganizationId)
{
-
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
@@ -110,15 +109,16 @@ namespace Swarmops.Database
}
- public BasicOrganization GetOrganization (int organizationId)
+ public BasicOrganization GetOrganization(int organizationId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command =
- GetDbCommand("SELECT " + organizationFieldSequence + " WHERE Active=1 AND OrganizationId=" + organizationId.ToString(),
- connection);
+ GetDbCommand(
+ "SELECT " + organizationFieldSequence + " WHERE Active=1 AND OrganizationId=" + organizationId,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -127,13 +127,13 @@ namespace Swarmops.Database
return ReadOrganizationFromDataReader(reader);
}
- throw new ArgumentException("No such OrganizationId: " + organizationId.ToString());
+ throw new ArgumentException("No such OrganizationId: " + organizationId);
}
}
}
- public int[] GetOrganizationsIdsInGeographies (BasicGeography[] nodes)
+ public int[] GetOrganizationsIdsInGeographies(BasicGeography[] nodes)
{
if (nodes == null || nodes.Length == 0)
{
@@ -151,7 +151,7 @@ namespace Swarmops.Database
}
- public int[] GetOrganizationIdsInGeographies (int[] nodeIds)
+ public int[] GetOrganizationIdsInGeographies(int[] nodeIds)
{
if (nodeIds == null || nodeIds.Length == 0)
{
@@ -166,7 +166,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT OrganizationId FROM Organizations Where Active=1 AND AnchorGeographyId in (" + JoinIds(nodeIds) +
+ "SELECT OrganizationId FROM Organizations Where Active=1 AND AnchorGeographyId in (" +
+ JoinIds(nodeIds) +
")", connection);
using (DbDataReader reader = command.ExecuteReader())
@@ -194,11 +195,10 @@ namespace Swarmops.Database
int[] resultArray = new int[resultKeys.Keys.Count];
resultKeys.Keys.CopyTo(resultArray, 0);
return resultArray;
-
}
- public Dictionary> GetAllOrganizationUptakeGeographyIds ()
+ public Dictionary> GetAllOrganizationUptakeGeographyIds()
{
Dictionary> result = new Dictionary>();
@@ -228,11 +228,12 @@ namespace Swarmops.Database
return result;
}
- public int[] GetOrganizationUptakeGeographyIds (int organizationId)
+
+ public int[] GetOrganizationUptakeGeographyIds(int organizationId)
{
List result = new List();
- BasicOrganization basicOrg = this.GetOrganization(organizationId);
+ BasicOrganization basicOrg = GetOrganization(organizationId);
result.Add(basicOrg.AnchorGeographyId);
using (DbConnection connection = GetMySqlDbConnection())
@@ -261,7 +262,7 @@ namespace Swarmops.Database
return result.ToArray();
}
- public BasicUptakeGeography[] GetOrganizationUptakeGeographies (int organizationId, bool others)
+ public BasicUptakeGeography[] GetOrganizationUptakeGeographies(int organizationId, bool others)
{
List result = new List();
using (DbConnection connection = GetMySqlDbConnection())
@@ -270,7 +271,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT OrganizationId, GeographyId FROM OrganizationUptakeGeographies WHERE OrganizationId" + (others ? "<>" : "=") + organizationId,
+ "SELECT OrganizationId, GeographyId FROM OrganizationUptakeGeographies WHERE OrganizationId" +
+ (others ? "<>" : "=") + organizationId,
connection);
using (DbDataReader reader = command.ExecuteReader())
@@ -285,7 +287,7 @@ namespace Swarmops.Database
return result.ToArray();
}
- public void AddOrgUptakeGeography (int OrganizationId, int GeographyId)
+ public void AddOrgUptakeGeography(int OrganizationId, int GeographyId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -298,12 +300,10 @@ namespace Swarmops.Database
AddParameterWithName(command, "p_GeographyId", GeographyId);
command.ExecuteNonQuery();
}
-
}
- public void DeleteOrgUptakeGeography (int OrganizationId, int GeographyId)
+ public void DeleteOrgUptakeGeography(int OrganizationId, int GeographyId)
{
-
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
@@ -315,10 +315,9 @@ namespace Swarmops.Database
AddParameterWithName(command, "p_GeographyId", GeographyId);
command.ExecuteNonQuery();
}
-
}
- public BasicOrganization[] GetAllOrganizations ()
+ public BasicOrganization[] GetAllOrganizations()
{
List result = new List();
@@ -326,7 +325,10 @@ namespace Swarmops.Database
{
connection.Open();
- DbCommand command = GetDbCommand("SELECT " + organizationFieldSequence + " WHERE Active=1 AND ParentOrganizationId >= 0", connection);
+ DbCommand command =
+ GetDbCommand(
+ "SELECT " + organizationFieldSequence + " WHERE Active=1 AND ParentOrganizationId >= 0",
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -341,7 +343,7 @@ namespace Swarmops.Database
}
- public BasicOrganization[] GetOrganizations (int[] organizationIds)
+ public BasicOrganization[] GetOrganizations(int[] organizationIds)
{
if (organizationIds == null || organizationIds.Length == 0)
{
@@ -356,7 +358,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT " + organizationFieldSequence + " WHERE Active=1 AND OrganizationId IN (" + JoinIds(organizationIds) +
+ "SELECT " + organizationFieldSequence + " WHERE Active=1 AND OrganizationId IN (" +
+ JoinIds(organizationIds) +
")", connection);
using (DbDataReader reader = command.ExecuteReader())
@@ -372,7 +375,7 @@ namespace Swarmops.Database
}
- public Dictionary> GetHashedOrganizations ()
+ public Dictionary> GetHashedOrganizations()
{
// This generates a Dictionary >.
//
@@ -413,7 +416,7 @@ namespace Swarmops.Database
}
- public BasicOrganization[] GetOrganizationTree (int startOrganizationId)
+ public BasicOrganization[] GetOrganizationTree(int startOrganizationId)
{
Dictionary> organizations = GetHashedOrganizations();
@@ -421,7 +424,7 @@ namespace Swarmops.Database
}
- public Dictionary GetOrganizationHashtable (int startOrganizationId)
+ public Dictionary GetOrganizationHashtable(int startOrganizationId)
{
BasicOrganization[] organizations = GetOrganizationTree(startOrganizationId);
@@ -436,8 +439,8 @@ namespace Swarmops.Database
}
- private BasicOrganization[] GetOrganizationTree (Dictionary> organizations,
- int startOrganizationId, int generation)
+ private BasicOrganization[] GetOrganizationTree(Dictionary> organizations,
+ int startOrganizationId, int generation)
{
List result = new List();
@@ -453,7 +456,7 @@ namespace Swarmops.Database
// Add recursively
BasicOrganization[] children = GetOrganizationTree(organizations, organization.OrganizationId,
- generation + 1);
+ generation + 1);
if (children.Length > 0)
{
@@ -476,7 +479,7 @@ namespace Swarmops.Database
}
- public BasicOrganization[] GetOrganizationLine (int leafOrganizationId)
+ public BasicOrganization[] GetOrganizationLine(int leafOrganizationId)
{
List result = new List();
diff --git a/Database/Database-OutboundCommRecipients.cs b/Database/Database-OutboundCommRecipients.cs
index 0ce8e88e..e7c37bb6 100644
--- a/Database/Database-OutboundCommRecipients.cs
+++ b/Database/Database-OutboundCommRecipients.cs
@@ -8,15 +8,15 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
-
#region Database field reading
private const string outboundCommRecipientFieldSequence =
- " OutboundCommRecipientId,OutboundCommId,PersonId,Open,Success," + // 0-4
- "FailReasonId " + // 5
+ " OutboundCommRecipientId,OutboundCommId,PersonId,Open,Success," + // 0-4
+ "FailReasonId " + // 5
"FROM OutboundCommRecipients ";
- private BasicOutboundCommRecipient ReadOutboundCommRecipientFromDataReader(IDataRecord reader) // Not static -- accesses cache, requiring connection strings
+ private BasicOutboundCommRecipient ReadOutboundCommRecipientFromDataReader(IDataRecord reader)
+ // Not static -- accesses cache, requiring connection strings
{
int outboundCommRecipientId = reader.GetInt32(0);
int outboundCommId = reader.GetInt32(1);
@@ -27,17 +27,14 @@ namespace Swarmops.Database
string failReason = GetCachedFailReasonName(failReasonId);
- return new BasicOutboundCommRecipient (outboundCommRecipientId, outboundCommId, personId, open, success, failReason);
-
-
+ return new BasicOutboundCommRecipient(outboundCommRecipientId, outboundCommId, personId, open, success,
+ failReason);
}
#endregion
-
#region Database record reading -- SELECT clauses
-
public BasicOutboundCommRecipient GetOutboundCommRecipient(int outboundCommRecipientId)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -46,8 +43,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand("SELECT" + outboundCommRecipientFieldSequence +
- "WHERE OutboundCommRecipientId=" + outboundCommRecipientId.ToString(),
- connection);
+ "WHERE OutboundCommRecipientId=" + outboundCommRecipientId,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -56,14 +53,12 @@ namespace Swarmops.Database
return ReadOutboundCommRecipientFromDataReader(reader);
}
- throw new ArgumentException("No such OutboundCommRecipientId:" + outboundCommRecipientId.ToString());
+ throw new ArgumentException("No such OutboundCommRecipientId:" + outboundCommRecipientId);
}
}
-
}
-
public BasicOutboundCommRecipient[] GetOutboundCommRecipients(params object[] conditions)
{
List result = new List();
@@ -74,7 +69,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + outboundCommRecipientFieldSequence + ConstructWhereClause("OutboundCommRecipients", conditions), connection);
+ "SELECT" + outboundCommRecipientFieldSequence +
+ ConstructWhereClause("OutboundCommRecipients", conditions), connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -88,10 +84,8 @@ namespace Swarmops.Database
}
}
-
#endregion
-
#region Database optimizations
private static Dictionary _failReasonCache;
@@ -114,8 +108,8 @@ namespace Swarmops.Database
connection.Open();
DbCommand command =
- GetDbCommand("SELECT Name FROM FailReasons WHERE FailReasonId=" + failReasonId.ToString(),
- connection);
+ GetDbCommand("SELECT Name FROM FailReasons WHERE FailReasonId=" + failReasonId,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -125,19 +119,15 @@ namespace Swarmops.Database
return _failReasonCache[failReasonId];
}
- throw new ArgumentException("No such FailReasonId:" + failReasonId.ToString());
+ throw new ArgumentException("No such FailReasonId:" + failReasonId);
}
}
-
}
-
#endregion
-
#region Creation and manipulation -- stored procedures
-
public int CreateOutboundCommRecipient(int outboundCommId, int personId)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -154,7 +144,7 @@ namespace Swarmops.Database
}
}
- public void SetOutboundCommRecipientClosed (int outboundCommRecipientId)
+ public void SetOutboundCommRecipientClosed(int outboundCommRecipientId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -190,7 +180,6 @@ namespace Swarmops.Database
#endregion
-
#region Dead template code
/*
@@ -534,7 +523,5 @@ namespace Swarmops.Database
*/
#endregion
-
-
}
}
\ No newline at end of file
diff --git a/Database/Database-OutboundComms.cs b/Database/Database-OutboundComms.cs
index 42131723..00c23b39 100644
--- a/Database/Database-OutboundComms.cs
+++ b/Database/Database-OutboundComms.cs
@@ -9,17 +9,17 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
-
#region Database field reading
private const string outboundCommFieldSequence =
- " OutboundCommId,SenderPersonId,FromPersonId,OrganizationId,CreatedDateTime," + // 0-4
- "ResolverClassId,RecipientDataXml,Resolved,ResolvedDateTime,Priority," + // 5-9
- "TransmitterClassId,PayloadXml,Open,StartTransmitDateTime,ClosedDateTime," + // 10-14
- "RecipientCount,RecipientsSuccess,RecipientsFail " + // 15-17
+ " OutboundCommId,SenderPersonId,FromPersonId,OrganizationId,CreatedDateTime," + // 0-4
+ "ResolverClassId,RecipientDataXml,Resolved,ResolvedDateTime,Priority," + // 5-9
+ "TransmitterClassId,PayloadXml,Open,StartTransmitDateTime,ClosedDateTime," + // 10-14
+ "RecipientCount,RecipientsSuccess,RecipientsFail " + // 15-17
"FROM OutboundComms ";
- private BasicOutboundComm ReadOutboundCommFromDataReader(IDataRecord reader) // Not static -- accesses cache, requiring connection strings
+ private BasicOutboundComm ReadOutboundCommFromDataReader(IDataRecord reader)
+ // Not static -- accesses cache, requiring connection strings
{
int outboundCommId = reader.GetInt32(0);
int senderPersonId = reader.GetInt32(1);
@@ -27,13 +27,15 @@ namespace Swarmops.Database
int organizationId = reader.GetInt32(3);
DateTime createdDateTime = reader.GetDateTime(4);
- int resolverClassId = reader.GetInt32(5); // Resolve to class name -- cached call more efficient than Join in Select
+ int resolverClassId = reader.GetInt32(5);
+ // Resolve to class name -- cached call more efficient than Join in Select
string recipientDataXml = reader.GetString(6); // Interpreted by ResolverClass
bool resolved = reader.GetBoolean(7);
DateTime resolvedDateTime = reader.GetDateTime(8);
OutboundCommPriority priority = (OutboundCommPriority) reader.GetInt32(9);
- int transmitterClassId = reader.GetInt32(10); // Resolve to class name -- cached call more efficient than Join in Select
+ int transmitterClassId = reader.GetInt32(10);
+ // Resolve to class name -- cached call more efficient than Join in Select
string payloadXml = reader.GetString(11); // Interpreted by TransmitterClass
bool open = reader.GetBoolean(12);
DateTime startTransmitDateTime = reader.GetDateTime(13);
@@ -50,19 +52,15 @@ namespace Swarmops.Database
return new BasicOutboundComm
(outboundCommId, senderPersonId, fromPersonId, organizationId, createdDateTime,
- resolverClass, recipientDataXml, resolved, resolvedDateTime, priority,
- transmitterClass, payloadXml, open, startTransmitDateTime, closedDateTime,
- recipientCount, recipientSuccessCount, recipientFailCount);
-
-
+ resolverClass, recipientDataXml, resolved, resolvedDateTime, priority,
+ transmitterClass, payloadXml, open, startTransmitDateTime, closedDateTime,
+ recipientCount, recipientSuccessCount, recipientFailCount);
}
#endregion
-
#region Database record reading -- SELECT clauses
-
public BasicOutboundComm GetOutboundComm(int outboundCommId)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -71,8 +69,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand("SELECT" + outboundCommFieldSequence +
- "WHERE OutboundCommId=" + outboundCommId.ToString(),
- connection);
+ "WHERE OutboundCommId=" + outboundCommId,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -81,14 +79,12 @@ namespace Swarmops.Database
return ReadOutboundCommFromDataReader(reader);
}
- throw new ArgumentException("No such OutboundCommId:" + outboundCommId.ToString());
+ throw new ArgumentException("No such OutboundCommId:" + outboundCommId);
}
}
-
}
-
public BasicOutboundComm[] GetOutboundComms(params object[] conditions)
{
List result = new List();
@@ -99,7 +95,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + outboundCommFieldSequence + ConstructWhereClause("OutboundComms", conditions) + " ORDER BY Priority ASC", connection);
+ "SELECT" + outboundCommFieldSequence + ConstructWhereClause("OutboundComms", conditions) +
+ " ORDER BY Priority ASC", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -113,16 +110,14 @@ namespace Swarmops.Database
}
}
-
#endregion
-
#region Database optimizations
private static Dictionary _resolverClassCache;
- private static Dictionary _transmitterClassCache;
+ private static Dictionary _transmitterClassCache;
- protected string GetCachedResolverClassName (int resolverClassId)
+ protected string GetCachedResolverClassName(int resolverClassId)
{
if (_resolverClassCache == null)
{
@@ -140,8 +135,8 @@ namespace Swarmops.Database
connection.Open();
DbCommand command =
- GetDbCommand("SELECT Name FROM ResolverClasses WHERE ResolverClassId=" + resolverClassId.ToString(),
- connection);
+ GetDbCommand("SELECT Name FROM ResolverClasses WHERE ResolverClassId=" + resolverClassId,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -151,10 +146,9 @@ namespace Swarmops.Database
return _resolverClassCache[resolverClassId];
}
- throw new ArgumentException("No such ResolverClassId:" + resolverClassId.ToString());
+ throw new ArgumentException("No such ResolverClassId:" + resolverClassId);
}
}
-
}
protected string GetCachedTransmitterClassName(int transmitterClassId)
@@ -174,8 +168,8 @@ namespace Swarmops.Database
connection.Open();
DbCommand command =
- GetDbCommand("SELECT Name FROM TransmitterClasses WHERE TransmitterClassId=" + transmitterClassId.ToString(),
- connection);
+ GetDbCommand("SELECT Name FROM TransmitterClasses WHERE TransmitterClassId=" + transmitterClassId,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -185,22 +179,17 @@ namespace Swarmops.Database
return _transmitterClassCache[transmitterClassId];
}
- throw new ArgumentException("No such TransmitterClassId:" + transmitterClassId.ToString());
+ throw new ArgumentException("No such TransmitterClassId:" + transmitterClassId);
}
}
-
}
-
-
-
#endregion
-
#region Creation and manipulation -- stored procedures
-
- public int CreateOutboundComm(int senderPersonId, int fromPersonId, int organizationId, string resolverClass, string recipientDataXml, string transmitterClass, string payloadXml, OutboundCommPriority priority)
+ public int CreateOutboundComm(int senderPersonId, int fromPersonId, int organizationId, string resolverClass,
+ string recipientDataXml, string transmitterClass, string payloadXml, OutboundCommPriority priority)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -212,11 +201,15 @@ 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, "transmitterClass", transmitterClass); // Will be turned into ID by stored procedure
+ 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());
@@ -273,7 +266,6 @@ namespace Swarmops.Database
#endregion
-
#region Dead template code
/*
@@ -617,7 +609,5 @@ namespace Swarmops.Database
*/
#endregion
-
-
}
}
\ No newline at end of file
diff --git a/Database/Database-OutboundInvoices.cs b/Database/Database-OutboundInvoices.cs
index 85af8c7c..f0f8e715 100644
--- a/Database/Database-OutboundInvoices.cs
+++ b/Database/Database-OutboundInvoices.cs
@@ -11,9 +11,9 @@ namespace Swarmops.Database
#region Field reading code
private const string outboundInvoiceFieldSequence =
- " OutboundInvoiceId,CustomerName,InvoiceAddressPaper,InvoiceAddressMail,CurrencyId," + // 0-4
- "0,OrganizationId,BudgetId,CreatedDateTime,CreatedByPersonId," + // 5-9
- "DueDate,ReminderCount,Reference,Domestic,Open, " + // 10-14
+ " OutboundInvoiceId,CustomerName,InvoiceAddressPaper,InvoiceAddressMail,CurrencyId," + // 0-4
+ "0,OrganizationId,BudgetId,CreatedDateTime,CreatedByPersonId," + // 5-9
+ "DueDate,ReminderCount,Reference,Domestic,Open, " + // 10-14
"Sent,SecurityCode,TheirReference " +
"FROM OutboundInvoices ";
@@ -46,11 +46,11 @@ namespace Swarmops.Database
string theirReference = reader.GetString(17);
return new BasicOutboundInvoice(outboundInvoiceId, customerName, invoiceAddressPaper, invoiceAddressMail,
- currencyId, organizationId, budgetId, createdDateTime,
- createdByPersonId, dueDate, reminderCount, reference, domestic, open, sent, securityCode, theirReference);
+ currencyId, organizationId, budgetId, createdDateTime,
+ createdByPersonId, dueDate, reminderCount, reference, domestic, open, sent, securityCode, theirReference);
}
- private BasicOutboundInvoiceItem ReadOutboundInvoiceItemFromDataReader (DbDataReader reader)
+ private BasicOutboundInvoiceItem ReadOutboundInvoiceItemFromDataReader(DbDataReader reader)
{
int outboundInvoiceItemId = reader.GetInt32(0);
int outboundInvoiceId = reader.GetInt32(1);
@@ -62,8 +62,6 @@ namespace Swarmops.Database
#endregion
-
-
#region Record reading - SELECT statements
public BasicOutboundInvoice GetOutboundInvoice(int outboundInvoiceId)
@@ -74,7 +72,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + outboundInvoiceFieldSequence + "WHERE OutboundInvoiceId=" + outboundInvoiceId + ";", connection);
+ "SELECT" + outboundInvoiceFieldSequence + "WHERE OutboundInvoiceId=" + outboundInvoiceId + ";",
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -90,7 +89,7 @@ namespace Swarmops.Database
///
- /// Gets a list of outbound invoices.
+ /// Gets a list of outbound invoices.
///
/// Optional Organization object and/or DatabaseConditions.
/// The inbound invoice list.
@@ -104,7 +103,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + outboundInvoiceFieldSequence + ConstructWhereClause("OutboundInvoices", conditions) + " ORDER BY DueDate;", connection);
+ "SELECT" + outboundInvoiceFieldSequence + ConstructWhereClause("OutboundInvoices", conditions) +
+ " ORDER BY DueDate;", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -119,8 +119,7 @@ namespace Swarmops.Database
}
-
- public BasicOutboundInvoiceItem GetOutboundInvoiceItem (int outboundInvoiceItemId)
+ public BasicOutboundInvoiceItem GetOutboundInvoiceItem(int outboundInvoiceItemId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -128,7 +127,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + outboundInvoiceItemFieldSequence + "WHERE OutboundInvoiceItemId=" + outboundInvoiceItemId + ";", connection);
+ "SELECT" + outboundInvoiceItemFieldSequence + "WHERE OutboundInvoiceItemId=" +
+ outboundInvoiceItemId + ";", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -143,10 +143,8 @@ namespace Swarmops.Database
}
-
-
///
- /// Gets a list of outbound invoice items.
+ /// Gets a list of outbound invoice items.
///
/// OutboundInvoice object.
/// The inbound invoice list.
@@ -160,7 +158,9 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + outboundInvoiceItemFieldSequence + ConstructWhereClause("OutboundInvoiceItems", conditions) + outboundInvoiceItemSortOrder + ";", connection);
+ "SELECT" + outboundInvoiceItemFieldSequence +
+ ConstructWhereClause("OutboundInvoiceItems", conditions) + outboundInvoiceItemSortOrder + ";",
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -174,11 +174,8 @@ namespace Swarmops.Database
}
}
-
#endregion
-
-
#region Creation and manipulation - stored procedures
public int CreateOutboundInvoice(int organizationId, int createdByPersonId, DateTime dueDate,
@@ -284,8 +281,6 @@ namespace Swarmops.Database
}
-
-
public void SetOutboundInvoiceReference(int inboundInvoiceId, string reference)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -303,8 +298,6 @@ namespace Swarmops.Database
}
-
-
public void SetOutboundInvoiceBudget(int outboundInvoiceId, int budgetId)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -321,15 +314,10 @@ namespace Swarmops.Database
}
}
-
#endregion
-
-
-
#region Dead template code
-
/*
public int CreateFinancialAccount(int pOrganizationId, string pName, FinancialAccountType pAccountType, int pParentFinancialAccountId)
{
diff --git a/Database/Database-OutboundMailRecipients.cs b/Database/Database-OutboundMailRecipients.cs
index a5fb8ad6..6a7fba58 100644
--- a/Database/Database-OutboundMailRecipients.cs
+++ b/Database/Database-OutboundMailRecipients.cs
@@ -20,12 +20,12 @@ namespace Swarmops.Database
bool asOfficer = reader.GetBoolean(3);
int personType = reader.GetInt32(4);
- return new BasicOutboundMailRecipient(outboundMailRecipientId, outboundMailId, personId, asOfficer, personType);
+ return new BasicOutboundMailRecipient(outboundMailRecipientId, outboundMailId, personId, asOfficer,
+ personType);
}
-
- public BasicOutboundMailRecipient[] GetTopOutboundMailRecipients (int outboundMailId, int batchSize)
+ public BasicOutboundMailRecipient[] GetTopOutboundMailRecipients(int outboundMailId, int batchSize)
{
List result = new List();
@@ -36,7 +36,7 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
"SELECT " + outboundMailRecipientFieldSequence + " WHERE OutboundMailId=" +
- outboundMailId.ToString() + " LIMIT " + batchSize.ToString(), connection);
+ outboundMailId + " LIMIT " + batchSize, connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -51,8 +51,7 @@ namespace Swarmops.Database
}
-
- public void DeleteOutboundMailRecipient (int outboundMailRecipientId)
+ public void DeleteOutboundMailRecipient(int outboundMailRecipientId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -67,7 +66,7 @@ namespace Swarmops.Database
}
}
- public void CreateOutboundMailRecipient (int outboundMailId, int personId, bool asOfficer, int personType)
+ public void CreateOutboundMailRecipient(int outboundMailId, int personId, bool asOfficer, int personType)
{
using (DbConnection connection = GetMySqlDbConnection())
{
diff --git a/Database/Database-OutboundMails.cs b/Database/Database-OutboundMails.cs
index a323c34d..6a0baf14 100644
--- a/Database/Database-OutboundMails.cs
+++ b/Database/Database-OutboundMails.cs
@@ -10,13 +10,13 @@ namespace Swarmops.Database
public partial class SwarmDb
{
private const string outboundMailFieldSequence =
- " OutboundMailId,AuthorType,AuthorPersonId,Title,Body," + // 0-4
+ " OutboundMailId,AuthorType,AuthorPersonId,Title,Body," + // 0-4
"MailPriority,MailType,OrganizationId,GeographyId,CreatedDateTime," + // 5-9
- "ReleaseDateTime,ReadyForPickup,Resolved,Processed,ResolvedDateTime," + // 10-14
- "StartProcessDateTime,EndProcessDateTime,RecipientCount,RecipientsSuccess,RecipientsFail " + // 15-19
+ "ReleaseDateTime,ReadyForPickup,Resolved,Processed,ResolvedDateTime," + // 10-14
+ "StartProcessDateTime,EndProcessDateTime,RecipientCount,RecipientsSuccess,RecipientsFail " + // 15-19
" FROM OutboundMails ";
- private static BasicOutboundMail ReadOutboundMailFromDataReader (IDataRecord reader)
+ private static BasicOutboundMail ReadOutboundMailFromDataReader(IDataRecord reader)
{
int outboundMailId = reader.GetInt32(0);
int authorType = reader.GetInt32(1);
@@ -42,22 +42,24 @@ namespace Swarmops.Database
int recipientsSuccess = reader.GetInt32(18);
int recipientsFail = reader.GetInt32(19);
- return new BasicOutboundMail(outboundMailId, (MailAuthorType)authorType, authorPersonId, title, body,
+ return new BasicOutboundMail(outboundMailId, (MailAuthorType) authorType, authorPersonId, title, body,
mailPriority, mailTypeId, organizationId, geographyId, createdDateTime,
- releaseDateTime, readyForPickup, resolved, processed, resolvedDateTime, startProcessDateTime, endProcessDateTime,
+ releaseDateTime, readyForPickup, resolved, processed, resolvedDateTime, startProcessDateTime,
+ endProcessDateTime,
recipientCount, recipientsSuccess, recipientsFail);
}
- public BasicOutboundMail GetOutboundMail (int outboundMailId)
+ public BasicOutboundMail GetOutboundMail(int outboundMailId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command =
- GetDbCommand("SELECT " + outboundMailFieldSequence + " WHERE OutboundMailId=" + outboundMailId.ToString(),
- connection);
+ GetDbCommand(
+ "SELECT " + outboundMailFieldSequence + " WHERE OutboundMailId=" + outboundMailId.ToString(),
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -73,7 +75,7 @@ namespace Swarmops.Database
}
}
- public BasicOutboundMail[] GetTopUnresolvedOutboundMail (int count)
+ public BasicOutboundMail[] GetTopUnresolvedOutboundMail(int count)
{
if (count == 0)
{
@@ -88,7 +90,9 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT " + outboundMailFieldSequence + " WHERE ReadyForPickup=1 AND Resolved=0 AND Processed=0 ORDER BY MailPriority, OutboundMailId DESC LIMIT " + count.ToString(),
+ "SELECT " + outboundMailFieldSequence +
+ " WHERE ReadyForPickup=1 AND Resolved=0 AND Processed=0 ORDER BY MailPriority, OutboundMailId DESC LIMIT " +
+ count.ToString(),
connection);
using (DbDataReader reader = command.ExecuteReader())
@@ -103,7 +107,7 @@ namespace Swarmops.Database
}
}
- public BasicOutboundMail[] GetTopUnprocessedOutboundMail (int count)
+ public BasicOutboundMail[] GetTopUnprocessedOutboundMail(int count)
{
if (count == 0)
{
@@ -118,7 +122,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT " + outboundMailFieldSequence + " WHERE ReadyForPickup=1 AND Resolved=1 AND Processed=0 " +
+ "SELECT " + outboundMailFieldSequence +
+ " WHERE ReadyForPickup=1 AND Resolved=1 AND Processed=0 " +
" AND ReleaseDateTime < NOW() " +
" ORDER BY MailPriority, ReleaseDateTime, OutboundMailId DESC LIMIT " + count.ToString(),
connection);
@@ -134,7 +139,8 @@ namespace Swarmops.Database
}
}
}
- public BasicOutboundMail[] GetOutboundMailQueue (int count)
+
+ public BasicOutboundMail[] GetOutboundMailQueue(int count)
{
// This may not survive the migration. SQL Syntax, etc.
@@ -182,9 +188,9 @@ order by EndProcessDateTime, MailPriority, ReleaseDateTime, OutboundMailId DESC
}
- public int CreateOutboundMail (MailAuthorType authorType, int authorPersonId, string title,
- string body, int mailPriority, int mailType, int geographyId,
- int organizationId, DateTime releaseDateTime)
+ public int CreateOutboundMail(MailAuthorType authorType, int authorPersonId, string title,
+ string body, int mailPriority, int mailType, int geographyId,
+ int organizationId, DateTime releaseDateTime)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -193,7 +199,7 @@ order by EndProcessDateTime, MailPriority, ReleaseDateTime, OutboundMailId DESC
DbCommand command = GetDbCommand("CreateOutboundMail", connection);
command.CommandType = CommandType.StoredProcedure;
- AddParameterWithName(command, "authorType", (int)authorType);
+ AddParameterWithName(command, "authorType", (int) authorType);
AddParameterWithName(command, "authorPersonId", authorPersonId);
AddParameterWithName(command, "title", title);
AddParameterWithName(command, "body", body);
@@ -215,7 +221,7 @@ order by EndProcessDateTime, MailPriority, ReleaseDateTime, OutboundMailId DESC
}
}
- public void SetOutboundMailProcessed (int outboundMailId)
+ public void SetOutboundMailProcessed(int outboundMailId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -232,7 +238,7 @@ order by EndProcessDateTime, MailPriority, ReleaseDateTime, OutboundMailId DESC
}
- public void SetOutboundMailStartProcess (int outboundMailId)
+ public void SetOutboundMailStartProcess(int outboundMailId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -249,7 +255,7 @@ order by EndProcessDateTime, MailPriority, ReleaseDateTime, OutboundMailId DESC
}
- public void SetOutboundMailResolved (int outboundMailId)
+ public void SetOutboundMailResolved(int outboundMailId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -265,7 +271,7 @@ order by EndProcessDateTime, MailPriority, ReleaseDateTime, OutboundMailId DESC
}
}
- public void SetOutboundMailReadyForPickup (int outboundMailId)
+ public void SetOutboundMailReadyForPickup(int outboundMailId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -280,7 +286,7 @@ order by EndProcessDateTime, MailPriority, ReleaseDateTime, OutboundMailId DESC
}
}
- public void SetOutboundMailRecipientCount (int outboundMailId, int recipientCount)
+ public void SetOutboundMailRecipientCount(int outboundMailId, int recipientCount)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -296,7 +302,7 @@ order by EndProcessDateTime, MailPriority, ReleaseDateTime, OutboundMailId DESC
}
}
- public void IncrementOutboundMailSuccesses (int outboundMailId)
+ public void IncrementOutboundMailSuccesses(int outboundMailId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -311,7 +317,7 @@ order by EndProcessDateTime, MailPriority, ReleaseDateTime, OutboundMailId DESC
}
}
- public void IncrementOutboundMailFailures (int outboundMailId)
+ public void IncrementOutboundMailFailures(int outboundMailId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -327,10 +333,9 @@ order by EndProcessDateTime, MailPriority, ReleaseDateTime, OutboundMailId DESC
}
-
- public BasicOutboundMail[] GetDuplicateOutboundMail (MailAuthorType authorType, int authorPersonId, string title,
- string body, int mailPriority, int mailType, int geographyId,
- int organizationId, DateTime createDateTime, int recieverId)
+ public BasicOutboundMail[] GetDuplicateOutboundMail(MailAuthorType authorType, int authorPersonId, string title,
+ string body, int mailPriority, int mailType, int geographyId,
+ int organizationId, DateTime createDateTime, int recieverId)
{
List result = new List();
@@ -339,9 +344,10 @@ order by EndProcessDateTime, MailPriority, ReleaseDateTime, OutboundMailId DESC
connection.Open();
DbCommand command =
GetDbCommand(
- "SELECT " + outboundMailFieldSequence + @" INNER JOIN OutboundMailRecipients ON OutboundMailRecipients.OutboundMailId = OutboundMails.OutboundMailId
+ "SELECT " + outboundMailFieldSequence +
+ @" INNER JOIN OutboundMailRecipients ON OutboundMailRecipients.OutboundMailId = OutboundMails.OutboundMailId
WHERE (OutboundMailRecipients.PersonId = " + recieverId + @")
- AND (OutboundMails.AuthorType = " + (int)authorType + @")
+ AND (OutboundMails.AuthorType = " + (int) authorType + @")
AND (OutboundMails.AuthorPersonId = " + authorPersonId + @")
AND (OutboundMails.Title = '" + title + @"')
AND (OutboundMails.Body = '" + body + @"')
@@ -349,7 +355,8 @@ order by EndProcessDateTime, MailPriority, ReleaseDateTime, OutboundMailId DESC
AND (OutboundMails.MailType = " + mailType + @")
AND (OutboundMails.OrganizationId = " + organizationId + @")
AND (OutboundMails.GeographyId = " + geographyId + @")
- AND (OutboundMails.CreatedDateTime > TO_DATE('" + createDateTime.ToString("yyyy-MM-dd HH:mm:ss") + @"'))", connection);
+ AND (OutboundMails.CreatedDateTime > TO_DATE('" +
+ createDateTime.ToString("yyyy-MM-dd HH:mm:ss") + @"'))", connection);
command.CommandType = CommandType.Text;
@@ -362,7 +369,6 @@ order by EndProcessDateTime, MailPriority, ReleaseDateTime, OutboundMailId DESC
return result.ToArray();
}
-
}
}
}
diff --git a/Database/Database-PaperLetters.cs b/Database/Database-PaperLetters.cs
index a9cca43a..6e8c6449 100644
--- a/Database/Database-PaperLetters.cs
+++ b/Database/Database-PaperLetters.cs
@@ -11,7 +11,8 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
- public int CreatePaperLetter(int organizationId, string fromName, string replyAddress, DateTime receivedDate, int toPersonId, RoleType toPersonInRole, bool personal, int uploadedByPersonId)
+ public int CreatePaperLetter(int organizationId, string fromName, string replyAddress, DateTime receivedDate,
+ int toPersonId, RoleType toPersonInRole, bool personal, int uploadedByPersonId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -35,7 +36,6 @@ namespace Swarmops.Database
}
-
public BasicPaperLetter GetPaperLetter(int paperLetterId)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -44,7 +44,7 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT PaperLetterId,OrganizationId,FromName,ReplyAddress,ReceivedDate,ToPersonId,"+
+ "SELECT PaperLetterId,OrganizationId,FromName,ReplyAddress,ReceivedDate,ToPersonId," +
"ToPersonInRoleId,Personal,UploadedByPersonId,UploadedDateTime " +
"From PaperLetters WHERE PaperLetterId=" + paperLetterId + ";", connection);
@@ -88,7 +88,6 @@ namespace Swarmops.Database
}
-
public BasicPaperLetter[] GetPaperLettersForPerson(int personId)
{
List result = new List();
@@ -116,7 +115,6 @@ namespace Swarmops.Database
}
-
private BasicPaperLetter ReadPaperLetterFromDataReader(DbDataReader reader)
{
int paperLetterId = reader.GetInt32(0);
@@ -135,7 +133,6 @@ namespace Swarmops.Database
}
-
/*
public int CreateFinancialAccount(int pOrganizationId, string pName, FinancialAccountType pAccountType, int pParentFinancialAccountId)
{
diff --git a/Database/Database-ParleyAttendees.cs b/Database/Database-ParleyAttendees.cs
index 7c2ca039..0ff93010 100644
--- a/Database/Database-ParleyAttendees.cs
+++ b/Database/Database-ParleyAttendees.cs
@@ -8,12 +8,11 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
-
#region Database field reading
private const string parleyAttendeeFieldSequence =
" ParleyAttendeeId, ParleyId, PersonId, SignupDateTime, Active, " + // 0-4
- "CancelDateTime, Invoiced, OutboundInvoiceId, IsGuest" + // 5-8
+ "CancelDateTime, Invoiced, OutboundInvoiceId, IsGuest" + // 5-8
" FROM ParleyAttendees ";
private static BasicParleyAttendee ReadParleyAttendeeFromDataReader(IDataRecord reader)
@@ -29,16 +28,14 @@ namespace Swarmops.Database
int outboundInvoiceId = reader.GetInt32(7);
bool isGuest = reader.GetBoolean(8);
- return new BasicParleyAttendee (parleyAttendeeId, parleyId, personId, signupDateTime, active, cancelDateTime, invoiced, outboundInvoiceId, isGuest);
+ return new BasicParleyAttendee(parleyAttendeeId, parleyId, personId, signupDateTime, active, cancelDateTime,
+ invoiced, outboundInvoiceId, isGuest);
}
-
#endregion
-
#region Database record reading -- SELECT clauses
-
public BasicParleyAttendee GetParleyAttendee(int parleyAttendeeId)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -47,8 +44,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand("SELECT" + parleyAttendeeFieldSequence +
- "WHERE ParleyAttendeeId=" + parleyAttendeeId.ToString(),
- connection);
+ "WHERE ParleyAttendeeId=" + parleyAttendeeId,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -57,10 +54,9 @@ namespace Swarmops.Database
return ReadParleyAttendeeFromDataReader(reader);
}
- throw new ArgumentException("No such ParleyAttendeeId:" + parleyAttendeeId.ToString());
+ throw new ArgumentException("No such ParleyAttendeeId:" + parleyAttendeeId);
}
}
-
}
@@ -74,7 +70,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + parleyAttendeeFieldSequence + ConstructWhereClause("ParleyAttendees", conditions), connection);
+ "SELECT" + parleyAttendeeFieldSequence + ConstructWhereClause("ParleyAttendees", conditions),
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -99,7 +96,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT ParleyOptionId FROM ParleyAttendeeOptions WHERE ParleyAttendeeId=" + parleyAttendeeId.ToString(), connection);
+ "SELECT ParleyOptionId FROM ParleyAttendeeOptions WHERE ParleyAttendeeId=" + parleyAttendeeId,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -113,14 +111,11 @@ namespace Swarmops.Database
}
}
-
#endregion
-
#region Creation and manipulation -- stored procedures
-
- public int CreateParleyAttendee(int parleyId, int personId, bool isGuest) // ok
+ public int CreateParleyAttendee(int parleyId, int personId, bool isGuest) // ok
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -149,7 +144,8 @@ namespace Swarmops.Database
AddParameterWithName(command, "parleyAttendeeId", parleyAttendeeId);
AddParameterWithName(command, "active", active);
- AddParameterWithName(command, "cancelDateTime", DateTime.Now); // if active=false, set to cancellation time. if active=true, ignored
+ AddParameterWithName(command, "cancelDateTime", DateTime.Now);
+ // if active=false, set to cancellation time. if active=true, ignored
return Convert.ToInt32(command.ExecuteScalar());
}
@@ -189,7 +185,5 @@ namespace Swarmops.Database
}
#endregion
-
-
}
}
\ No newline at end of file
diff --git a/Database/Database-ParleyOptions.cs b/Database/Database-ParleyOptions.cs
index 368eee3a..51a6e641 100644
--- a/Database/Database-ParleyOptions.cs
+++ b/Database/Database-ParleyOptions.cs
@@ -8,11 +8,10 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
-
#region Database field reading
private const string parleyOptionFieldSequence =
- " ParleyId, ParleyOptionId, Description, AmountCents, Active" + // 0-4
+ " ParleyId, ParleyOptionId, Description, AmountCents, Active" + // 0-4
" FROM ParleyOptions ";
private static BasicParleyOption ReadParleyOptionFromDataReader(IDataRecord reader)
@@ -26,13 +25,10 @@ namespace Swarmops.Database
return new BasicParleyOption(parleyOptionId, parleyId, description, amountCents, active);
}
-
#endregion
-
#region Database record reading -- SELECT clauses
-
public BasicParleyOption GetParleyOption(int parleyOptionId)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -41,8 +37,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand("SELECT" + parleyOptionFieldSequence +
- "WHERE ParleyOptionId=" + parleyOptionId.ToString(),
- connection);
+ "WHERE ParleyOptionId=" + parleyOptionId,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -51,10 +47,9 @@ namespace Swarmops.Database
return ReadParleyOptionFromDataReader(reader);
}
- throw new ArgumentException("No such ParleyOptionId:" + parleyOptionId.ToString());
+ throw new ArgumentException("No such ParleyOptionId:" + parleyOptionId);
}
}
-
}
@@ -68,7 +63,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + parleyOptionFieldSequence + ConstructWhereClause("ParleyOptions", conditions), connection);
+ "SELECT" + parleyOptionFieldSequence + ConstructWhereClause("ParleyOptions", conditions),
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -82,13 +78,10 @@ namespace Swarmops.Database
}
}
-
#endregion
-
#region Creation and manipulation -- stored procedures
-
public int CreateParleyOption(int parleyId, string description, Int64 amountCents)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -123,7 +116,5 @@ namespace Swarmops.Database
}
#endregion
-
-
}
}
\ No newline at end of file
diff --git a/Database/Database-Parleys.cs b/Database/Database-Parleys.cs
index 02547bf3..8c410b18 100644
--- a/Database/Database-Parleys.cs
+++ b/Database/Database-Parleys.cs
@@ -8,17 +8,16 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
-
#region Database field reading
- private const string parleyFieldSequence =
- " ParleyId, OrganizationId, PersonId, BudgetId, CreatedDateTime, " + // 0-4
- "Open, Attested, Name, GeographyId, Description, " + // 5-9
+ private const string parleyFieldSequence =
+ " ParleyId, OrganizationId, PersonId, BudgetId, CreatedDateTime, " + // 0-4
+ "Open, Attested, Name, GeographyId, Description, " + // 5-9
"InformationUrl, StartDate, EndDate, BudgetCents, GuaranteeCents, " + // 10-14
- "AttendanceFeeCents, ClosedDateTime" + // 15-16
+ "AttendanceFeeCents, ClosedDateTime" + // 15-16
" FROM Parleys ";
- private static BasicParley ReadParleyFromDataReader (IDataRecord reader)
+ private static BasicParley ReadParleyFromDataReader(IDataRecord reader)
{
int parleyId = reader.GetInt32(0);
int organizationId = reader.GetInt32(1);
@@ -48,14 +47,11 @@ namespace Swarmops.Database
attendanceFeeCents, closedDateTime);
}
-
#endregion
-
#region Database record reading -- SELECT clauses
-
- public BasicParley GetParley (int parleyId)
+ public BasicParley GetParley(int parleyId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -63,8 +59,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand("SELECT" + parleyFieldSequence +
- "WHERE ParleyId=" + parleyId.ToString(),
- connection);
+ "WHERE ParleyId=" + parleyId,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -73,10 +69,9 @@ namespace Swarmops.Database
return ReadParleyFromDataReader(reader);
}
- throw new ArgumentException("No such ParleyId:" + parleyId.ToString());
+ throw new ArgumentException("No such ParleyId:" + parleyId);
}
}
-
}
@@ -104,14 +99,13 @@ namespace Swarmops.Database
}
}
-
#endregion
-
#region Creation and manipulation -- stored procedures
-
- public int CreateParley(int organizationId, int personId, int budgetId, string name, int geographyId, string description, string informationUrl, DateTime startDate, DateTime endDate, Int64 budgetCents, Int64 guaranteeCents, Int64 attendanceFeeCents)
+ public int CreateParley(int organizationId, int personId, int budgetId, string name, int geographyId,
+ string description, string informationUrl, DateTime startDate, DateTime endDate, Int64 budgetCents,
+ Int64 guaranteeCents, Int64 attendanceFeeCents)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -181,14 +175,12 @@ namespace Swarmops.Database
AddParameterWithName(command, "parleyId", parleyId);
AddParameterWithName(command, "open", open);
- AddParameterWithName(command, "closedDateTime", DateTime.Now); // ignored if open=true
+ AddParameterWithName(command, "closedDateTime", DateTime.Now); // ignored if open=true
return Convert.ToInt32(command.ExecuteScalar());
}
}
#endregion
-
-
}
}
\ No newline at end of file
diff --git a/Database/Database-PaymentCodes.cs b/Database/Database-PaymentCodes.cs
index 7487fc05..37d7e68c 100644
--- a/Database/Database-PaymentCodes.cs
+++ b/Database/Database-PaymentCodes.cs
@@ -7,7 +7,7 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
- public BasicPaymentCode GetPaymentCode (string paymentCode)
+ public BasicPaymentCode GetPaymentCode(string paymentCode)
{
using (DbConnection connection = GetSqlServerDbConnection())
{
@@ -31,7 +31,7 @@ namespace Swarmops.Database
}
- private BasicPaymentCode ReadPaymentCodeFromDataReader (DbDataReader reader)
+ private BasicPaymentCode ReadPaymentCodeFromDataReader(DbDataReader reader)
{
int issuedToPersonId = (int) reader["IssuedToPersonId"];
string issuedToPhoneNumber = (string) reader["IssuedToPhoneNumber"];
@@ -42,7 +42,7 @@ namespace Swarmops.Database
return new BasicPaymentCode(paymentCodeId, paymentCode, issuedToPhoneNumber, issuedToPersonId, claimed);
}
- public int CreatePaymentCode (string paymentCode, string issuingPhoneNumber, int issuingPersonId)
+ public int CreatePaymentCode(string paymentCode, string issuingPhoneNumber, int issuingPersonId)
{
using (DbConnection connection = GetSqlServerDbConnection())
{
@@ -60,7 +60,7 @@ namespace Swarmops.Database
}
- public int ClaimPaymentCode (int paymentCodeId, int claimingPersonId)
+ public int ClaimPaymentCode(int paymentCodeId, int claimingPersonId)
{
using (DbConnection connection = GetSqlServerDbConnection())
{
diff --git a/Database/Database-PaymentGroups.cs b/Database/Database-PaymentGroups.cs
index 69120283..d6e8181f 100644
--- a/Database/Database-PaymentGroups.cs
+++ b/Database/Database-PaymentGroups.cs
@@ -8,12 +8,11 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
-
#region Database field reading
private const string paymentGroupFieldSequence =
- " PaymentGroupId,OrganizationId,CurrencyId,AmountCents,DateTime," + // 0-4
- "Tag,CreatedDateTime,CreatedByPersonId,Open " + // 5-9
+ " PaymentGroupId,OrganizationId,CurrencyId,AmountCents,DateTime," + // 0-4
+ "Tag,CreatedDateTime,CreatedByPersonId,Open " + // 5-9
"FROM PaymentGroups ";
private static BasicPaymentGroup ReadPaymentGroupFromDataReader(IDataRecord reader)
@@ -29,15 +28,13 @@ namespace Swarmops.Database
bool open = reader.GetBoolean(8);
return new BasicPaymentGroup(paymentGroupId, organizationId, dateTime, currencyId, amountCents, tag,
- createdByPersonId, createdDateTime, open);
+ createdByPersonId, createdDateTime, open);
}
#endregion
-
#region Database record reading -- SELECT clauses
-
public BasicPaymentGroup GetPaymentGroupByTag(int organizationId, string tag)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -46,8 +43,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand("SELECT" + paymentGroupFieldSequence +
- "WHERE OrganizationId=" + organizationId.ToString() + " AND Tag='" + tag.Replace("'", "''") + "'",
- connection);
+ "WHERE OrganizationId=" + organizationId + " AND Tag='" + tag.Replace("'", "''") + "'",
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -59,7 +56,6 @@ namespace Swarmops.Database
return null;
}
}
-
}
@@ -71,8 +67,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand("SELECT" + paymentGroupFieldSequence +
- "WHERE PaymentGroupId=" + paymentGroupId.ToString(),
- connection);
+ "WHERE PaymentGroupId=" + paymentGroupId,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -81,14 +77,12 @@ namespace Swarmops.Database
return ReadPaymentGroupFromDataReader(reader);
}
- throw new ArgumentException("No such PaymentGroupId:" + paymentGroupId.ToString());
+ throw new ArgumentException("No such PaymentGroupId:" + paymentGroupId);
}
}
-
}
-
public BasicPaymentGroup[] GetPaymentGroups(params object[] conditions)
{
List result = new List();
@@ -99,7 +93,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + paymentGroupFieldSequence + ConstructWhereClause("PaymentGroups", conditions), connection);
+ "SELECT" + paymentGroupFieldSequence + ConstructWhereClause("PaymentGroups", conditions),
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -113,14 +108,12 @@ namespace Swarmops.Database
}
}
-
#endregion
-
#region Creation and manipulation -- stored procedures
-
- public int CreatePaymentGroup(int organizationId, DateTime dateTime, int currencyId, DateTime createdDateTime, int createdByPersonId)
+ public int CreatePaymentGroup(int organizationId, DateTime dateTime, int currencyId, DateTime createdDateTime,
+ int createdByPersonId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -207,9 +200,7 @@ namespace Swarmops.Database
}
}
-
#endregion
-
#region Dead template code
@@ -554,7 +545,5 @@ namespace Swarmops.Database
*/
#endregion
-
-
}
}
\ No newline at end of file
diff --git a/Database/Database-Payments.cs b/Database/Database-Payments.cs
index 9dfb7819..97cba898 100644
--- a/Database/Database-Payments.cs
+++ b/Database/Database-Payments.cs
@@ -8,14 +8,17 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
-
#region Database field reading
private const string paymentFieldSequence =
- " PaymentId,PaymentGroupId,AmountCents,Reference,FromAccount," + // 0-4
- "PaymentKey,HasImage,OutboundInvoiceId " + // 5-7
+ " PaymentId,PaymentGroupId,AmountCents,Reference,FromAccount," + // 0-4
+ "PaymentKey,HasImage,OutboundInvoiceId " + // 5-7
"FROM Payments ";
+ private const string paymentInformationFieldSequence =
+ " PaymentInformationId,PaymentId,PaymentInformationTypes.Name,Data " + // 0-4
+ " FROM PaymentInformation JOIN PaymentInformationTypes USING (PaymentInformationTypeId) ";
+
private static BasicPayment ReadPaymentFromDataReader(IDataRecord reader)
{
int paymentId = reader.GetInt32(0);
@@ -27,14 +30,11 @@ namespace Swarmops.Database
bool hasImage = reader.GetBoolean(6);
int outboundInvoiceId = reader.GetInt32(7);
- return new BasicPayment(paymentId, paymentGroupId, amountCents, reference, fromAccount, key, hasImage, outboundInvoiceId);
+ return new BasicPayment(paymentId, paymentGroupId, amountCents, reference, fromAccount, key, hasImage,
+ outboundInvoiceId);
}
- private const string paymentInformationFieldSequence =
- " PaymentInformationId,PaymentId,PaymentInformationTypes.Name,Data " + // 0-4
- " FROM PaymentInformation JOIN PaymentInformationTypes USING (PaymentInformationTypeId) ";
-
- private static BasicPaymentInformation ReadPaymentInformationFromDataReader (IDataRecord reader)
+ private static BasicPaymentInformation ReadPaymentInformationFromDataReader(IDataRecord reader)
{
string dataTypeString = reader.GetString(2);
string data = reader.GetString(3);
@@ -45,13 +45,10 @@ namespace Swarmops.Database
return new BasicPaymentInformation(dataType, data);
}
-
#endregion
-
#region Database record reading -- SELECT clauses
-
public BasicPayment GetPayment(int paymentId)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -60,8 +57,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand("SELECT" + paymentFieldSequence +
- "WHERE PaymentId=" + paymentId.ToString(),
- connection);
+ "WHERE PaymentId=" + paymentId,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -70,14 +67,12 @@ namespace Swarmops.Database
return ReadPaymentFromDataReader(reader);
}
- throw new ArgumentException("No such PaymentId:" + paymentId.ToString());
+ throw new ArgumentException("No such PaymentId:" + paymentId);
}
}
-
}
-
public BasicPayment[] GetPayments(params object[] conditions)
{
List result = new List();
@@ -113,7 +108,7 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + paymentInformationFieldSequence + " WHERE PaymentId=" + paymentId.ToString(), connection);
+ "SELECT" + paymentInformationFieldSequence + " WHERE PaymentId=" + paymentId, connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -127,14 +122,12 @@ namespace Swarmops.Database
}
}
-
#endregion
-
#region Creation and manipulation -- stored procedures
-
- public int CreatePayment(int paymentGroupId, double amount, string reference, string fromAccount, string key, bool hasImage, int outboundInvoiceId)
+ public int CreatePayment(int paymentGroupId, double amount, string reference, string fromAccount, string key,
+ bool hasImage, int outboundInvoiceId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -156,7 +149,8 @@ namespace Swarmops.Database
}
- public int CreatePayment(int paymentGroupId, Int64 amountCents, string reference, string fromAccount, string key, bool hasImage, int outboundInvoiceId)
+ public int CreatePayment(int paymentGroupId, Int64 amountCents, string reference, string fromAccount, string key,
+ bool hasImage, int outboundInvoiceId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -195,7 +189,7 @@ namespace Swarmops.Database
}
}
- [Obsolete ("This should never be called, ever: it ruins trackability.")]
+ [Obsolete("This should never be called, ever: it ruins trackability.")]
public void DeletePayment(int paymentId)
{
// This function is necessary since the Swedish bank system only allows for a dupe check AFTER all payments
@@ -217,10 +211,8 @@ namespace Swarmops.Database
}
}
-
#endregion
-
#region Dead template code
/*
@@ -564,7 +556,5 @@ namespace Swarmops.Database
*/
#endregion
-
-
}
}
\ No newline at end of file
diff --git a/Database/Database-Payouts.cs b/Database/Database-Payouts.cs
index 743d02c4..287a798b 100644
--- a/Database/Database-Payouts.cs
+++ b/Database/Database-Payouts.cs
@@ -12,15 +12,21 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
-
#region Database field reading
- private const string payoutFieldSequence =
- " PayoutId,OrganizationId,Bank,Account,Reference," + // 0-4
- "AmountCents,ExpectedTransactionDate,Open,CreatedDateTime,CreatedByPersonId " + // 5-9
+ private const string payoutFieldSequence =
+ " PayoutId,OrganizationId,Bank,Account,Reference," + // 0-4
+ "AmountCents,ExpectedTransactionDate,Open,CreatedDateTime,CreatedByPersonId " + // 5-9
"FROM Payouts ";
- private static BasicPayout ReadPayoutFromDataReader (IDataRecord reader)
+ private const string payoutDependencyFieldSequence =
+ " PayoutDependencies.PayoutId,FinancialDependencyTypes.Name,PayoutDependencies.ForeignId " + // 0-2
+ "FROM PayoutDependencies,FinancialDependencyTypes ";
+
+ private const string payoutDependencyTableJoin =
+ " FinancialDependencyTypes.FinancialDependencyTypeId=PayoutDependencies.FinancialDependencyTypeId ";
+
+ private static BasicPayout ReadPayoutFromDataReader(IDataRecord reader)
{
int payoutId = reader.GetInt32(0);
int organizationId = reader.GetInt32(1);
@@ -37,30 +43,22 @@ namespace Swarmops.Database
expectedTransactionDate, open, createdDateTime, createdByPersonId);
}
- private const string payoutDependencyFieldSequence =
- " PayoutDependencies.PayoutId,FinancialDependencyTypes.Name,PayoutDependencies.ForeignId " + // 0-2
- "FROM PayoutDependencies,FinancialDependencyTypes ";
-
- private const string payoutDependencyTableJoin =
- " FinancialDependencyTypes.FinancialDependencyTypeId=PayoutDependencies.FinancialDependencyTypeId ";
-
private static BasicFinancialDependency ReadPayoutDependencyFromDataReader(IDataRecord reader)
{
int payoutId = reader.GetInt32(0);
string financialDependencyTypeString = reader.GetString(1);
int foreignId = reader.GetInt32(2);
- return new BasicFinancialDependency(payoutId, (FinancialDependencyType) Enum.Parse(typeof (FinancialDependencyType), financialDependencyTypeString), foreignId);
+ return new BasicFinancialDependency(payoutId,
+ (FinancialDependencyType) Enum.Parse(typeof (FinancialDependencyType), financialDependencyTypeString),
+ foreignId);
}
-
#endregion
-
#region Database record reading -- SELECT clauses
-
- public BasicPayout GetPayout (int payoutId)
+ public BasicPayout GetPayout(int payoutId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -68,8 +66,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand("SELECT" + payoutFieldSequence +
- "WHERE PayoutId=" + payoutId.ToString(),
- connection);
+ "WHERE PayoutId=" + payoutId,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -78,10 +76,9 @@ namespace Swarmops.Database
return ReadPayoutFromDataReader(reader);
}
- throw new ArgumentException("No such PayoutId:" + payoutId.ToString());
+ throw new ArgumentException("No such PayoutId:" + payoutId);
}
}
-
}
@@ -95,8 +92,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand("SELECT" + payoutDependencyFieldSequence +
- "WHERE PayoutDependencies.PayoutId=" + payoutId.ToString() + " AND " + payoutDependencyTableJoin,
- connection);
+ "WHERE PayoutDependencies.PayoutId=" + payoutId + " AND " + payoutDependencyTableJoin,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -124,10 +121,12 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand("SELECT" + payoutDependencyFieldSequence +
- "WHERE PayoutDependencies.ForeignId=" + foreignObjectId.ToString(CultureInfo.InvariantCulture) +
- " AND FinancialDependencyTypes.Name='" + financialDependencyTypeName + "'" + // enum - no sanitation necessary
- " AND " + payoutDependencyTableJoin,
- connection);
+ "WHERE PayoutDependencies.ForeignId=" +
+ foreignObjectId.ToString(CultureInfo.InvariantCulture) +
+ " AND FinancialDependencyTypes.Name='" + financialDependencyTypeName + "'" +
+ // enum - no sanitation necessary
+ " AND " + payoutDependencyTableJoin,
+ connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -135,10 +134,7 @@ namespace Swarmops.Database
{
return reader.GetInt32(0);
}
- else
- {
- return 0;
- }
+ return 0;
}
}
}
@@ -174,13 +170,10 @@ namespace Swarmops.Database
}
}
-
#endregion
-
#region Creation and manipulation -- stored procedures
-
public int CreatePayout(int organizationId, string bank, string account, string reference,
double amount, DateTime expectedTransactionDate, int createdByPersonId)
{
@@ -314,7 +307,6 @@ namespace Swarmops.Database
}
-
public void SetPayoutAmount(int payoutId, Int64 amountCents)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -348,10 +340,8 @@ namespace Swarmops.Database
}
}
-
#endregion
-
#region Dead template code
/*
@@ -695,7 +685,5 @@ namespace Swarmops.Database
*/
#endregion
-
-
}
}
\ No newline at end of file
diff --git a/Database/Database-Payroll.cs b/Database/Database-Payroll.cs
index 89e9bb07..c1f22336 100644
--- a/Database/Database-Payroll.cs
+++ b/Database/Database-Payroll.cs
@@ -11,9 +11,9 @@ namespace Swarmops.Database
#region Field reading code
private const string payrollFieldSequence =
- " PayrollItemId,PersonId,OrganizationId,CountryId,EmployedDate," + // 0-4
- "ReportsToPersonId,BaseSalaryCents,BudgetId,Open,TerminatedDate," + // 5-9
- "SubtractiveTaxLevelId,AdditiveTaxLevel " + // 10-11
+ " PayrollItemId,PersonId,OrganizationId,CountryId,EmployedDate," + // 0-4
+ "ReportsToPersonId,BaseSalaryCents,BudgetId,Open,TerminatedDate," + // 5-9
+ "SubtractiveTaxLevelId,AdditiveTaxLevel " + // 10-11
"FROM Payroll ";
private BasicPayrollItem ReadPayrollItemFromDataReader(DbDataReader reader)
@@ -32,14 +32,12 @@ namespace Swarmops.Database
double additiveTaxLevel = reader.GetDouble(11);
return new BasicPayrollItem(payrollItemId, personId, organizationId, countryId, employedDate,
- reportsToPersonId, baseSalaryCents, budgetId, open, terminatedDate, subtractiveTaxLevelId, additiveTaxLevel);
-
+ reportsToPersonId, baseSalaryCents, budgetId, open, terminatedDate, subtractiveTaxLevelId,
+ additiveTaxLevel);
}
#endregion
-
-
#region Record reading - SELECT statements
public BasicPayrollItem GetPayrollItem(int payrollItemId)
@@ -65,11 +63,14 @@ namespace Swarmops.Database
}
///
- /// Gets payroll.
+ /// Gets payroll.
///
- /// An optional combination of a Person and/or Organization object and/or DatabaseCondition specifiers.
+ ///
+ /// An optional combination of a Person and/or Organization object and/or DatabaseCondition
+ /// specifiers.
+ ///
/// The list of matching payroll items.
- public BasicPayrollItem[] GetPayroll (params object[] conditions)
+ public BasicPayrollItem[] GetPayroll(params object[] conditions)
{
List result = new List();
@@ -93,14 +94,12 @@ namespace Swarmops.Database
}
}
-
#endregion
-
-
#region Creation and manipulation - stored procedures
- public int CreatePayrollItem(int personId, int organizationId, DateTime employedDate, int reportsToPersonId, int countryId,
+ public int CreatePayrollItem(int personId, int organizationId, DateTime employedDate, int reportsToPersonId,
+ int countryId,
Int64 baseSalaryCents, int subtractiveTaxLevelId, double additiveTaxLevel, int budgetId)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -142,7 +141,6 @@ namespace Swarmops.Database
}
-
public void SetPayrollItemTerminatedDate(int payrollItemId, DateTime dateTimeTerminated)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -160,7 +158,6 @@ namespace Swarmops.Database
}
-
public void SetPayrollItemBaseSalary(int payrollItemId, Int64 baseSalaryCents)
{
using (DbConnection connection = GetMySqlDbConnection())
@@ -177,16 +174,10 @@ namespace Swarmops.Database
}
}
-
-
#endregion
-
-
-
#region Dead template code
-
/*
public int CreateFinancialAccount(int pOrganizationId, string pName, FinancialAccountType pAccountType, int pParentFinancialAccountId)
{
diff --git a/Database/Database-PayrollAdjustments.cs b/Database/Database-PayrollAdjustments.cs
index e2064184..42823f54 100644
--- a/Database/Database-PayrollAdjustments.cs
+++ b/Database/Database-PayrollAdjustments.cs
@@ -11,8 +11,8 @@ namespace Swarmops.Database
#region Field reading code
private const string payrollAdjustmentFieldSequence =
- " PayrollAdjustmentId,PayrollAdjustmentTypeId,PayrollItemId,AmountCents,Description," + // 0-4
- "Open,SalaryId " + // 5-6
+ " PayrollAdjustmentId,PayrollAdjustmentTypeId,PayrollItemId,AmountCents,Description," + // 0-4
+ "Open,SalaryId " + // 5-6
"FROM PayrollAdjustments ";
private BasicPayrollAdjustment ReadPayrollAdjustmentFromDataReader(DbDataReader reader)
@@ -26,17 +26,15 @@ namespace Swarmops.Database
int salaryId = reader.GetInt32(6);
return new BasicPayrollAdjustment(payrollAdjustmentId, payrollItemId,
- (PayrollAdjustmentType) payrollAdjustmentTypeId,
- amountCents, description, open, salaryId);
+ (PayrollAdjustmentType) payrollAdjustmentTypeId,
+ amountCents, description, open, salaryId);
}
#endregion
-
-
#region Record reading - SELECT statements
- public BasicPayrollAdjustment GetPayrollAdjustment (int payrollAdjustmentId)
+ public BasicPayrollAdjustment GetPayrollAdjustment(int payrollAdjustmentId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
@@ -44,7 +42,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + payrollAdjustmentFieldSequence + "WHERE PayrollAdjustmentId=" + payrollAdjustmentId + ";", connection);
+ "SELECT" + payrollAdjustmentFieldSequence + "WHERE PayrollAdjustmentId=" + payrollAdjustmentId +
+ ";", connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -59,9 +58,12 @@ namespace Swarmops.Database
}
///
- /// Gets payroll.
+ /// Gets payroll.
///
- /// An optional combination of a Person and/or Organization object and/or DatabaseCondition specifiers.
+ ///
+ /// An optional combination of a Person and/or Organization object and/or DatabaseCondition
+ /// specifiers.
+ ///
/// The list of matching payroll items.
public BasicPayrollAdjustment[] GetPayrollAdjustments(params object[] conditions)
{
@@ -73,7 +75,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT" + payrollAdjustmentFieldSequence + ConstructWhereClause("PayrollAdjustments", conditions), connection);
+ "SELECT" + payrollAdjustmentFieldSequence +
+ ConstructWhereClause("PayrollAdjustments", conditions), connection);
using (DbDataReader reader = command.ExecuteReader())
{
@@ -87,14 +90,12 @@ namespace Swarmops.Database
}
}
-
#endregion
-
-
#region Creation and manipulation - stored procedures
- public int CreatePayrollAdjustment(int payrollItemId, PayrollAdjustmentType type, double amount, string description)
+ public int CreatePayrollAdjustment(int payrollItemId, PayrollAdjustmentType type, double amount,
+ string description)
{
if (description.Length > 128)
{
@@ -109,7 +110,7 @@ namespace Swarmops.Database
command.CommandType = CommandType.StoredProcedure;
AddParameterWithName(command, "payrollItemId", payrollItemId);
- AddParameterWithName(command, "payrollAdjustmentTypeId", (int)type);
+ AddParameterWithName(command, "payrollAdjustmentTypeId", (int) type);
AddParameterWithName(command, "amount", amount);
AddParameterWithName(command, "description", description);
@@ -118,7 +119,8 @@ namespace Swarmops.Database
}
- public int CreatePayrollAdjustment(int payrollItemId, PayrollAdjustmentType type, Int64 amountCents, string description)
+ public int CreatePayrollAdjustment(int payrollItemId, PayrollAdjustmentType type, Int64 amountCents,
+ string description)
{
if (description.Length > 128)
{
@@ -133,7 +135,7 @@ namespace Swarmops.Database
command.CommandType = CommandType.StoredProcedure;
AddParameterWithName(command, "payrollItemId", payrollItemId);
- AddParameterWithName(command, "payrollAdjustmentTypeId", (int)type);
+ AddParameterWithName(command, "payrollAdjustmentTypeId", (int) type);
AddParameterWithName(command, "amountCents", amountCents);
AddParameterWithName(command, "description", description);
@@ -158,16 +160,10 @@ namespace Swarmops.Database
}
}
-
-
#endregion
-
-
-
#region Dead template code
-
/*
public int CreateFinancialAccount(int pOrganizationId, string pName, FinancialAccountType pAccountType, int pParentFinancialAccountId)
{
diff --git a/Database/Database-People.cs b/Database/Database-People.cs
index 6a19bc84..88a54994 100644
--- a/Database/Database-People.cs
+++ b/Database/Database-People.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
+using System.Diagnostics;
using Swarmops.Basic.Enums;
using Swarmops.Basic.Types;
@@ -17,7 +18,7 @@ namespace Swarmops.Database
" Birthdate, GenderId " + // 10-11
" FROM People ";
- private static BasicPerson ReadPersonFromDataReader (DbDataReader reader)
+ private static BasicPerson ReadPersonFromDataReader(DbDataReader reader)
{
int personId = reader.GetInt32(0);
string passwordHash = reader.GetString(1);
@@ -45,16 +46,14 @@ namespace Swarmops.Database
return new BasicPerson(personId, passwordHash, name, email, street, postalCode, cityName, countryId, phone,
- geographyId, birthdate, (PersonGender)genderId);
+ geographyId, birthdate, (PersonGender) genderId);
}
#endregion
-
-
#region Retrieving lists of people based on wildcards or partial data
- public BasicPerson[] GetPeopleFromNamePattern (string namePattern)
+ public BasicPerson[] GetPeopleFromNamePattern(string namePattern)
{
List result = new List();
@@ -64,7 +63,8 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand(
- "SELECT " + personFieldSequence + " WHERE Name like '" + GetSqlPatternFromNamePattern(namePattern).Replace("'", "''") + "'",
+ "SELECT " + personFieldSequence + " WHERE Name like '" +
+ GetSqlPatternFromNamePattern(namePattern).Replace("'", "''") + "'",
connection);
command.CommandTimeout = 120;
@@ -105,7 +105,7 @@ namespace Swarmops.Database
return string.Empty; // If no valid search string was supplied
}
- public BasicPerson[] GetPeopleFromBirthdate (DateTime fromdate, DateTime todate)
+ public BasicPerson[] GetPeopleFromBirthdate(DateTime fromdate, DateTime todate)
{
// Is this really valid for MySQL? Yes .net connector makes @parameter substitutions
@@ -137,7 +137,7 @@ namespace Swarmops.Database
return result.ToArray();
}
- public BasicPerson[] GetPeopleFromEmailPattern (string emailPattern)
+ public BasicPerson[] GetPeopleFromEmailPattern(string emailPattern)
{
List result = new List