diff --git a/Backend/OneOffs.cs b/Backend/OneOffs.cs index 95b1e657..df52d63d 100644 --- a/Backend/OneOffs.cs +++ b/Backend/OneOffs.cs @@ -322,7 +322,7 @@ namespace Swarmops.Backend foreach (BasicAutoMail autoMail in allAutoMails) { - int id = PirateDb.GetDatabaseForWriting().SetAutoMail(autoMail); + int id = SwarmDb.GetDatabaseForWriting().SetAutoMail(autoMail); Organization org = null; @@ -563,7 +563,7 @@ namespace Swarmops.Backend Console.Write("Member count PPSE, Memberships method... "); Console.WriteLine(Organization.PPSE.GetMemberships().Count); Console.Write("Member count PPSE, direct person count... "); - Console.WriteLine(PirateDb.GetDatabaseForReading().GetMembersForOrganizations(new int[] {1}).Length); + Console.WriteLine(SwarmDb.GetDatabaseForReading().GetMembersForOrganizations(new int[] {1}).Length); Console.Write("Newsletter recipient count... "); Console.WriteLine(People.FromNewsletterFeed(NewsletterFeed.TypeID.ChairmanBlog).Count); @@ -573,7 +573,7 @@ namespace Swarmops.Backend Console.Write("Membership count UPSE, count method... "); Console.WriteLine(Organization.FromIdentity(Organization.UPSEid).GetTree().GetMembershipCount()); Console.Write("Member count UPSE, direct person count... "); - Console.WriteLine(PirateDb.GetDatabaseForReading().GetMembersForOrganizations(Organization.FromIdentity(Organization.UPSEid).GetTree().Identities).Length); + Console.WriteLine(SwarmDb.GetDatabaseForReading().GetMembersForOrganizations(Organization.FromIdentity(Organization.UPSEid).GetTree().Identities).Length); Console.Write("Members expiring in next ten days..."); diff --git a/Console/Console.cs b/Console/Console.cs index 5329bed8..13d7e7b2 100644 --- a/Console/Console.cs +++ b/Console/Console.cs @@ -1179,7 +1179,7 @@ namespace Swarmops static void PopulateCountries() { - PirateDb database = PirateDb.GetDatabase(); + SwarmDb database = SwarmDb.GetDatabase(); using (StreamReader reader = new StreamReader("C:\\Countries.txt")) { @@ -1290,7 +1290,7 @@ namespace Swarmops static void SendNewsletter() { - PirateDb database = PirateDb.GetDatabase(); + SwarmDb database = SwarmDb.GetDatabase(); int[] subscriberIds = database.GetSubscribersForNewsletterFeed(2); People subscribers = People.FromIdentities(subscriberIds); @@ -1307,7 +1307,7 @@ namespace Swarmops static void ImportReporters() { string fileName = @"C:\Documents and Settings\rick\Desktop\reportrar.txt"; - PirateDb database = PirateDb.GetDatabase(); + SwarmDb database = SwarmDb.GetDatabase(); using (StreamReader reader = new StreamReader(fileName, Encoding.Default)) { @@ -1741,7 +1741,7 @@ namespace Swarmops int geoId = Int32.Parse(parts[0]); string designation = parts[1].Trim(); - PirateDb.GetDatabaseForWriting().CreateGeographyOfficialDesignation(geoId, GeographyLevel.Municipality, 1, designation); + SwarmDb.GetDatabaseForWriting().CreateGeographyOfficialDesignation(geoId, GeographyLevel.Municipality, 1, designation); line = reader.ReadLine(); } } diff --git a/Database/Configuration.cs b/Database/Configuration.cs index 4ce242e3..23836400 100644 --- a/Database/Configuration.cs +++ b/Database/Configuration.cs @@ -8,7 +8,7 @@ using System.Xml.Serialization; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { // This class is in horrible need of serious refactoring. For its simplicity in task, it's a horrible bowl of spaghetti. diff --git a/Database/Database-Activists.cs b/Database/Database-Activists.cs index bfbb7f75..c61b7821 100644 --- a/Database/Database-Activists.cs +++ b/Database/Database-Activists.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Enums; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { public int[] GetActivistPersonIds (int[] geographyIds) { diff --git a/Database/Database-AutoMails.cs b/Database/Database-AutoMails.cs index 6d40694b..0ec68ca6 100644 --- a/Database/Database-AutoMails.cs +++ b/Database/Database-AutoMails.cs @@ -7,7 +7,7 @@ using Swarmops.Basic.Types.Communications; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { public BasicAutoMail[] GetAllAutoMailsForMigration() { diff --git a/Database/Database-Ballots.cs b/Database/Database-Ballots.cs index 314850f5..9b6b6353 100644 --- a/Database/Database-Ballots.cs +++ b/Database/Database-Ballots.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-CashAdvances.cs b/Database/Database-CashAdvances.cs index 9cb27562..7db49c35 100644 --- a/Database/Database-CashAdvances.cs +++ b/Database/Database-CashAdvances.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types.Financial; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Database field reading diff --git a/Database/Database-ChurnData.cs b/Database/Database-ChurnData.cs index fb618304..29b5fc01 100644 --- a/Database/Database-ChurnData.cs +++ b/Database/Database-ChurnData.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-CommunicationTurnarounds.cs b/Database/Database-CommunicationTurnarounds.cs index 296410f8..5e279536 100644 --- a/Database/Database-CommunicationTurnarounds.cs +++ b/Database/Database-CommunicationTurnarounds.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-Conditions.cs b/Database/Database-Conditions.cs index 12fe3eef..529c59ce 100644 --- a/Database/Database-Conditions.cs +++ b/Database/Database-Conditions.cs @@ -6,7 +6,7 @@ using Swarmops.Database.Attributes; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { /// /// Constructs a WHERE clause for a table. diff --git a/Database/Database-ConnectionsCommands.cs b/Database/Database-ConnectionsCommands.cs index e9e47d3e..5decb80d 100644 --- a/Database/Database-ConnectionsCommands.cs +++ b/Database/Database-ConnectionsCommands.cs @@ -10,7 +10,7 @@ using System.Configuration; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { public DbConnection GetSqlServerDbConnection() // Temporarily public for migratory purposes { diff --git a/Database/Database-Constructors.cs b/Database/Database-Constructors.cs index 5b4a09ff..6999021b 100644 --- a/Database/Database-Constructors.cs +++ b/Database/Database-Constructors.cs @@ -13,21 +13,21 @@ namespace Swarmops.Database /// /// A generic database handler /// - public partial class PirateDb + public partial class SwarmDb { - public static PirateDb GetDatabaseForReading() + public static SwarmDb GetDatabaseForReading() { - return new PirateDb(ConstructConnectString(new Configuration().Get().Read)); + return new SwarmDb(ConstructConnectString(new Configuration().Get().Read)); } - public static PirateDb GetDatabaseForWriting() + public static SwarmDb GetDatabaseForWriting() { - return new PirateDb(ConstructConnectString(new Configuration().Get().Write)); + return new SwarmDb(ConstructConnectString(new Configuration().Get().Write)); } - public static PirateDb GetDatabaseForAdmin() + public static SwarmDb GetDatabaseForAdmin() { - return new PirateDb(ConstructConnectString(new Configuration().Get().Admin)); + return new SwarmDb(ConstructConnectString(new Configuration().Get().Admin)); } private static string ConstructConnectString (Credentials credentials) @@ -37,8 +37,8 @@ namespace Swarmops.Database } - [Obsolete ("Do not use. Use PirateDb.GetDatabaseForReading(), ...ForWriting() or ...ForAdmin().", true)] - public static PirateDb GetDatabase() + [Obsolete ("Do not use. Use SwarmDb.GetDatabaseForReading(), ...ForWriting() or ...ForAdmin().", true)] + public static SwarmDb GetDatabase() { // First, check if a previous invocation has put anything in the cashe. string connectionString = _cachedConnectionString; @@ -49,7 +49,7 @@ namespace Swarmops.Database connectionString = ConfigurationManager.ConnectionStrings["Activizr"].ConnectionString; Logging.LogInformation(LogSource.PirateDb, - "PirateDb initialized from Config ConnectionString: [" + connectionString + + "SwarmDb initialized from Config ConnectionString: [" + connectionString + "]"); } @@ -67,7 +67,7 @@ namespace Swarmops.Database connectionString = reader.ReadLine(); Logging.LogInformation(LogSource.PirateDb, - "PirateDb initialized for Linux: [" + connectionString + "]"); + "SwarmDb initialized for Linux: [" + connectionString + "]"); } } else if (HttpContext.Current != null) @@ -79,7 +79,7 @@ namespace Swarmops.Database connectionString = reader.ReadLine(); Logging.LogInformation(LogSource.PirateDb, - "PirateDb initialized for web: [" + connectionString + "]"); + "SwarmDb initialized for web: [" + connectionString + "]"); } } @@ -92,7 +92,7 @@ namespace Swarmops.Database connectionString = reader.ReadLine(); Logging.LogInformation(LogSource.PirateDb, - "PirateDb initialized for application: [" + connectionString + + "SwarmDb initialized for application: [" + connectionString + "]"); } } @@ -131,23 +131,23 @@ namespace Swarmops.Database _cachedConnectionString = connectionString; } - PirateDb db = null; + SwarmDb db = null; try { - db = new PirateDb(DbProviderFactories.GetFactory(DefaultProviderName), connectionString); + db = new SwarmDb(DbProviderFactories.GetFactory(DefaultProviderName), connectionString); } catch (Exception e) { throw new Exception( - "Unable to initalize PirateDb using connection string \"" + connectionString + "\"", e); // TODO: REMOVE ON PRODUCTION -- CREDENTIALS LEAKAGE + "Unable to initalize SwarmDb using connection string \"" + connectionString + "\"", e); // TODO: REMOVE ON PRODUCTION -- CREDENTIALS LEAKAGE } return db; } [Obsolete ("Do not use. Use GetDatabaseForAdmin().", true)] - public static PirateDb GetDatabaseAsAdmin() + public static SwarmDb GetDatabaseAsAdmin() { string connectionString = string.Empty; @@ -162,7 +162,7 @@ namespace Swarmops.Database connectionString = reader.ReadLine(); Logging.LogInformation(LogSource.PirateDb, - "PirateDb initialized for Linux Backend: [" + connectionString + "]"); + "SwarmDb initialized for Linux Backend: [" + connectionString + "]"); } } else if (HttpContext.Current != null) @@ -174,7 +174,7 @@ namespace Swarmops.Database connectionString = reader.ReadLine(); Logging.LogInformation(LogSource.PirateDb, - "PirateDb initialized for web: [" + connectionString + "]"); + "SwarmDb initialized for web: [" + connectionString + "]"); } } @@ -187,7 +187,7 @@ namespace Swarmops.Database connectionString = reader.ReadLine(); Logging.LogInformation(LogSource.PirateDb, - "PirateDb initialized for application: [" + connectionString + + "SwarmDb initialized for application: [" + connectionString + "]"); } } @@ -225,17 +225,17 @@ namespace Swarmops.Database _cachedConnectionString = connectionString; } - return new PirateDb(DbProviderFactories.GetFactory(DefaultProviderName), connectionString); + return new SwarmDb(DbProviderFactories.GetFactory(DefaultProviderName), connectionString); } [Obsolete ("Do not use. Hardwireto MySQL.")] - public PirateDb(DbProviderFactory ProviderFactory, string ConnectionString) + public SwarmDb(DbProviderFactory ProviderFactory, string ConnectionString) { this.ProviderFactory = ProviderFactory; this.ConnectionString = ConnectionString; } - public PirateDb(string connectionString) + public SwarmDb(string connectionString) { this.ConnectionString = connectionString; } diff --git a/Database/Database-Countries.cs b/Database/Database-Countries.cs index d2ad06d3..be78b896 100644 --- a/Database/Database-Countries.cs +++ b/Database/Database-Countries.cs @@ -8,7 +8,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-Currencies.cs b/Database/Database-Currencies.cs index 449cc10c..f077398f 100644 --- a/Database/Database-Currencies.cs +++ b/Database/Database-Currencies.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-Documents.cs b/Database/Database-Documents.cs index c99ce603..58bfb88e 100644 --- a/Database/Database-Documents.cs +++ b/Database/Database-Documents.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { public BasicDocument GetDocument(int documentId) { diff --git a/Database/Database-Events.cs b/Database/Database-Events.cs index 5dc9f9dd..fb6e296f 100644 --- a/Database/Database-Events.cs +++ b/Database/Database-Events.cs @@ -7,7 +7,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-ExceptionLog.cs b/Database/Database-ExceptionLog.cs index 99f4cd27..1d21c22d 100644 --- a/Database/Database-ExceptionLog.cs +++ b/Database/Database-ExceptionLog.cs @@ -8,7 +8,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { private const string exceptionLogFieldSequence = " ExceptionID, ExceptionDateTime, Source,ExceptionText FROM ExceptionLog "; diff --git a/Database/Database-Expenses.cs b/Database/Database-Expenses.cs index c4ba7d29..182b1cd3 100644 --- a/Database/Database-Expenses.cs +++ b/Database/Database-Expenses.cs @@ -8,7 +8,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { public BasicExpenseClaim GetExpenseClaim (int expenseClaimId) { diff --git a/Database/Database-ExternalActivities.cs b/Database/Database-ExternalActivities.cs index cb0122a3..ab459b75 100644 --- a/Database/Database-ExternalActivities.cs +++ b/Database/Database-ExternalActivities.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-ExternalCredentials.cs b/Database/Database-ExternalCredentials.cs index 749ae3be..b6879297 100644 --- a/Database/Database-ExternalCredentials.cs +++ b/Database/Database-ExternalCredentials.cs @@ -4,7 +4,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { public BasicExternalCredential GetExternalCredential (string serviceName) { diff --git a/Database/Database-ExternalIdentities.cs b/Database/Database-ExternalIdentities.cs index 548f1363..40c92236 100644 --- a/Database/Database-ExternalIdentities.cs +++ b/Database/Database-ExternalIdentities.cs @@ -7,7 +7,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { private const string readFieldsSQL = @" ExternalIdentityIdentity, ExternalIdentityTypeName, ExternalSystem, UserID, `Password`, AttachedToPerson diff --git a/Database/Database-FinancialValidations.cs b/Database/Database-FinancialValidations.cs index c58084a4..c0e5df36 100644 --- a/Database/Database-FinancialValidations.cs +++ b/Database/Database-FinancialValidations.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-Financials.cs b/Database/Database-Financials.cs index eb26a69d..668e16f2 100644 --- a/Database/Database-Financials.cs +++ b/Database/Database-Financials.cs @@ -10,7 +10,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { public int CreateFinancialAccount (int pOrganizationId, string pName, FinancialAccountType pAccountType, int pParentFinancialAccountId) { diff --git a/Database/Database-FlatData.cs b/Database/Database-FlatData.cs index 2f1ef14b..971372ce 100644 --- a/Database/Database-FlatData.cs +++ b/Database/Database-FlatData.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Enums; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { public string GetKeyValue (string key) { diff --git a/Database/Database-Geographies.cs b/Database/Database-Geographies.cs index 4bfafb2c..f6c682e9 100644 --- a/Database/Database-Geographies.cs +++ b/Database/Database-Geographies.cs @@ -7,7 +7,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-InboundInvoices.cs b/Database/Database-InboundInvoices.cs index f3d2d762..9555b343 100644 --- a/Database/Database-InboundInvoices.cs +++ b/Database/Database-InboundInvoices.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-Initialization.cs b/Database/Database-Initialization.cs index 0ee01d7b..821dfcf4 100644 --- a/Database/Database-Initialization.cs +++ b/Database/Database-Initialization.cs @@ -8,7 +8,7 @@ using System.Text; namespace Swarmops.Database { - partial class PirateDb + partial class SwarmDb { // These functions are bloody dangerous, mmmkay? diff --git a/Database/Database-InternalPollCandidates.cs b/Database/Database-InternalPollCandidates.cs index dabce231..01be350d 100644 --- a/Database/Database-InternalPollCandidates.cs +++ b/Database/Database-InternalPollCandidates.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-InternalPollVotes.cs b/Database/Database-InternalPollVotes.cs index 7d0bd111..6e207eb4 100644 --- a/Database/Database-InternalPollVotes.cs +++ b/Database/Database-InternalPollVotes.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-InternalPolls.cs b/Database/Database-InternalPolls.cs index 36051bf5..4ef4e0a8 100644 --- a/Database/Database-InternalPolls.cs +++ b/Database/Database-InternalPolls.cs @@ -7,7 +7,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-MailTemplates.cs b/Database/Database-MailTemplates.cs index 380bff46..4c56d298 100644 --- a/Database/Database-MailTemplates.cs +++ b/Database/Database-MailTemplates.cs @@ -7,7 +7,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { public BasicMailTemplate[] GetMailTemplatesByName (string templatename) { diff --git a/Database/Database-Media.cs b/Database/Database-Media.cs index f0294f47..8889a71a 100644 --- a/Database/Database-Media.cs +++ b/Database/Database-Media.cs @@ -8,7 +8,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { public int CreateMediaEntryFromKeyword (string keyword, string mediaName, bool isBlog, string url, string title, DateTime dateTime) diff --git a/Database/Database-Meetings.cs b/Database/Database-Meetings.cs index e49abab2..ce18296b 100644 --- a/Database/Database-Meetings.cs +++ b/Database/Database-Meetings.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types.Governance; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-Memberships.cs b/Database/Database-Memberships.cs index a9aba7cf..fec03f15 100644 --- a/Database/Database-Memberships.cs +++ b/Database/Database-Memberships.cs @@ -8,7 +8,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { /* public int[] GetMembersForOrganization (int organizationId) diff --git a/Database/Database-MotionAmendments.cs b/Database/Database-MotionAmendments.cs index eafa1d97..2cc90cd9 100644 --- a/Database/Database-MotionAmendments.cs +++ b/Database/Database-MotionAmendments.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types.Governance; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-Motions.cs b/Database/Database-Motions.cs index 6fd8fe75..6aec1cab 100644 --- a/Database/Database-Motions.cs +++ b/Database/Database-Motions.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types.Governance; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-Newsletters.cs b/Database/Database-Newsletters.cs index 7d136299..49c834e1 100644 --- a/Database/Database-Newsletters.cs +++ b/Database/Database-Newsletters.cs @@ -6,7 +6,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { /// /// Gets all subscribed people for a certain newsletter. diff --git a/Database/Database-Optimizations.cs b/Database/Database-Optimizations.cs index efe6b76e..24b15cf8 100644 --- a/Database/Database-Optimizations.cs +++ b/Database/Database-Optimizations.cs @@ -11,7 +11,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { /// /// Optimization function. diff --git a/Database/Database-OptionalData.cs b/Database/Database-OptionalData.cs index 71e80eb8..49388455 100644 --- a/Database/Database-OptionalData.cs +++ b/Database/Database-OptionalData.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { private const string objectOptionalDataFieldSequence = " ObjectTypes.Name AS ObjectType,ObjectOptionalData.ObjectId,ObjectOptionalDataTypes.Name AS ObjectOptionalDataType,ObjectOptionalData.Data FROM ObjectOptionalData " + diff --git a/Database/Database-OrganizationFinancialAccounts.cs b/Database/Database-OrganizationFinancialAccounts.cs index 7e872d0a..35bb93c6 100644 --- a/Database/Database-OrganizationFinancialAccounts.cs +++ b/Database/Database-OrganizationFinancialAccounts.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { private const string organizationFinancialAccountsDataFieldSequence = " OrganizationFinancialAccountTypes.Name AS OrganizationFinancialAccountType,OrganizationFinancialAccounts.OrganizationId,OrganizationFinancialAccounts.FinancialAccountId FROM OrganizationFinancialAccounts " + diff --git a/Database/Database-Organizations.cs b/Database/Database-Organizations.cs index 6c0d0660..100f644f 100644 --- a/Database/Database-Organizations.cs +++ b/Database/Database-Organizations.cs @@ -6,7 +6,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-OutboundInvoices.cs b/Database/Database-OutboundInvoices.cs index 9df788fd..bef5300d 100644 --- a/Database/Database-OutboundInvoices.cs +++ b/Database/Database-OutboundInvoices.cs @@ -8,7 +8,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-OutboundMailRecipients.cs b/Database/Database-OutboundMailRecipients.cs index a839a45d..229a0d91 100644 --- a/Database/Database-OutboundMailRecipients.cs +++ b/Database/Database-OutboundMailRecipients.cs @@ -7,7 +7,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { private const string outboundMailRecipientFieldSequence = " OutboundMailRecipientId,OutboundMailId,PersonId,AsOfficer,PersonType" + // 0-4 diff --git a/Database/Database-OutboundMails.cs b/Database/Database-OutboundMails.cs index 853fd2a7..a323c34d 100644 --- a/Database/Database-OutboundMails.cs +++ b/Database/Database-OutboundMails.cs @@ -7,7 +7,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { private const string outboundMailFieldSequence = " OutboundMailId,AuthorType,AuthorPersonId,Title,Body," + // 0-4 diff --git a/Database/Database-OutboundPhoneMessages.cs b/Database/Database-OutboundPhoneMessages.cs index e780c07d..58cc0178 100644 --- a/Database/Database-OutboundPhoneMessages.cs +++ b/Database/Database-OutboundPhoneMessages.cs @@ -7,7 +7,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { /* public void LogTransmittedPhoneMessage (int personId, string phoneNumber, string message) diff --git a/Database/Database-PaperLetters.cs b/Database/Database-PaperLetters.cs index d211aded..a9cca43a 100644 --- a/Database/Database-PaperLetters.cs +++ b/Database/Database-PaperLetters.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { public int CreatePaperLetter(int organizationId, string fromName, string replyAddress, DateTime receivedDate, int toPersonId, RoleType toPersonInRole, bool personal, int uploadedByPersonId) { diff --git a/Database/Database-ParleyAttendees.cs b/Database/Database-ParleyAttendees.cs index be1f9cdb..821096f0 100644 --- a/Database/Database-ParleyAttendees.cs +++ b/Database/Database-ParleyAttendees.cs @@ -8,7 +8,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Database field reading diff --git a/Database/Database-ParleyOptions.cs b/Database/Database-ParleyOptions.cs index 60ab872c..b7fb2305 100644 --- a/Database/Database-ParleyOptions.cs +++ b/Database/Database-ParleyOptions.cs @@ -8,7 +8,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Database field reading diff --git a/Database/Database-Parleys.cs b/Database/Database-Parleys.cs index 7ad623f7..12b6d8ac 100644 --- a/Database/Database-Parleys.cs +++ b/Database/Database-Parleys.cs @@ -8,7 +8,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Database field reading diff --git a/Database/Database-PaymentCodes.cs b/Database/Database-PaymentCodes.cs index f7e74eaa..80f1d325 100644 --- a/Database/Database-PaymentCodes.cs +++ b/Database/Database-PaymentCodes.cs @@ -7,7 +7,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { public BasicPaymentCode GetPaymentCode (string paymentCode) { diff --git a/Database/Database-PaymentGroups.cs b/Database/Database-PaymentGroups.cs index 74c6e9f3..bf51fbed 100644 --- a/Database/Database-PaymentGroups.cs +++ b/Database/Database-PaymentGroups.cs @@ -8,7 +8,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Database field reading diff --git a/Database/Database-Payments.cs b/Database/Database-Payments.cs index 13b8c32e..0a41592b 100644 --- a/Database/Database-Payments.cs +++ b/Database/Database-Payments.cs @@ -8,7 +8,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Database field reading diff --git a/Database/Database-Payouts.cs b/Database/Database-Payouts.cs index 8bdf74f6..8af7af6b 100644 --- a/Database/Database-Payouts.cs +++ b/Database/Database-Payouts.cs @@ -8,7 +8,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Database field reading diff --git a/Database/Database-Payroll.cs b/Database/Database-Payroll.cs index 10bb071f..37b3d643 100644 --- a/Database/Database-Payroll.cs +++ b/Database/Database-Payroll.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-PayrollAdjustments.cs b/Database/Database-PayrollAdjustments.cs index 2aff976d..dcec1777 100644 --- a/Database/Database-PayrollAdjustments.cs +++ b/Database/Database-PayrollAdjustments.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-People.cs b/Database/Database-People.cs index bfb12fa3..912180bc 100644 --- a/Database/Database-People.cs +++ b/Database/Database-People.cs @@ -7,7 +7,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-Permissions.cs b/Database/Database-Permissions.cs index 8b78e0eb..aefb451a 100644 --- a/Database/Database-Permissions.cs +++ b/Database/Database-Permissions.cs @@ -8,7 +8,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { public BasicPermission[] GetPermissionsTable () diff --git a/Database/Database-PirateWebLog.cs b/Database/Database-PirateWebLog.cs index 7de56c05..869bbad8 100644 --- a/Database/Database-PirateWebLog.cs +++ b/Database/Database-PirateWebLog.cs @@ -8,7 +8,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { public int CreatePWLogEntry (DateTime dateTimeUtc, int actingPersonId, string affectedItemType, int affectedItemId, string actionType, string actionDescription, diff --git a/Database/Database-PostalCodes.cs b/Database/Database-PostalCodes.cs index 92e7aec5..ae52c5f6 100644 --- a/Database/Database-PostalCodes.cs +++ b/Database/Database-PostalCodes.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-PostalCodesCities.cs b/Database/Database-PostalCodesCities.cs index 66f0645d..6fda34df 100644 --- a/Database/Database-PostalCodesCities.cs +++ b/Database/Database-PostalCodesCities.cs @@ -7,7 +7,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { private const string cityFieldSequence = " CityId, CountryId, CityName, GeographyId " + diff --git a/Database/Database-Refunds.cs b/Database/Database-Refunds.cs index 54a6e803..8ce316eb 100644 --- a/Database/Database-Refunds.cs +++ b/Database/Database-Refunds.cs @@ -8,7 +8,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Database field reading diff --git a/Database/Database-Reporters.cs b/Database/Database-Reporters.cs index 542755f4..0f03149d 100644 --- a/Database/Database-Reporters.cs +++ b/Database/Database-Reporters.cs @@ -8,7 +8,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { public int CreateReporter(string name, string email) { diff --git a/Database/Database-Roles.cs b/Database/Database-Roles.cs index 502d3163..33a53192 100644 --- a/Database/Database-Roles.cs +++ b/Database/Database-Roles.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types.Security; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-Salaries.cs b/Database/Database-Salaries.cs index 77f714eb..1e10bf3c 100644 --- a/Database/Database-Salaries.cs +++ b/Database/Database-Salaries.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { #region Field reading code diff --git a/Database/Database-TaxLevels.cs b/Database/Database-TaxLevels.cs index 5d091016..9e2eb3c2 100644 --- a/Database/Database-TaxLevels.cs +++ b/Database/Database-TaxLevels.cs @@ -5,7 +5,7 @@ using System.Data.Common; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { diff --git a/Database/Database-TemporaryIdentities.cs b/Database/Database-TemporaryIdentities.cs index 2572b3bb..5833a75e 100644 --- a/Database/Database-TemporaryIdentities.cs +++ b/Database/Database-TemporaryIdentities.cs @@ -5,7 +5,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { public int GetTemporaryIdentity() { diff --git a/Database/Database-UrlTranslations.cs b/Database/Database-UrlTranslations.cs index 0d6d442c..9136e212 100644 --- a/Database/Database-UrlTranslations.cs +++ b/Database/Database-UrlTranslations.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Enums; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { public int CreateUrlTranslation (string url) { diff --git a/Database/Database-Volunteers.cs b/Database/Database-Volunteers.cs index 9dd16803..e4dce717 100644 --- a/Database/Database-Volunteers.cs +++ b/Database/Database-Volunteers.cs @@ -9,7 +9,7 @@ using Swarmops.Basic.Types; namespace Swarmops.Database { - public partial class PirateDb + public partial class SwarmDb { public BasicVolunteer[] GetOpenVolunteers() { diff --git a/Logic/Cache/GeographyCache.cs b/Logic/Cache/GeographyCache.cs index f9ba2b67..c45c8275 100644 --- a/Logic/Cache/GeographyCache.cs +++ b/Logic/Cache/GeographyCache.cs @@ -26,7 +26,7 @@ namespace Swarmops.Logic.Cache { if (loadCache || lastRefresh.AddMinutes(cacheLifeSpanMinutes) < DateTime.Now) { - __geographyCache = PirateDb.GetDatabaseForReading().GetHashedGeographies(); + __geographyCache = SwarmDb.GetDatabaseForReading().GetHashedGeographies(); lastRefresh = DateTime.Now; loadCache = false; } @@ -241,8 +241,8 @@ namespace Swarmops.Logic.Cache static public void SetGeographyName (int geographyId, string name) { - PirateDb.GetDatabaseForWriting().SetGeographyName(geographyId, name); - BasicGeography geo = PirateDb.GetDatabaseForReading().GetGeography(geographyId); + SwarmDb.GetDatabaseForWriting().SetGeographyName(geographyId, name); + BasicGeography geo = SwarmDb.GetDatabaseForReading().GetGeography(geographyId); Dictionary> hashedGeographies = GetHashedGeographies(); hashedGeographies[geographyId][0] = geo; } @@ -251,12 +251,12 @@ namespace Swarmops.Logic.Cache * Might be handled.... public GeographyLevel[] GetGeographyLevelsAtGeographyId (int geographyId) { - return PirateDb.GetDatabaseForReading().GetGeographyLevelsAtGeographyId(geographyId); + return SwarmDb.GetDatabaseForReading().GetGeographyLevelsAtGeographyId(geographyId); } public int[] GetGeographyIdsFromLevel (int countryId, GeographyLevel level) { - return PirateDb.GetDatabaseForReading().GetGeographyIdsFromLevel(countryId, level); + return SwarmDb.GetDatabaseForReading().GetGeographyIdsFromLevel(countryId, level); } ************************/ diff --git a/Logic/Cache/MailTemplateCache.cs b/Logic/Cache/MailTemplateCache.cs index 4a0a8b87..eb5dbef4 100644 --- a/Logic/Cache/MailTemplateCache.cs +++ b/Logic/Cache/MailTemplateCache.cs @@ -32,7 +32,7 @@ namespace Swarmops.Logic.Cache if (!__MailTemplateCache.ContainsKey(templateName)) { - BasicMailTemplate[] basicTemplates = PirateDb.GetDatabaseForReading().GetMailTemplatesByName(templateName); + BasicMailTemplate[] basicTemplates = SwarmDb.GetDatabaseForReading().GetMailTemplatesByName(templateName); List tmplList = new List(basicTemplates); __MailTemplateCache[templateName] = tmplList; diff --git a/Logic/Cache/OrganizationCache.cs b/Logic/Cache/OrganizationCache.cs index 471244fd..557e12e0 100644 --- a/Logic/Cache/OrganizationCache.cs +++ b/Logic/Cache/OrganizationCache.cs @@ -27,7 +27,7 @@ namespace Swarmops.Logic.Cache { if (needsReload) { - __organizationCache = PirateDb.GetDatabaseForReading().GetHashedOrganizations(); + __organizationCache = SwarmDb.GetDatabaseForReading().GetHashedOrganizations(); __cachedUptakeGeographies = null; lastRefresh = DateTime.Now; needsReload = false; @@ -72,7 +72,7 @@ namespace Swarmops.Logic.Cache bool AutoAssignNewMembers, int DefaultCountryId) { - int Identity = PirateDb.GetDatabaseForWriting().CreateOrganization(ParentOrganizationId, + int Identity = SwarmDb.GetDatabaseForWriting().CreateOrganization(ParentOrganizationId, NameInternational, Name, NameShort, @@ -90,7 +90,7 @@ namespace Swarmops.Logic.Cache string NameShort, string Domain, string MailPrefix, int AnchorGeographyId, bool AcceptsMembers, bool AutoAssignNewMembers, int DefaultCountryId, int OrganizationId) { - PirateDb.GetDatabaseForWriting().UpdateOrganization(ParentOrganizationId, NameInternational, Name, NameShort, Domain, + SwarmDb.GetDatabaseForWriting().UpdateOrganization(ParentOrganizationId, NameInternational, Name, NameShort, Domain, MailPrefix, AnchorGeographyId, AcceptsMembers, AutoAssignNewMembers, DefaultCountryId, OrganizationId); @@ -106,7 +106,7 @@ namespace Swarmops.Logic.Cache // Let this be for the moment, new and old parents need to be loaded as well. Better right now to reload the whole cache. //lock (loadCacheLock) //{ - // __organizationCache[objectId][0] = Organization.FromBasic(PirateDb.GetDatabaseForReading().GetOrganization(objectId)); + // __organizationCache[objectId][0] = Organization.FromBasic(SwarmDb.GetDatabaseForReading().GetOrganization(objectId)); //} } @@ -269,7 +269,7 @@ namespace Swarmops.Logic.Cache [Obsolete ("Never use this function. Mark the org as unused, deleted. Records are needed for historic reasons.", true)] internal static void DeleteOrganization (int p) { - PirateDb.GetDatabaseForWriting().DeleteOrganization(p); + SwarmDb.GetDatabaseForWriting().DeleteOrganization(p); needsReload = true; } @@ -290,7 +290,7 @@ namespace Swarmops.Logic.Cache if (__cachedUptakeGeographies == null) { - __cachedUptakeGeographies = PirateDb.GetDatabaseForReading().GetAllOrganizationUptakeGeographyIds(); + __cachedUptakeGeographies = SwarmDb.GetDatabaseForReading().GetAllOrganizationUptakeGeographyIds(); } } return __cachedUptakeGeographies; @@ -363,7 +363,7 @@ namespace Swarmops.Logic.Cache internal static void AddOrgUptakeGeography (int p, int geoId) { - PirateDb.GetDatabaseForWriting().AddOrgUptakeGeography(p, geoId); + SwarmDb.GetDatabaseForWriting().AddOrgUptakeGeography(p, geoId); lock (loadCacheLock) { __cachedUptakeGeographies = null; @@ -373,7 +373,7 @@ namespace Swarmops.Logic.Cache internal static void DeleteOrgUptakeGeography (int p, int geoId) { - PirateDb.GetDatabaseForWriting().DeleteOrgUptakeGeography(p, geoId); + SwarmDb.GetDatabaseForWriting().DeleteOrgUptakeGeography(p, geoId); lock (loadCacheLock) { __cachedUptakeGeographies = null; diff --git a/Logic/Communications/AutoMail.cs b/Logic/Communications/AutoMail.cs index bb9a8dd7..6707ce68 100644 --- a/Logic/Communications/AutoMail.cs +++ b/Logic/Communications/AutoMail.cs @@ -23,7 +23,7 @@ namespace Swarmops.Logic.Communications set { base.Body = value; - PirateDb.GetDatabaseForWriting().SetAutoMail (this); // saves changes + SwarmDb.GetDatabaseForWriting().SetAutoMail (this); // saves changes } } @@ -36,7 +36,7 @@ namespace Swarmops.Logic.Communications public static AutoMail FromTypeOrganizationAndGeography (AutoMailType type, Organization org, Geography geo) { - BasicAutoMail basic = PirateDb.GetDatabaseForReading().GetAutoMail (type, org.Identity, geo.Identity); + BasicAutoMail basic = SwarmDb.GetDatabaseForReading().GetAutoMail (type, org.Identity, geo.Identity); if (basic == null) { @@ -55,7 +55,7 @@ namespace Swarmops.Logic.Communications public static AutoMail Create (AutoMailType type, Organization org, Geography geo, Person author, string title, string body) { - PirateDb.GetDatabaseForWriting().SetAutoMail (type, org.Identity, geo.Identity, + SwarmDb.GetDatabaseForWriting().SetAutoMail (type, org.Identity, geo.Identity, author == null ? 0 : author.Identity, title, body); return FromTypeOrganizationAndGeography (type, org, geo); } @@ -67,7 +67,7 @@ namespace Swarmops.Logic.Communications public static BasicAutoMail[] GetAllForMigration() { - return PirateDb.GetDatabaseForReading().GetAllAutoMailsForMigration(); + return SwarmDb.GetDatabaseForReading().GetAllAutoMailsForMigration(); } } } \ No newline at end of file diff --git a/Logic/Communications/CommunicationTurnaround.cs b/Logic/Communications/CommunicationTurnaround.cs index ff6a872a..32550e1a 100644 --- a/Logic/Communications/CommunicationTurnaround.cs +++ b/Logic/Communications/CommunicationTurnaround.cs @@ -23,13 +23,13 @@ namespace Swarmops.Logic.Communications public static CommunicationTurnaround FromIdentity (Organization organization, int communicationTypeId, int communicationId) { return - FromBasic(PirateDb.GetDatabaseForReading().GetCommunicationTurnaround(organization.Identity, communicationTypeId, + FromBasic(SwarmDb.GetDatabaseForReading().GetCommunicationTurnaround(organization.Identity, communicationTypeId, communicationId)); } public static CommunicationTurnaround Create (Organization organization, int communicationId, DateTime dateTimeOpened) { - PirateDb.GetDatabaseForWriting().CreateCommunicationTurnaround(organization.Identity, 1, communicationId, dateTimeOpened); + SwarmDb.GetDatabaseForWriting().CreateCommunicationTurnaround(organization.Identity, 1, communicationId, dateTimeOpened); return FromIdentity(organization, 1, communicationId); } @@ -52,7 +52,7 @@ namespace Swarmops.Logic.Communications personId = person.Identity; } - PirateDb.GetDatabaseForWriting().SetCommunicationTurnaroundResponded(this.OrganizationId, this.CommunicationTypeId, this.CommunicationId, dateTime, personId); + SwarmDb.GetDatabaseForWriting().SetCommunicationTurnaroundResponded(this.OrganizationId, this.CommunicationTypeId, this.CommunicationId, dateTime, personId); base.Responded = true; } @@ -71,7 +71,7 @@ namespace Swarmops.Logic.Communications personId = person.Identity; } - PirateDb.GetDatabaseForWriting().SetCommunicationTurnaroundClosed(this.OrganizationId, this.CommunicationTypeId, this.CommunicationId, dateTime, personId); + SwarmDb.GetDatabaseForWriting().SetCommunicationTurnaroundClosed(this.OrganizationId, this.CommunicationTypeId, this.CommunicationId, dateTime, personId); base.Open = false; } diff --git a/Logic/Communications/CommunicationTurnarounds.cs b/Logic/Communications/CommunicationTurnarounds.cs index 3c45aeab..e7e5d97d 100644 --- a/Logic/Communications/CommunicationTurnarounds.cs +++ b/Logic/Communications/CommunicationTurnarounds.cs @@ -19,12 +19,12 @@ namespace Swarmops.Logic.Communications { if (includeClosed) { - return FromArray(PirateDb.GetDatabaseForReading().GetCommunicationTurnarounds(organization)); + return FromArray(SwarmDb.GetDatabaseForReading().GetCommunicationTurnarounds(organization)); } else { return - FromArray(PirateDb.GetDatabaseForReading().GetCommunicationTurnarounds(organization, + FromArray(SwarmDb.GetDatabaseForReading().GetCommunicationTurnarounds(organization, DatabaseCondition.OpenTrue)); } } diff --git a/Logic/Communications/MailTemplate.cs b/Logic/Communications/MailTemplate.cs index d9db34d4..66c638d7 100644 --- a/Logic/Communications/MailTemplate.cs +++ b/Logic/Communications/MailTemplate.cs @@ -519,7 +519,7 @@ namespace Swarmops.Logic.Communications public static MailTemplate FromIdentity (int templateId) { - BasicMailTemplate basic = PirateDb.GetDatabaseForReading().GetMailTemplateById(templateId); + BasicMailTemplate basic = SwarmDb.GetDatabaseForReading().GetMailTemplateById(templateId); return FromBasic(basic); } @@ -531,7 +531,7 @@ namespace Swarmops.Logic.Communications public static List GetAll () { - BasicMailTemplate[] basic = PirateDb.GetDatabaseForReading().GetAllMailTemplates(); + BasicMailTemplate[] basic = SwarmDb.GetDatabaseForReading().GetAllMailTemplates(); List resultlist = new List(); foreach (BasicMailTemplate bt in basic) { @@ -550,7 +550,7 @@ namespace Swarmops.Logic.Communications int organizationId, string templateBody) { - int retId = PirateDb.GetDatabaseForWriting().SetMailTemplate(0, + int retId = SwarmDb.GetDatabaseForWriting().SetMailTemplate(0, templateName, languageCode, countryCode, @@ -564,7 +564,7 @@ namespace Swarmops.Logic.Communications public void Update () { TemplateBody = TemplateBody; //to make sure the HTMlDoc is taken into account - PirateDb.GetDatabaseForWriting().SetMailTemplate(this); // saves changes + SwarmDb.GetDatabaseForWriting().SetMailTemplate(this); // saves changes MailTemplateCache.loadCache = true; } diff --git a/Logic/Communications/NewsletterFeed.cs b/Logic/Communications/NewsletterFeed.cs index 88c4b395..a6ac85dc 100644 --- a/Logic/Communications/NewsletterFeed.cs +++ b/Logic/Communications/NewsletterFeed.cs @@ -28,7 +28,7 @@ namespace Swarmops.Logic.Communications public static NewsletterFeed FromIdentity (int identity) { - return FromBasic(PirateDb.GetDatabaseForReading().GetNewsletterFeed((int)identity)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetNewsletterFeed((int)identity)); } public static NewsletterFeed FromBasic (BasicNewsletterFeed basic) diff --git a/Logic/Communications/OutboundMail.cs b/Logic/Communications/OutboundMail.cs index d2a09add..2c2a3e1e 100644 --- a/Logic/Communications/OutboundMail.cs +++ b/Logic/Communications/OutboundMail.cs @@ -58,7 +58,7 @@ namespace Swarmops.Logic.Communications /// An OutboundMail from the database public static OutboundMail FromIdentity (int outboundMailId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetOutboundMail(outboundMailId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetOutboundMail(outboundMailId)); } @@ -75,7 +75,7 @@ namespace Swarmops.Logic.Communications Organization organization, Geography geography, DateTime releaseDateTime) { return - FromIdentity(PirateDb.GetDatabaseForWriting().CreateOutboundMail(MailAuthorType.Person, author.Identity, title, + FromIdentity(SwarmDb.GetDatabaseForWriting().CreateOutboundMail(MailAuthorType.Person, author.Identity, title, body, mailPriority, mailType, geography.Identity, organization.Identity, releaseDateTime)); @@ -115,7 +115,7 @@ namespace Swarmops.Logic.Communications int organizationId, int geographyId, DateTime releaseDateTime) { - int mailID = PirateDb.GetDatabaseForWriting().CreateOutboundMail(authorType, 0, title, + int mailID = SwarmDb.GetDatabaseForWriting().CreateOutboundMail(authorType, 0, title, body, mailPriority, mailType, geographyId, organizationId, releaseDateTime); @@ -130,7 +130,7 @@ namespace Swarmops.Logic.Communications { List retList = new List(); BasicOutboundMail[] mails - = PirateDb.GetDatabaseForReading().GetDuplicateOutboundMail(this.AuthorType, AuthorPersonId, Title, + = SwarmDb.GetDatabaseForReading().GetDuplicateOutboundMail(this.AuthorType, AuthorPersonId, Title, Body, MailPriority, MailType, GeographyId, OrganizationId, afterTime, recipientId); foreach (BasicOutboundMail mail in mails) { @@ -142,7 +142,7 @@ namespace Swarmops.Logic.Communications public static OutboundMail GetFirstUnresolved () { - BasicOutboundMail[] mails = PirateDb.GetDatabaseForReading().GetTopUnresolvedOutboundMail(1); + BasicOutboundMail[] mails = SwarmDb.GetDatabaseForReading().GetTopUnresolvedOutboundMail(1); if (mails.Length > 0) { @@ -154,7 +154,7 @@ namespace Swarmops.Logic.Communications public static OutboundMail GetFirstUnprocessed () { - BasicOutboundMail[] mails = PirateDb.GetDatabaseForReading().GetTopUnprocessedOutboundMail(1); + BasicOutboundMail[] mails = SwarmDb.GetDatabaseForReading().GetTopUnprocessedOutboundMail(1); if (mails.Length > 0) { @@ -173,7 +173,7 @@ namespace Swarmops.Logic.Communications get { return base.StartProcessDateTime; } set { - PirateDb.GetDatabaseForWriting().SetOutboundMailStartProcess(Identity); + SwarmDb.GetDatabaseForWriting().SetOutboundMailStartProcess(Identity); base.StartProcessDateTime = DateTime.Now; } } @@ -238,7 +238,7 @@ namespace Swarmops.Logic.Communications { return OutboundMailRecipients.FromArray( - PirateDb.GetDatabaseForReading().GetTopOutboundMailRecipients(Identity, batchSize), this); + SwarmDb.GetDatabaseForReading().GetTopOutboundMailRecipients(Identity, batchSize), this); } public void AddRecipient (Person person, bool asOfficer) @@ -269,12 +269,12 @@ namespace Swarmops.Logic.Communications public void AddRecipient (int personId, bool asOfficer) { - PirateDb.GetDatabaseForWriting().CreateOutboundMailRecipient(Identity, personId, asOfficer, (int)OutboundMailRecipient.RecipientType.Person); + SwarmDb.GetDatabaseForWriting().CreateOutboundMailRecipient(Identity, personId, asOfficer, (int)OutboundMailRecipient.RecipientType.Person); } private void AddReporterRecipient (int identity) { - PirateDb.GetDatabaseForWriting().CreateOutboundMailRecipient(Identity, identity, false, (int)OutboundMailRecipient.RecipientType.Reporter); + SwarmDb.GetDatabaseForWriting().CreateOutboundMailRecipient(Identity, identity, false, (int)OutboundMailRecipient.RecipientType.Reporter); } #endregion @@ -282,37 +282,37 @@ namespace Swarmops.Logic.Communications public void SetReadyForPickup () { - PirateDb.GetDatabaseForWriting().SetOutboundMailReadyForPickup(Identity); + SwarmDb.GetDatabaseForWriting().SetOutboundMailReadyForPickup(Identity); base.ReadyForPickup = true; } public void SetResolved () { - PirateDb.GetDatabaseForWriting().SetOutboundMailResolved(Identity); + SwarmDb.GetDatabaseForWriting().SetOutboundMailResolved(Identity); base.Resolved = true; } public void SetProcessed () { - PirateDb.GetDatabaseForWriting().SetOutboundMailProcessed(Identity); + SwarmDb.GetDatabaseForWriting().SetOutboundMailProcessed(Identity); base.Processed = true; } public void SetRecipientCount (int recipientCount) { - PirateDb.GetDatabaseForWriting().SetOutboundMailRecipientCount(Identity, recipientCount); + SwarmDb.GetDatabaseForWriting().SetOutboundMailRecipientCount(Identity, recipientCount); base.RecipientCount = recipientCount; } public void IncrementSuccesses () { - PirateDb.GetDatabaseForWriting().IncrementOutboundMailSuccesses(Identity); + SwarmDb.GetDatabaseForWriting().IncrementOutboundMailSuccesses(Identity); base.RecipientsSuccess++; } public void IncrementFailures () { - PirateDb.GetDatabaseForWriting().IncrementOutboundMailFailures(Identity); + SwarmDb.GetDatabaseForWriting().IncrementOutboundMailFailures(Identity); base.RecipientsFail++; } diff --git a/Logic/Communications/OutboundMailRecipient.cs b/Logic/Communications/OutboundMailRecipient.cs index 225decf7..d93aed20 100644 --- a/Logic/Communications/OutboundMailRecipient.cs +++ b/Logic/Communications/OutboundMailRecipient.cs @@ -112,12 +112,12 @@ namespace Swarmops.Logic.Communications public static void Create (int outboundMailId, int personId, bool asOfficer, int personType) { - PirateDb.GetDatabaseForWriting().CreateOutboundMailRecipient(outboundMailId, personId, asOfficer, personType); + SwarmDb.GetDatabaseForWriting().CreateOutboundMailRecipient(outboundMailId, personId, asOfficer, personType); } public void Delete () { - PirateDb.GetDatabaseForWriting().DeleteOutboundMailRecipient(Identity); + SwarmDb.GetDatabaseForWriting().DeleteOutboundMailRecipient(Identity); } } } \ No newline at end of file diff --git a/Logic/Communications/OutboundMails.cs b/Logic/Communications/OutboundMails.cs index a84a8987..eea565fc 100644 --- a/Logic/Communications/OutboundMails.cs +++ b/Logic/Communications/OutboundMails.cs @@ -22,7 +22,7 @@ namespace Swarmops.Logic.Communications public static OutboundMails GetTopUnprocessed (int count) { - BasicOutboundMail[] basicMails = PirateDb.GetDatabaseForReading().GetTopUnprocessedOutboundMail (count); + BasicOutboundMail[] basicMails = SwarmDb.GetDatabaseForReading().GetTopUnprocessedOutboundMail (count); return FromArray (basicMails); } diff --git a/Logic/Communications/PaperLetter.cs b/Logic/Communications/PaperLetter.cs index 1869e7e8..f21840a2 100644 --- a/Logic/Communications/PaperLetter.cs +++ b/Logic/Communications/PaperLetter.cs @@ -24,14 +24,14 @@ namespace Swarmops.Logic.Communications public static PaperLetter Create(int creatingPersonId, int organizationId, string fromName, string[] replyAddressLines, DateTime receivedDate, int toPersonId, RoleType toPersonInRole, bool personal) { - return FromIdentity(PirateDb.GetDatabaseForWriting(). + return FromIdentity(SwarmDb.GetDatabaseForWriting(). CreatePaperLetter(organizationId, fromName, String.Join("|", replyAddressLines), receivedDate, toPersonId, toPersonInRole, personal, creatingPersonId)); } public static PaperLetter FromIdentity (int paperLetterId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetPaperLetter(paperLetterId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetPaperLetter(paperLetterId)); } public static PaperLetter FromBasic (BasicPaperLetter basic) diff --git a/Logic/Communications/PaperLetters.cs b/Logic/Communications/PaperLetters.cs index 622aa097..dd4e28d7 100644 --- a/Logic/Communications/PaperLetters.cs +++ b/Logic/Communications/PaperLetters.cs @@ -33,7 +33,7 @@ namespace Swarmops.Logic.Communications public static PaperLetters ForOrganization (int organizationId) { - return FromArray(PirateDb.GetDatabaseForReading().GetPaperLettersForOrganization(organizationId)); + return FromArray(SwarmDb.GetDatabaseForReading().GetPaperLettersForOrganization(organizationId)); } public static PaperLetters ForPerson (Person person) @@ -43,7 +43,7 @@ namespace Swarmops.Logic.Communications public static PaperLetters ForPerson (int personId) { - return FromArray(PirateDb.GetDatabaseForReading().GetPaperLettersForPerson(personId)); + return FromArray(SwarmDb.GetDatabaseForReading().GetPaperLettersForPerson(personId)); } } } diff --git a/Logic/Communications/PhoneMessageReceiver.cs b/Logic/Communications/PhoneMessageReceiver.cs index 6c5679fc..92e5e805 100644 --- a/Logic/Communications/PhoneMessageReceiver.cs +++ b/Logic/Communications/PhoneMessageReceiver.cs @@ -405,7 +405,7 @@ namespace Swarmops.Logic.Communications { for (int i = 0; i < phoneNumbers.Length; i++) { - BasicPerson[] people = PirateDb.GetDatabaseForReading().GetPeopleFromPhoneNumber("SE", phoneNumbers[i]); + BasicPerson[] people = SwarmDb.GetDatabaseForReading().GetPeopleFromPhoneNumber("SE", phoneNumbers[i]); foreach (BasicPerson bp in people) { //Only add if not seen. diff --git a/Logic/Communications/PhoneMessageTransmitter.cs b/Logic/Communications/PhoneMessageTransmitter.cs index 9c91fd67..595be68a 100644 --- a/Logic/Communications/PhoneMessageTransmitter.cs +++ b/Logic/Communications/PhoneMessageTransmitter.cs @@ -27,7 +27,7 @@ namespace Swarmops.Logic.Communications { lastLoad = DateTime.Now; String serviceName = Persistence.Key["SMSService"]; - BasicExternalCredential basicCredential = PirateDb.GetDatabaseForReading().GetExternalCredential(serviceName); + BasicExternalCredential basicCredential = SwarmDb.GetDatabaseForReading().GetExternalCredential(serviceName); Encoding enc = Encoding.GetEncoding(28591); //ISO encoding (latin1) credential = new ServiceCredential(basicCredential.Login, basicCredential.Password, basicCredential.ServiceName, enc); diff --git a/Logic/DataObjects/GeographyWithPeopleDataObject.cs b/Logic/DataObjects/GeographyWithPeopleDataObject.cs index d023ef04..0f09bf8a 100644 --- a/Logic/DataObjects/GeographyWithPeopleDataObject.cs +++ b/Logic/DataObjects/GeographyWithPeopleDataObject.cs @@ -33,7 +33,7 @@ namespace Swarmops.Logic.DataObjects row.SecondsContent = ""; row.OrgId = orgId; Geographies gTree = geo.GetTree(); - int[] members = PirateDb.GetDatabaseForReading().GetMembersForOrganizationsAndGeographies(orgs.Identities, gTree.Identities); + int[] members = SwarmDb.GetDatabaseForReading().GetMembersForOrganizationsAndGeographies(orgs.Identities, gTree.Identities); } diff --git a/Logic/DataObjects/MembershipsDataObject.cs b/Logic/DataObjects/MembershipsDataObject.cs index f5383b46..9656d76d 100644 --- a/Logic/DataObjects/MembershipsDataObject.cs +++ b/Logic/DataObjects/MembershipsDataObject.cs @@ -14,7 +14,7 @@ namespace Swarmops.Logic.DataObjects #endif public static Membership[] Select (int personId) { - return Memberships.FromArray(PirateDb.GetDatabaseForReading().GetMemberships(Person.FromIdentity(personId))).ToArray(); + return Memberships.FromArray(SwarmDb.GetDatabaseForReading().GetMemberships(Person.FromIdentity(personId))).ToArray(); } #if !__MonoCS__ diff --git a/Logic/Financial/CashAdvance.cs b/Logic/Financial/CashAdvance.cs index 358fe5db..66327eb0 100644 --- a/Logic/Financial/CashAdvance.cs +++ b/Logic/Financial/CashAdvance.cs @@ -26,18 +26,18 @@ namespace Swarmops.Logic.Financial public static CashAdvance FromIdentity (int cashAdvanceId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetCashAdvance(cashAdvanceId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetCashAdvance(cashAdvanceId)); } public static CashAdvance FromIdentityAggressive (int cashAdvanceId) { - return FromBasic(PirateDb.GetDatabaseForWriting().GetCashAdvance(cashAdvanceId)); + return FromBasic(SwarmDb.GetDatabaseForWriting().GetCashAdvance(cashAdvanceId)); } public static CashAdvance Create(Organization organization, Person forPerson, Person createdByPerson, Int64 amountCents, FinancialAccount budget, string description) { return - FromIdentityAggressive(PirateDb.GetDatabaseForWriting().CreateCashAdvance(forPerson.Identity, + FromIdentityAggressive(SwarmDb.GetDatabaseForWriting().CreateCashAdvance(forPerson.Identity, createdByPerson.Identity, organization.Identity, budget.Identity, amountCents, diff --git a/Logic/Financial/CashAdvances.cs b/Logic/Financial/CashAdvances.cs index 79e7e73e..6f28676e 100644 --- a/Logic/Financial/CashAdvances.cs +++ b/Logic/Financial/CashAdvances.cs @@ -18,7 +18,7 @@ namespace Swarmops.Logic.Financial static public CashAdvances ForOrganization(Organization organization, bool includeClosed) { - return FromArray(PirateDb.GetDatabaseForReading().GetCashAdvances(organization, + return FromArray(SwarmDb.GetDatabaseForReading().GetCashAdvances(organization, includeClosed ? DatabaseCondition.None : DatabaseCondition.OpenTrue)); } diff --git a/Logic/Financial/ExpenseClaim.cs b/Logic/Financial/ExpenseClaim.cs index ad52824f..a9e46c85 100644 --- a/Logic/Financial/ExpenseClaim.cs +++ b/Logic/Financial/ExpenseClaim.cs @@ -28,13 +28,13 @@ namespace Swarmops.Logic.Financial public static ExpenseClaim FromIdentity (int expenseId) { - return FromBasic (PirateDb.GetDatabaseForReading().GetExpenseClaim (expenseId)); + return FromBasic (SwarmDb.GetDatabaseForReading().GetExpenseClaim (expenseId)); } public static ExpenseClaim Create (Person claimer, Organization organization, FinancialAccount budget, DateTime expenseDate, string description, Int64 amountCents) { - ExpenseClaim newClaim = FromIdentity (PirateDb.GetDatabaseForWriting().CreateExpenseClaim (claimer.Identity, organization.Identity, + ExpenseClaim newClaim = FromIdentity (SwarmDb.GetDatabaseForWriting().CreateExpenseClaim (claimer.Identity, organization.Identity, budget.Identity, expenseDate, description, amountCents)); // Create the financial transaction with rows @@ -77,7 +77,7 @@ namespace Swarmops.Logic.Financial { // OBSOLETE - // PirateDb.GetDatabaseForWriting().CreateExpenseEvent (Identity, eventType, personId); + // SwarmDb.GetDatabaseForWriting().CreateExpenseEvent (Identity, eventType, personId); // TODO: Repopulate Events property, when created } @@ -147,7 +147,7 @@ namespace Swarmops.Logic.Financial { if (base.Attested != value) { - PirateDb.GetDatabaseForWriting().SetExpenseClaimAttested(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetExpenseClaimAttested(this.Identity, value); base.Attested = value; } } @@ -163,7 +163,7 @@ namespace Swarmops.Logic.Financial { if (base.Validated != value) { - PirateDb.GetDatabaseForWriting().SetExpenseClaimValidated(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetExpenseClaimValidated(this.Identity, value); base.Validated = value; } } @@ -177,7 +177,7 @@ namespace Swarmops.Logic.Financial if (base.Open != value) { base.Open = value; - PirateDb.GetDatabaseForWriting().SetExpenseClaimOpen(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetExpenseClaimOpen(this.Identity, value); } } @@ -191,7 +191,7 @@ namespace Swarmops.Logic.Financial if (base.Claimed != value) { base.Claimed = value; - PirateDb.GetDatabaseForWriting().SetExpenseClaimClaimed(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetExpenseClaimClaimed(this.Identity, value); UpdateFinancialTransaction(this.Claimer); } } @@ -206,7 +206,7 @@ namespace Swarmops.Logic.Financial if (base.Repaid != value) { base.Repaid = value; - PirateDb.GetDatabaseForWriting().SetExpenseClaimRepaid(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetExpenseClaimRepaid(this.Identity, value); } } @@ -220,7 +220,7 @@ namespace Swarmops.Logic.Financial if (base.KeepSeparate != value) { base.KeepSeparate = value; - PirateDb.GetDatabaseForWriting().SetExpenseClaimKeepSeparate(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetExpenseClaimKeepSeparate(this.Identity, value); } } @@ -234,7 +234,7 @@ namespace Swarmops.Logic.Financial } set { - PirateDb.GetDatabaseForWriting().SetExpenseClaimDescription(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetExpenseClaimDescription(this.Identity, value); base.Description = value; } } @@ -280,14 +280,14 @@ namespace Swarmops.Logic.Financial } base.AmountCents = amountCents; - PirateDb.GetDatabaseForWriting().SetExpenseClaimAmount(this.Identity, amountCents); + SwarmDb.GetDatabaseForWriting().SetExpenseClaimAmount(this.Identity, amountCents); UpdateFinancialTransaction(settingPerson); } public void SetBudget (FinancialAccount budget, Person settingPerson) { - PirateDb.GetDatabaseForWriting().SetExpenseClaimBudget (this.Identity, budget.Identity); + SwarmDb.GetDatabaseForWriting().SetExpenseClaimBudget (this.Identity, budget.Identity); base.BudgetId = budget.Identity; UpdateFinancialTransaction(settingPerson); } @@ -366,8 +366,8 @@ namespace Swarmops.Logic.Financial public void Validate(Person validator) { - PirateDb.GetDatabaseForWriting().SetExpenseClaimValidated(this.Identity, true); - PirateDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Validation, + SwarmDb.GetDatabaseForWriting().SetExpenseClaimValidated(this.Identity, true); + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Validation, FinancialDependencyType.ExpenseClaim, this.Identity, DateTime.Now, validator.Identity, (double) this.Amount); base.Validated = true; @@ -375,8 +375,8 @@ namespace Swarmops.Logic.Financial public void Devalidate (Person devalidator) { - PirateDb.GetDatabaseForWriting().SetExpenseClaimValidated(this.Identity, false); - PirateDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Devalidation, + SwarmDb.GetDatabaseForWriting().SetExpenseClaimValidated(this.Identity, false); + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Devalidation, FinancialDependencyType.ExpenseClaim, this.Identity, DateTime.Now, devalidator.Identity, (double) this.Amount); base.Validated = false; @@ -389,8 +389,8 @@ namespace Swarmops.Logic.Financial public void Attest(Person attester) { - PirateDb.GetDatabaseForWriting().SetExpenseClaimAttested(this.Identity, true); - PirateDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Attestation, + SwarmDb.GetDatabaseForWriting().SetExpenseClaimAttested(this.Identity, true); + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Attestation, FinancialDependencyType.ExpenseClaim, this.Identity, DateTime.Now, attester.Identity, (double) this.Amount); base.Attested = true; @@ -398,8 +398,8 @@ namespace Swarmops.Logic.Financial public void Deattest(Person deattester) { - PirateDb.GetDatabaseForWriting().SetExpenseClaimAttested(this.Identity, false); - PirateDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Deattestation, + SwarmDb.GetDatabaseForWriting().SetExpenseClaimAttested(this.Identity, false); + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Deattestation, FinancialDependencyType.ExpenseClaim, this.Identity, DateTime.Now, deattester.Identity, (double) this.Amount); base.Attested = false; diff --git a/Logic/Financial/ExpenseClaims.cs b/Logic/Financial/ExpenseClaims.cs index e48e5b2e..758925b1 100644 --- a/Logic/Financial/ExpenseClaims.cs +++ b/Logic/Financial/ExpenseClaims.cs @@ -64,19 +64,19 @@ namespace Swarmops.Logic.Financial public static ExpenseClaims FromClaimingPersonAndOrganization (Person person, Organization organization) { return - FromArray(PirateDb.GetDatabaseForReading().GetExpenseClaimsByClaimerAndOrganization(person.Identity, + FromArray(SwarmDb.GetDatabaseForReading().GetExpenseClaimsByClaimerAndOrganization(person.Identity, organization.Identity)); } public static ExpenseClaims FromClaimingPerson (Person person) { - return FromArray(PirateDb.GetDatabaseForReading().GetExpenseClaimsByClaimer(person.Identity)); + return FromArray(SwarmDb.GetDatabaseForReading().GetExpenseClaimsByClaimer(person.Identity)); } public static ExpenseClaims FromOrganization (Organization org) { - return FromArray(PirateDb.GetDatabaseForReading().GetExpenseClaimsByOrganization(org.Identity)); + return FromArray(SwarmDb.GetDatabaseForReading().GetExpenseClaimsByOrganization(org.Identity)); } @@ -89,11 +89,11 @@ namespace Swarmops.Logic.Financial { if (includeClosed) { - return FromArray(PirateDb.GetDatabaseForReading().GetExpenseClaims(org)); + return FromArray(SwarmDb.GetDatabaseForReading().GetExpenseClaims(org)); } else { - return FromArray(PirateDb.GetDatabaseForReading().GetExpenseClaims(org, DatabaseCondition.OpenTrue)); + return FromArray(SwarmDb.GetDatabaseForReading().GetExpenseClaims(org, DatabaseCondition.OpenTrue)); } } diff --git a/Logic/Financial/FinancialAccount.cs b/Logic/Financial/FinancialAccount.cs index 0cf497b2..ab2caf77 100644 --- a/Logic/Financial/FinancialAccount.cs +++ b/Logic/Financial/FinancialAccount.cs @@ -19,22 +19,22 @@ namespace Swarmops.Logic.Financial [Obsolete("This method uses floating point for financials. Deprecated. Do not use; use BalanceTotalCents instead.", true)] public double BalanceTotal { - get { return PirateDb.GetDatabaseForReading().GetFinancialAccountBalanceTotal(Identity); } + get { return SwarmDb.GetDatabaseForReading().GetFinancialAccountBalanceTotal(Identity); } } public Int64 BalanceTotalCents { - get { return PirateDb.GetDatabaseForReading().GetFinancialAccountBalanceTotalCents(Identity); } + get { return SwarmDb.GetDatabaseForReading().GetFinancialAccountBalanceTotalCents(Identity); } } public static FinancialAccount FromIdentity(int identity) { - return FromBasic(PirateDb.GetDatabaseForReading().GetFinancialAccount(identity)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetFinancialAccount(identity)); } public static FinancialAccount FromIdentityAggressive(int identity) { - return FromBasic(PirateDb.GetDatabaseForWriting().GetFinancialAccount(identity)); // Note "for writing". Intentional; this bypasses the replication lag from master to slave. + return FromBasic(SwarmDb.GetDatabaseForWriting().GetFinancialAccount(identity)); // Note "for writing". Intentional; this bypasses the replication lag from master to slave. } public static FinancialAccount FromBasic(BasicFinancialAccount basic) @@ -45,30 +45,30 @@ namespace Swarmops.Logic.Financial [Obsolete("This method uses floating point for financials. Deprecated. Do not use; use GetDeltaCents instead.", true)] public decimal GetDelta(DateTime start, DateTime end) { - return PirateDb.GetDatabaseForReading().GetFinancialAccountBalanceDelta(Identity, start, end); + return SwarmDb.GetDatabaseForReading().GetFinancialAccountBalanceDelta(Identity, start, end); } public Int64 GetDeltaCents(DateTime start, DateTime end) { - return PirateDb.GetDatabaseForReading().GetFinancialAccountBalanceDeltaCents(Identity, start, end); + return SwarmDb.GetDatabaseForReading().GetFinancialAccountBalanceDeltaCents(Identity, start, end); } public FinancialAccountRows GetLastRows(int rowCount) { - BasicFinancialAccountRow[] basicRows = PirateDb.GetDatabaseForReading().GetLastFinancialAccountRows(Identity, rowCount); + BasicFinancialAccountRow[] basicRows = SwarmDb.GetDatabaseForReading().GetLastFinancialAccountRows(Identity, rowCount); return FinancialAccountRows.FromArray(basicRows); } public FinancialAccountRows GetRows(DateTime start, DateTime end) { - BasicFinancialAccountRow[] basicRows = PirateDb.GetDatabaseForReading().GetFinancialAccountRows(Identity, start, end); + BasicFinancialAccountRow[] basicRows = SwarmDb.GetDatabaseForReading().GetFinancialAccountRows(Identity, start, end); return FinancialAccountRows.FromArray(basicRows); } [Obsolete("This method uses floating point for financials. Deprecated. Do not use; use GetBudgetCents instead.")] public double GetBudget(int year) { - return PirateDb.GetDatabaseForReading().GetFinancialAccountBudget(this.Identity, year); + return SwarmDb.GetDatabaseForReading().GetFinancialAccountBudget(this.Identity, year); } public Int64 GetBudgetCents (int year) @@ -78,28 +78,28 @@ namespace Swarmops.Logic.Financial public Int64[] GetBudgetMonthly (int year) { - return PirateDb.GetDatabaseForReading().GetFinancialAccountBudgetMonthly(this.Identity, year); + return SwarmDb.GetDatabaseForReading().GetFinancialAccountBudgetMonthly(this.Identity, year); } [Obsolete("This method uses floating point for financials. Deprecated. Do not use.")] public void SetBudget(int year, double amount) { - PirateDb.GetDatabaseForWriting().SetFinancialAccountBudget(this.Identity, year, amount); + SwarmDb.GetDatabaseForWriting().SetFinancialAccountBudget(this.Identity, year, amount); } public void SetBudgetCents (int year, Int64 amount) { - PirateDb.GetDatabaseForWriting().SetFinancialAccountBudget(this.Identity, year, amount / 100.0); // TODO: Change db structure to use cents + SwarmDb.GetDatabaseForWriting().SetFinancialAccountBudget(this.Identity, year, amount / 100.0); // TODO: Change db structure to use cents } public void SetBudgetMontly (int year, int month, Int64 amountCents) { - PirateDb.GetDatabaseForWriting().SetFinancialAccountBudgetMonthly(this.Identity, year, month, amountCents); + SwarmDb.GetDatabaseForWriting().SetFinancialAccountBudgetMonthly(this.Identity, year, month, amountCents); } public static FinancialAccount Create (int organizationId, string name, FinancialAccountType accountType, int parentFinancialAccountId) { - int accountId = PirateDb.GetDatabaseForWriting().CreateFinancialAccount(organizationId, name, accountType, parentFinancialAccountId); + int accountId = SwarmDb.GetDatabaseForWriting().CreateFinancialAccount(organizationId, name, accountType, parentFinancialAccountId); return FromIdentityAggressive(accountId); } @@ -124,14 +124,14 @@ namespace Swarmops.Logic.Financial } set { - PirateDb.GetDatabaseForWriting().SetFinancialAccountOwner(this.Identity, value.Identity); + SwarmDb.GetDatabaseForWriting().SetFinancialAccountOwner(this.Identity, value.Identity); } } public FinancialAccounts Children { - get { return FinancialAccounts.FromArray(PirateDb.GetDatabaseForReading().GetFinancialAccountChildren(this.Identity)); } + get { return FinancialAccounts.FromArray(SwarmDb.GetDatabaseForReading().GetFinancialAccountChildren(this.Identity)); } } public FinancialAccounts GetTree () diff --git a/Logic/Financial/FinancialAccounts.cs b/Logic/Financial/FinancialAccounts.cs index f26453aa..3e4bd6f7 100644 --- a/Logic/Financial/FinancialAccounts.cs +++ b/Logic/Financial/FinancialAccounts.cs @@ -13,12 +13,12 @@ namespace Swarmops.Logic.Financial { public static FinancialAccounts ForOrganization(Organization organization) { - return FromArray(PirateDb.GetDatabaseForReading().GetFinancialAccountTreeForOrganization(organization.Identity)); + return FromArray(SwarmDb.GetDatabaseForReading().GetFinancialAccountTreeForOrganization(organization.Identity)); } public static FinancialAccounts ForOwner(Person person) { - return FromArray(PirateDb.GetDatabaseForReading().GetFinancialAccountsOwnedByPerson(person.Identity)); + return FromArray(SwarmDb.GetDatabaseForReading().GetFinancialAccountsOwnedByPerson(person.Identity)); } @@ -56,7 +56,7 @@ namespace Swarmops.Logic.Financial public static FinancialAccounts FromBankTransactionTag (string tag) { - int[] accountIdentities = PirateDb.GetDatabaseForReading().GetObjectsByOptionalData(ObjectType.FinancialAccount, + int[] accountIdentities = SwarmDb.GetDatabaseForReading().GetObjectsByOptionalData(ObjectType.FinancialAccount, ObjectOptionalDataType. BankTransactionTag, tag.ToLower()); @@ -71,32 +71,32 @@ namespace Swarmops.Logic.Financial return new FinancialAccounts(); } - return FromArray(PirateDb.GetDatabaseForReading().GetFinancialAccounts(financialAccountIds)); + return FromArray(SwarmDb.GetDatabaseForReading().GetFinancialAccounts(financialAccountIds)); } public FinancialAccountRows GetRows (DateTime start, DateTime end) { - BasicFinancialAccountRow[] basicRows = PirateDb.GetDatabaseForReading().GetFinancialAccountRows(Identities, start, end); + BasicFinancialAccountRow[] basicRows = SwarmDb.GetDatabaseForReading().GetFinancialAccountRows(Identities, start, end); return FinancialAccountRows.FromArray(basicRows); } [Obsolete("This function uses double-point variables for money. Use GetBudgetSumCents instead.")] public double GetBudgetSum(int year) { - return PirateDb.GetDatabaseForReading().GetFinancialAccountsBudget(this.Identities, year); + return SwarmDb.GetDatabaseForReading().GetFinancialAccountsBudget(this.Identities, year); } public Int64 GetBudgetSumCents(int year) { // TODO: Add support in database - return (Int64)(PirateDb.GetDatabaseForReading().GetFinancialAccountsBudget(this.Identities, year) * 100); + return (Int64)(SwarmDb.GetDatabaseForReading().GetFinancialAccountsBudget(this.Identities, year) * 100); } public Int64 GetDeltaCents(DateTime start, DateTime end) { - return PirateDb.GetDatabaseForReading().GetFinancialAccountBalanceDeltaCents(this.Identities, start, end); + return SwarmDb.GetDatabaseForReading().GetFinancialAccountBalanceDeltaCents(this.Identities, start, end); } @@ -172,7 +172,7 @@ namespace Swarmops.Logic.Financial Dictionary result = new Dictionary(); - FinancialAccounts allAccounts = FromArray(PirateDb.GetDatabaseForReading().GetFinancialAccountsForOrganization(Organization.PPSEid)); // HACK HACK HACK + FinancialAccounts allAccounts = FromArray(SwarmDb.GetDatabaseForReading().GetFinancialAccountsForOrganization(Organization.PPSEid)); // HACK HACK HACK // Add the nodes. diff --git a/Logic/Financial/FinancialTransaction.cs b/Logic/Financial/FinancialTransaction.cs index 3ec3a910..666d7ced 100644 --- a/Logic/Financial/FinancialTransaction.cs +++ b/Logic/Financial/FinancialTransaction.cs @@ -26,26 +26,26 @@ namespace Swarmops.Logic.Financial public static FinancialTransaction FromIdentity (int financialTransactionId) { - return FromBasic (PirateDb.GetDatabaseForReading().GetFinancialTransaction (financialTransactionId)); + return FromBasic (SwarmDb.GetDatabaseForReading().GetFinancialTransaction (financialTransactionId)); } public static FinancialTransaction FromDependency (IHasIdentity dependency) { - return FromBasic(PirateDb.GetDatabaseForReading().GetFinancialTransactionFromDependency(dependency)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetFinancialTransactionFromDependency(dependency)); } public static FinancialTransaction FromImportKey (Organization organization, string importKey) { return - FromBasic(PirateDb.GetDatabaseForReading().GetFinancialTransactionFromImportKey(organization.Identity, importKey)); + FromBasic(SwarmDb.GetDatabaseForReading().GetFinancialTransactionFromImportKey(organization.Identity, importKey)); } public static FinancialTransaction ImportWithStub (int organizationId, DateTime dateTime, int financialAccountId, Int64 amountCents, string description, string importHash, int personId) { - int transactionId = PirateDb.GetDatabaseForWriting().CreateFinancialTransactionStub (organizationId, dateTime, + int transactionId = SwarmDb.GetDatabaseForWriting().CreateFinancialTransactionStub (organizationId, dateTime, financialAccountId, amountCents, description, importHash, personId); @@ -60,7 +60,7 @@ namespace Swarmops.Logic.Financial public static FinancialTransaction Create (int organizationId, DateTime dateTime, string description) { - int transactionId = PirateDb.GetDatabaseForWriting().CreateFinancialTransaction (organizationId, dateTime, description); + int transactionId = SwarmDb.GetDatabaseForWriting().CreateFinancialTransaction (organizationId, dateTime, description); return FromIdentity (transactionId); } @@ -70,7 +70,7 @@ namespace Swarmops.Logic.Financial { get { - return FinancialTransactionRows.FromArray (PirateDb.GetDatabaseForReading().GetFinancialTransactionRows (Identity)); + return FinancialTransactionRows.FromArray (SwarmDb.GetDatabaseForReading().GetFinancialTransactionRows (Identity)); } } @@ -88,7 +88,7 @@ namespace Swarmops.Logic.Financial set { base.Description = value; - PirateDb.GetDatabaseForWriting().SetFinancialTransactionDescription (this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetFinancialTransactionDescription (this.Identity, value); } } @@ -130,7 +130,7 @@ namespace Swarmops.Logic.Financial return; } - PirateDb.GetDatabaseForWriting().CreateFinancialTransactionRow(Identity, financialAccountId, amountCents, personId); + SwarmDb.GetDatabaseForWriting().CreateFinancialTransactionRow(Identity, financialAccountId, amountCents, personId); } private FinancialTransaction ContinuedTransaction @@ -168,7 +168,7 @@ namespace Swarmops.Logic.Financial { set { - PirateDb.GetDatabaseForWriting().SetFinancialTransactionDependency( + SwarmDb.GetDatabaseForWriting().SetFinancialTransactionDependency( this.Identity, GetFinancialDependencyType(value), value.Identity); } get @@ -180,7 +180,7 @@ namespace Swarmops.Logic.Financial FinancialDependencyType dependencyType; int foreignId; - PirateDb.GetDatabaseForReading().GetFinancialTransactionDependency(this.Identity, out dependencyType, + SwarmDb.GetDatabaseForReading().GetFinancialTransactionDependency(this.Identity, out dependencyType, out foreignId); if (foreignId == 0) diff --git a/Logic/Financial/FinancialTransactionRow.cs b/Logic/Financial/FinancialTransactionRow.cs index e6b91790..d1df28ab 100644 --- a/Logic/Financial/FinancialTransactionRow.cs +++ b/Logic/Financial/FinancialTransactionRow.cs @@ -47,7 +47,7 @@ namespace Swarmops.Logic.Financial public static FinancialTransactionRow FromIdentity (int identity) { - return FromBasic (PirateDb.GetDatabaseForReading().GetFinancialTransactionRow (identity)); + return FromBasic (SwarmDb.GetDatabaseForReading().GetFinancialTransactionRow (identity)); } public string AccountName diff --git a/Logic/Financial/FinancialTransactions.cs b/Logic/Financial/FinancialTransactions.cs index 5347038f..ce672b32 100644 --- a/Logic/Financial/FinancialTransactions.cs +++ b/Logic/Financial/FinancialTransactions.cs @@ -18,16 +18,16 @@ namespace Swarmops.Logic.Financial public static FinancialTransactions GetUnbalanced (Organization organization) { - return FromArray(PirateDb.GetDatabaseForReading().GetUnbalancedFinancialTransactions(organization.Identity)); + return FromArray(SwarmDb.GetDatabaseForReading().GetUnbalancedFinancialTransactions(organization.Identity)); } public static FinancialTransactions GetIncomplete(int organizationId) { FinancialTransactions unbalanced = - FromArray(PirateDb.GetDatabaseForReading().GetUnbalancedFinancialTransactions(organizationId)); + FromArray(SwarmDb.GetDatabaseForReading().GetUnbalancedFinancialTransactions(organizationId)); FinancialTransactions undocumented = - FromArray(PirateDb.GetDatabaseForReading().GetUndocumentedFinancialTransactions(organizationId)); + FromArray(SwarmDb.GetDatabaseForReading().GetUndocumentedFinancialTransactions(organizationId)); FinancialTransactions allIncomplete = LogicalOr(unbalanced, undocumented); @@ -50,7 +50,7 @@ namespace Swarmops.Logic.Financial public static FinancialTransactions ForDependentObject (IHasIdentity foreignObject) { return - FromArray(PirateDb.GetDatabaseForReading().GetDependentFinancialTransactions(GetDependencyType(foreignObject), + FromArray(SwarmDb.GetDatabaseForReading().GetDependentFinancialTransactions(GetDependencyType(foreignObject), foreignObject.Identity)); } diff --git a/Logic/Financial/FinancialValidations.cs b/Logic/Financial/FinancialValidations.cs index 8d892a1e..630eae49 100644 --- a/Logic/Financial/FinancialValidations.cs +++ b/Logic/Financial/FinancialValidations.cs @@ -19,7 +19,7 @@ namespace Swarmops.Logic.Financial public static void Create (FinancialValidationType validationType, IHasIdentity foreignObject, Person actingPerson, double amount) { - PirateDb.GetDatabaseForWriting().CreateFinancialValidation(validationType, GetDependencyType(foreignObject), foreignObject.Identity, + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(validationType, GetDependencyType(foreignObject), foreignObject.Identity, DateTime.Now, actingPerson.Identity, amount); } @@ -45,7 +45,7 @@ namespace Swarmops.Logic.Financial public static FinancialValidations ForObject (IHasIdentity financialDependency) { return - FromArray(PirateDb.GetDatabaseForReading().GetFinancialValidations(GetDependencyType(financialDependency), + FromArray(SwarmDb.GetDatabaseForReading().GetFinancialValidations(GetDependencyType(financialDependency), financialDependency.Identity)); } } diff --git a/Logic/Financial/InboundInvoice.cs b/Logic/Financial/InboundInvoice.cs index f47a8fc4..60615149 100644 --- a/Logic/Financial/InboundInvoice.cs +++ b/Logic/Financial/InboundInvoice.cs @@ -16,7 +16,7 @@ namespace Swarmops.Logic.Financial FinancialAccount budget, string supplier, string payToAccount, string ocr, string invoiceReference, Person creatingPerson) { - InboundInvoice newInvoice = FromIdentity(PirateDb.GetDatabaseForWriting(). + InboundInvoice newInvoice = FromIdentity(SwarmDb.GetDatabaseForWriting(). CreateInboundInvoice(organization.Identity, dueDate, budget.Identity, supplier, payToAccount, ocr, invoiceReference, amountCents, creatingPerson.Identity)); @@ -49,7 +49,7 @@ namespace Swarmops.Logic.Financial public static InboundInvoice FromIdentity (int inboundInvoiceId) { - return new InboundInvoice(PirateDb.GetDatabaseForReading().GetInboundInvoice(inboundInvoiceId)); + return new InboundInvoice(SwarmDb.GetDatabaseForReading().GetInboundInvoice(inboundInvoiceId)); } public FinancialAccount Budget @@ -80,7 +80,7 @@ namespace Swarmops.Logic.Financial { if (base.Open != value) { - PirateDb.GetDatabaseForWriting().SetInboundInvoiceOpen(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetInboundInvoiceOpen(this.Identity, value); base.Open = value; } } @@ -108,7 +108,7 @@ namespace Swarmops.Logic.Financial { if (value != base.DueDate) { - PirateDb.GetDatabaseForWriting().SetInboundInvoiceDueDate(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetInboundInvoiceDueDate(this.Identity, value); base.DueDate = value; } } @@ -139,7 +139,7 @@ namespace Swarmops.Logic.Financial public void SetBudget (FinancialAccount budget, Person settingPerson) { base.BudgetId = budget.Identity; - PirateDb.GetDatabaseForWriting().SetInboundInvoiceBudget(this.Identity, budget.Identity); + SwarmDb.GetDatabaseForWriting().SetInboundInvoiceBudget(this.Identity, budget.Identity); UpdateTransaction(settingPerson); } @@ -147,7 +147,7 @@ namespace Swarmops.Logic.Financial public void SetAmountCents (Int64 amountCents, Person settingPerson) { base.AmountCents = amountCents; - PirateDb.GetDatabaseForWriting().SetInboundInvoiceAmount(this.Identity, amountCents); + SwarmDb.GetDatabaseForWriting().SetInboundInvoiceAmount(this.Identity, amountCents); UpdateTransaction(settingPerson); } @@ -181,8 +181,8 @@ namespace Swarmops.Logic.Financial public void Attest(Person attester) { - PirateDb.GetDatabaseForWriting().SetInboundInvoiceAttested(this.Identity, true); - PirateDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Attestation, + SwarmDb.GetDatabaseForWriting().SetInboundInvoiceAttested(this.Identity, true); + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Attestation, FinancialDependencyType.InboundInvoice, this.Identity, DateTime.Now, attester.Identity, (double) this.Amount); base.Attested = true; @@ -190,8 +190,8 @@ namespace Swarmops.Logic.Financial public void Deattest(Person deattester) { - PirateDb.GetDatabaseForWriting().SetInboundInvoiceAttested(this.Identity, false); - PirateDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Deattestation, + SwarmDb.GetDatabaseForWriting().SetInboundInvoiceAttested(this.Identity, false); + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Deattestation, FinancialDependencyType.InboundInvoice, this.Identity, DateTime.Now, deattester.Identity, (double) this.Amount); base.Attested = false; diff --git a/Logic/Financial/InboundInvoices.cs b/Logic/Financial/InboundInvoices.cs index 4e748028..dd39f3aa 100644 --- a/Logic/Financial/InboundInvoices.cs +++ b/Logic/Financial/InboundInvoices.cs @@ -28,7 +28,7 @@ namespace Swarmops.Logic.Financial /// The list of inbound invoices. public static InboundInvoices ForOrganization (Organization organization, bool includeClosed) { - return FromArray (PirateDb.GetDatabaseForReading().GetInboundInvoices(organization, + return FromArray (SwarmDb.GetDatabaseForReading().GetInboundInvoices(organization, includeClosed ? DatabaseCondition.None : DatabaseCondition.OpenTrue)); diff --git a/Logic/Financial/OrganizationFinancialAccounts.cs b/Logic/Financial/OrganizationFinancialAccounts.cs index 96392ba3..0243ac8c 100644 --- a/Logic/Financial/OrganizationFinancialAccounts.cs +++ b/Logic/Financial/OrganizationFinancialAccounts.cs @@ -15,7 +15,7 @@ namespace Swarmops.Logic.Financial public static void PrimePiratpartietSE() // One-off. Once this has been run once, delete it. { /* -- this was a one-time one-off - if (PirateDb.GetDatabaseForReading().GetOrganizationFinancialAccountId(1, OrganizationFinancialAccountType.AssetsBankAccountMain) != 0) + if (SwarmDb.GetDatabaseForReading().GetOrganizationFinancialAccountId(1, OrganizationFinancialAccountType.AssetsBankAccountMain) != 0) { return; } @@ -75,11 +75,11 @@ namespace Swarmops.Logic.Financial { get { - return FinancialAccount.FromIdentity(PirateDb.GetDatabaseForReading().GetOrganizationFinancialAccountId(_organizationId, accountType)); + return FinancialAccount.FromIdentity(SwarmDb.GetDatabaseForReading().GetOrganizationFinancialAccountId(_organizationId, accountType)); } set { - PirateDb.GetDatabaseForWriting().SetOrganizationFinancialAccountId(_organizationId, accountType, + SwarmDb.GetDatabaseForWriting().SetOrganizationFinancialAccountId(_organizationId, accountType, value.Identity); } } diff --git a/Logic/Financial/OutboundInvoice.cs b/Logic/Financial/OutboundInvoice.cs index 62bcc1cb..8fca0b3d 100644 --- a/Logic/Financial/OutboundInvoice.cs +++ b/Logic/Financial/OutboundInvoice.cs @@ -25,7 +25,7 @@ namespace Swarmops.Logic.Financial public static OutboundInvoice FromIdentity (int outboundInvoiceId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetOutboundInvoice(outboundInvoiceId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetOutboundInvoice(outboundInvoiceId)); } public static OutboundInvoice FromReference (string reference) @@ -50,7 +50,7 @@ namespace Swarmops.Logic.Financial public static OutboundInvoice Create (Organization organization, Person createdByPerson, DateTime dueDate, FinancialAccount budget, string customerName, string invoiceAddressMail, string invoiceAddressPaper, Currency currency, bool domestic, string theirReference) { - OutboundInvoice invoice = FromIdentity (PirateDb.GetDatabaseForWriting().CreateOutboundInvoice(organization.Identity, createdByPerson != null? createdByPerson.Identity : 0, dueDate, + OutboundInvoice invoice = FromIdentity (SwarmDb.GetDatabaseForWriting().CreateOutboundInvoice(organization.Identity, createdByPerson != null? createdByPerson.Identity : 0, dueDate, budget.Identity, customerName, invoiceAddressPaper, invoiceAddressMail, currency.Identity, string.Empty, domestic, Authentication.CreateRandomPassword(6), theirReference)); @@ -74,7 +74,7 @@ namespace Swarmops.Logic.Financial public void AddItem(string description, double amount) { - PirateDb.GetDatabaseForWriting().CreateOutboundInvoiceItem(this.Identity, description, amount); + SwarmDb.GetDatabaseForWriting().CreateOutboundInvoiceItem(this.Identity, description, amount); } @@ -82,7 +82,7 @@ namespace Swarmops.Logic.Financial { // NOTE: MUST NOT ADD FINANCIAL TRANSACTION LINES HERE; SURCHARGES ARE ADDED AS LINE ITEMS ON PAYMENT - PirateDb.GetDatabaseForWriting().CreateOutboundInvoiceItem(this.Identity, description, amountCents); + SwarmDb.GetDatabaseForWriting().CreateOutboundInvoiceItem(this.Identity, description, amountCents); } @@ -147,7 +147,7 @@ namespace Swarmops.Logic.Financial { if (value == true) { - PirateDb.GetDatabaseForWriting().SetOutboundInvoiceSent(this.Identity, true); + SwarmDb.GetDatabaseForWriting().SetOutboundInvoiceSent(this.Identity, true); base.Sent = true; } else @@ -165,7 +165,7 @@ namespace Swarmops.Logic.Financial { if (value != base.Open) { - PirateDb.GetDatabaseForWriting().SetOutboundInvoiceOpen(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetOutboundInvoiceOpen(this.Identity, value); base.Open = value; } } @@ -204,7 +204,7 @@ namespace Swarmops.Logic.Financial } set { - PirateDb.GetDatabaseForWriting().SetOutboundInvoiceReference(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetOutboundInvoiceReference(this.Identity, value); base.Reference = value; } } diff --git a/Logic/Financial/OutboundInvoiceItem.cs b/Logic/Financial/OutboundInvoiceItem.cs index 99470799..4373ab99 100644 --- a/Logic/Financial/OutboundInvoiceItem.cs +++ b/Logic/Financial/OutboundInvoiceItem.cs @@ -20,7 +20,7 @@ namespace Swarmops.Logic.Financial public static OutboundInvoiceItem FromIdentity (int outboundInvoiceItemId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetOutboundInvoiceItem(outboundInvoiceItemId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetOutboundInvoiceItem(outboundInvoiceItemId)); } public decimal Amount diff --git a/Logic/Financial/OutboundInvoiceItems.cs b/Logic/Financial/OutboundInvoiceItems.cs index 45aaa7c4..d986dd68 100644 --- a/Logic/Financial/OutboundInvoiceItems.cs +++ b/Logic/Financial/OutboundInvoiceItems.cs @@ -11,7 +11,7 @@ namespace Swarmops.Logic.Financial { public static OutboundInvoiceItems ForInvoice (OutboundInvoice invoice) { - return FromArray(PirateDb.GetDatabaseForReading().GetOutboundInvoiceItems(invoice)); + return FromArray(SwarmDb.GetDatabaseForReading().GetOutboundInvoiceItems(invoice)); } } } diff --git a/Logic/Financial/OutboundInvoices.cs b/Logic/Financial/OutboundInvoices.cs index 8459b788..306ee082 100644 --- a/Logic/Financial/OutboundInvoices.cs +++ b/Logic/Financial/OutboundInvoices.cs @@ -19,11 +19,11 @@ namespace Swarmops.Logic.Financial { if (includeClosed) { - return FromArray(PirateDb.GetDatabaseForReading().GetOutboundInvoices(organization)); + return FromArray(SwarmDb.GetDatabaseForReading().GetOutboundInvoices(organization)); } else { - return FromArray (PirateDb.GetDatabaseForReading().GetOutboundInvoices(organization, DatabaseCondition.OpenTrue)); + return FromArray (SwarmDb.GetDatabaseForReading().GetOutboundInvoices(organization, DatabaseCondition.OpenTrue)); } } } diff --git a/Logic/Financial/Payment.cs b/Logic/Financial/Payment.cs index 4e2b0840..d35a9e1f 100644 --- a/Logic/Financial/Payment.cs +++ b/Logic/Financial/Payment.cs @@ -26,12 +26,12 @@ namespace Swarmops.Logic.Financial public static Payment FromIdentity (int paymentId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetPayment(paymentId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetPayment(paymentId)); } public static Payment ForOutboundInvoice (OutboundInvoice invoice) { - BasicPayment[] array = PirateDb.GetDatabaseForReading().GetPayments(invoice); + BasicPayment[] array = SwarmDb.GetDatabaseForReading().GetPayments(invoice); if (array.Length == 0) { @@ -61,7 +61,7 @@ namespace Swarmops.Logic.Financial PWEvents.CreateEvent(EventSource.PirateWeb, EventType.OutboundInvoicePaid, 0, group.Organization.Identity, Geography.RootIdentity, 0, invoice.Identity, string.Empty); - return FromIdentity (PirateDb.GetDatabaseForWriting().CreatePayment(group.Identity, amount, reference, fromAccount, key, hasImage, + return FromIdentity (SwarmDb.GetDatabaseForWriting().CreatePayment(group.Identity, amount, reference, fromAccount, key, hasImage, invoice.Identity)); } @@ -74,7 +74,7 @@ namespace Swarmops.Logic.Financial invoice.SetPaid(); PaymentGroup group = PaymentGroup.Create(organization, dateTime, currency, createdByPerson); - Payment newPayment = FromIdentity(PirateDb.GetDatabaseForWriting().CreatePayment(group.Identity, amountCents, string.Empty, string.Empty, string.Empty, false, + Payment newPayment = FromIdentity(SwarmDb.GetDatabaseForWriting().CreatePayment(group.Identity, amountCents, string.Empty, string.Empty, string.Empty, false, invoice.Identity)); group.AmountCents = amountCents; @@ -155,7 +155,7 @@ namespace Swarmops.Logic.Financial { if (!string.IsNullOrEmpty(data)) { - PirateDb.GetDatabaseForWriting().CreatePaymentInformation(this.Identity, type, data); + SwarmDb.GetDatabaseForWriting().CreatePaymentInformation(this.Identity, type, data); } } diff --git a/Logic/Financial/PaymentGroup.cs b/Logic/Financial/PaymentGroup.cs index 6fcfbd38..983cb1e7 100644 --- a/Logic/Financial/PaymentGroup.cs +++ b/Logic/Financial/PaymentGroup.cs @@ -17,7 +17,7 @@ namespace Swarmops.Logic.Financial public static PaymentGroup FromIdentity (int paymentGroupId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetPaymentGroup(paymentGroupId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetPaymentGroup(paymentGroupId)); } public static PaymentGroup FromBasic (BasicPaymentGroup basic) @@ -28,14 +28,14 @@ namespace Swarmops.Logic.Financial public static PaymentGroup Create (Organization organization, DateTime timestamp, Currency currency, Person createdByPerson) { return - FromIdentity(PirateDb.GetDatabaseForWriting().CreatePaymentGroup(organization.Identity, timestamp, + FromIdentity(SwarmDb.GetDatabaseForWriting().CreatePaymentGroup(organization.Identity, timestamp, currency.Identity, System.DateTime.Now, createdByPerson.Identity)); } public static PaymentGroup FromTag (Organization organization, string tag) { - BasicPaymentGroup basicGroup = PirateDb.GetDatabaseForReading().GetPaymentGroupByTag(organization.Identity, tag); + BasicPaymentGroup basicGroup = SwarmDb.GetDatabaseForReading().GetPaymentGroupByTag(organization.Identity, tag); if (basicGroup == null) { @@ -56,7 +56,7 @@ namespace Swarmops.Logic.Financial set { base.Tag = value; - PirateDb.GetDatabaseForWriting().SetPaymentGroupTag(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetPaymentGroupTag(this.Identity, value); } } @@ -66,7 +66,7 @@ namespace Swarmops.Logic.Financial set { base.AmountCents = value; - PirateDb.GetDatabaseForWriting().SetPaymentGroupAmount(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetPaymentGroupAmount(this.Identity, value); } } @@ -81,7 +81,7 @@ namespace Swarmops.Logic.Financial set { base.Open = value; - PirateDb.GetDatabaseForWriting().SetPaymentGroupOpen(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetPaymentGroupOpen(this.Identity, value); } } diff --git a/Logic/Financial/PaymentGroups.cs b/Logic/Financial/PaymentGroups.cs index 44e2f744..bdc4d1ca 100644 --- a/Logic/Financial/PaymentGroups.cs +++ b/Logic/Financial/PaymentGroups.cs @@ -19,11 +19,11 @@ namespace Swarmops.Logic.Financial { if (includeClosed) { - return FromArray(PirateDb.GetDatabaseForReading().GetPaymentGroups(organization)); + return FromArray(SwarmDb.GetDatabaseForReading().GetPaymentGroups(organization)); } else { - return FromArray(PirateDb.GetDatabaseForReading().GetPaymentGroups(organization, DatabaseCondition.OpenTrue)); + return FromArray(SwarmDb.GetDatabaseForReading().GetPaymentGroups(organization, DatabaseCondition.OpenTrue)); } } } diff --git a/Logic/Financial/PaymentInformation.cs b/Logic/Financial/PaymentInformation.cs index 17c5743f..764e8ac7 100644 --- a/Logic/Financial/PaymentInformation.cs +++ b/Logic/Financial/PaymentInformation.cs @@ -37,7 +37,7 @@ namespace Swarmops.Logic.Financial public static PaymentInformationList ForPayment (Payment payment) { - BasicPaymentInformation[] basicInfoList = PirateDb.GetDatabaseForReading().GetPaymentInformation(payment.Identity); + BasicPaymentInformation[] basicInfoList = SwarmDb.GetDatabaseForReading().GetPaymentInformation(payment.Identity); return FromArray(basicInfoList); } diff --git a/Logic/Financial/Payments.cs b/Logic/Financial/Payments.cs index f7324a8f..eb255309 100644 --- a/Logic/Financial/Payments.cs +++ b/Logic/Financial/Payments.cs @@ -11,7 +11,7 @@ namespace Swarmops.Logic.Financial { public static Payments ForPaymentGroup (PaymentGroup group) { - return FromArray(PirateDb.GetDatabaseForReading().GetPayments(group)); + return FromArray(SwarmDb.GetDatabaseForReading().GetPayments(group)); } } } diff --git a/Logic/Financial/Payout.cs b/Logic/Financial/Payout.cs index 59021205..4e63b7e5 100644 --- a/Logic/Financial/Payout.cs +++ b/Logic/Financial/Payout.cs @@ -44,7 +44,7 @@ namespace Swarmops.Logic.Financial DependentSalariesNet = new Salaries(); DependentSalariesTax = new Salaries(); - BasicFinancialDependency[] dependencies = PirateDb.GetDatabaseForReading().GetPayoutDependencies(this.Identity); + BasicFinancialDependency[] dependencies = SwarmDb.GetDatabaseForReading().GetPayoutDependencies(this.Identity); foreach (BasicFinancialDependency dependency in dependencies) { @@ -81,7 +81,7 @@ namespace Swarmops.Logic.Financial public static Payout FromIdentity (int payoutId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetPayout(payoutId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetPayout(payoutId)); } @@ -98,7 +98,7 @@ namespace Swarmops.Logic.Financial { if (this.Identity != 0) { - PirateDb.GetDatabaseForWriting().SetPayoutAmount(this.Identity, (Int64)(value * 100)); + SwarmDb.GetDatabaseForWriting().SetPayoutAmount(this.Identity, (Int64)(value * 100)); } base.AmountCents = (Int64)value * 100; } @@ -114,7 +114,7 @@ namespace Swarmops.Logic.Financial { if (this.Identity != 0) { - PirateDb.GetDatabaseForWriting().SetPayoutAmount(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetPayoutAmount(this.Identity, value); } base.AmountCents = value; } @@ -130,7 +130,7 @@ namespace Swarmops.Logic.Financial { if (this.Identity != 0) { - PirateDb.GetDatabaseForWriting().SetPayoutReference(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetPayoutReference(this.Identity, value); } base.Reference = value; } @@ -149,7 +149,7 @@ namespace Swarmops.Logic.Financial } set { - PirateDb.GetDatabaseForWriting().SetPayoutOpen(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetPayoutOpen(this.Identity, value); base.Open = value; } } @@ -211,13 +211,13 @@ namespace Swarmops.Logic.Financial referenceString = "Expense Claims " + Formatting.GenerateRangeString(identityList); } - int payoutId = PirateDb.GetDatabaseForWriting().CreatePayout(organizationId, bank, account, + int payoutId = SwarmDb.GetDatabaseForWriting().CreatePayout(organizationId, bank, account, referenceString, amountCents, DateTime.Today.AddDays(1), creator.Identity); foreach (int claimId in identityList) { - PirateDb.GetDatabaseForWriting().CreatePayoutDependency(payoutId, FinancialDependencyType.ExpenseClaim, + SwarmDb.GetDatabaseForWriting().CreatePayoutDependency(payoutId, FinancialDependencyType.ExpenseClaim, claimId); } @@ -236,12 +236,12 @@ namespace Swarmops.Logic.Financial expectedPayment = DateTime.Today; } - int payoutId = PirateDb.GetDatabaseForWriting().CreatePayout(invoice.OrganizationId, string.Empty, invoice.PayToAccount, + int payoutId = SwarmDb.GetDatabaseForWriting().CreatePayout(invoice.OrganizationId, string.Empty, invoice.PayToAccount, invoice.Ocr.Length > 0 ? "OCR " + invoice.Ocr : "Ref# " + invoice.InvoiceReference, invoice.AmountCents, expectedPayment, creator.Identity); - PirateDb.GetDatabaseForWriting().CreatePayoutDependency(payoutId, FinancialDependencyType.InboundInvoice, + SwarmDb.GetDatabaseForWriting().CreatePayoutDependency(payoutId, FinancialDependencyType.InboundInvoice, invoice.Identity); invoice.Open = false; @@ -254,12 +254,12 @@ namespace Swarmops.Logic.Financial Salary salary = Salary.FromIdentity(Int32.Parse(components[0].Substring(1))); - int payoutId = PirateDb.GetDatabaseForWriting().CreatePayout(salary.PayrollItem.OrganizationId, salary.PayrollItem.Person.BankName, salary.PayrollItem.Person.BankAccount, + int payoutId = SwarmDb.GetDatabaseForWriting().CreatePayout(salary.PayrollItem.OrganizationId, salary.PayrollItem.Person.BankName, salary.PayrollItem.Person.BankAccount, "Salary " + salary.PayoutDate.ToString("yyyy-MMM"), salary.NetSalaryCents, salary.PayoutDate, creator.Identity); - PirateDb.GetDatabaseForWriting().CreatePayoutDependency(payoutId, FinancialDependencyType.Salary, + SwarmDb.GetDatabaseForWriting().CreatePayoutDependency(payoutId, FinancialDependencyType.Salary, salary.Identity); salary.NetPaid = true; @@ -305,12 +305,12 @@ namespace Swarmops.Logic.Financial referenceString = "Tax for salaries " + Formatting.GenerateRangeString(identityList); } - int payoutId = PirateDb.GetDatabaseForWriting().CreatePayout(organization.Identity, "The Tax Man", organization.Parameters.TaxAccount, organization.Parameters.TaxOcr, + int payoutId = SwarmDb.GetDatabaseForWriting().CreatePayout(organization.Identity, "The Tax Man", organization.Parameters.TaxAccount, organization.Parameters.TaxOcr, amountCents, payDay, creator.Identity); foreach (int salaryId in identityList) { - PirateDb.GetDatabaseForWriting().CreatePayoutDependency(payoutId, FinancialDependencyType.Salary, + SwarmDb.GetDatabaseForWriting().CreatePayoutDependency(payoutId, FinancialDependencyType.Salary, salaryId); } @@ -457,7 +457,7 @@ namespace Swarmops.Logic.Financial public void MigrateDependenciesTo (Payout migrationTarget) { - PirateDb.GetDatabaseForWriting().MovePayoutDependencies(this.Identity, migrationTarget.Identity); + SwarmDb.GetDatabaseForWriting().MovePayoutDependencies(this.Identity, migrationTarget.Identity); migrationTarget.RecalculateAmount(); this.RecalculateAmount(); } @@ -502,7 +502,7 @@ namespace Swarmops.Logic.Financial salary.TaxPaid = false; } - PirateDb.GetDatabaseForWriting().ClearPayoutDependencies(this.Identity); + SwarmDb.GetDatabaseForWriting().ClearPayoutDependencies(this.Identity); RecalculateAmount(); this.Open = false; } diff --git a/Logic/Financial/Payouts.cs b/Logic/Financial/Payouts.cs index c3203d85..06434686 100644 --- a/Logic/Financial/Payouts.cs +++ b/Logic/Financial/Payouts.cs @@ -20,11 +20,11 @@ namespace Swarmops.Logic.Financial { if (includeClosed) { - return FromArray(PirateDb.GetDatabaseForReading().GetPayouts(organization)); + return FromArray(SwarmDb.GetDatabaseForReading().GetPayouts(organization)); } else { - return FromArray(PirateDb.GetDatabaseForReading().GetPayouts(organization, DatabaseCondition.OpenTrue)); + return FromArray(SwarmDb.GetDatabaseForReading().GetPayouts(organization, DatabaseCondition.OpenTrue)); } } diff --git a/Logic/Financial/Payroll.cs b/Logic/Financial/Payroll.cs index bbc0aab6..f9235e0c 100644 --- a/Logic/Financial/Payroll.cs +++ b/Logic/Financial/Payroll.cs @@ -29,7 +29,7 @@ namespace Swarmops.Logic.Financial /// The payroll. public static Payroll ForOrganization (Organization organization, bool includeClosed) { - return FromArray(PirateDb.GetDatabaseForReading().GetPayroll(organization, + return FromArray(SwarmDb.GetDatabaseForReading().GetPayroll(organization, includeClosed? DatabaseCondition.None : DatabaseCondition.OpenTrue)); } @@ -51,7 +51,7 @@ namespace Swarmops.Logic.Financial /// The payroll. public static Payroll GetAll(bool includeClosed) { - return FromArray(PirateDb.GetDatabaseForReading().GetPayroll(includeClosed? DatabaseCondition.None : DatabaseCondition.OpenTrue)); + return FromArray(SwarmDb.GetDatabaseForReading().GetPayroll(includeClosed? DatabaseCondition.None : DatabaseCondition.OpenTrue)); } } } diff --git a/Logic/Financial/PayrollAdjustment.cs b/Logic/Financial/PayrollAdjustment.cs index 61a414a7..315919c0 100644 --- a/Logic/Financial/PayrollAdjustment.cs +++ b/Logic/Financial/PayrollAdjustment.cs @@ -20,7 +20,7 @@ namespace Swarmops.Logic.Financial public static PayrollAdjustment FromIdentity (int payrollAdjustmentId) { - return FromBasic (PirateDb.GetDatabaseForReading().GetPayrollAdjustment(payrollAdjustmentId)); + return FromBasic (SwarmDb.GetDatabaseForReading().GetPayrollAdjustment(payrollAdjustmentId)); } @@ -45,7 +45,7 @@ namespace Swarmops.Logic.Financial throw new InvalidOperationException("Payroll adjustment #" + this.Identity.ToString() + " cannot be closed; is already closed"); } - PirateDb.GetDatabaseForWriting().ClosePayrollAdjustment(this.Identity, salary.Identity); + SwarmDb.GetDatabaseForWriting().ClosePayrollAdjustment(this.Identity, salary.Identity); base.Open = false; base.SalaryId = salary.Identity; } @@ -53,7 +53,7 @@ namespace Swarmops.Logic.Financial public static PayrollAdjustment Create (PayrollItem item, PayrollAdjustmentType type, double amount, string description) { - int id = PirateDb.GetDatabaseForWriting().CreatePayrollAdjustment(item.Identity, type, amount, description); + int id = SwarmDb.GetDatabaseForWriting().CreatePayrollAdjustment(item.Identity, type, amount, description); return PayrollAdjustment.FromIdentity(id); } diff --git a/Logic/Financial/PayrollAdjustments.cs b/Logic/Financial/PayrollAdjustments.cs index 4283a578..880fd700 100644 --- a/Logic/Financial/PayrollAdjustments.cs +++ b/Logic/Financial/PayrollAdjustments.cs @@ -11,12 +11,12 @@ namespace Swarmops.Logic.Financial { static public PayrollAdjustments ForPayrollItem (PayrollItem payrollItem) { - return FromArray(PirateDb.GetDatabaseForReading().GetPayrollAdjustments(payrollItem, DatabaseCondition.OpenTrue)); + return FromArray(SwarmDb.GetDatabaseForReading().GetPayrollAdjustments(payrollItem, DatabaseCondition.OpenTrue)); } static public PayrollAdjustments ForSalary (Salary salary) { - return FromArray(PirateDb.GetDatabaseForReading().GetPayrollAdjustments(salary)); + return FromArray(SwarmDb.GetDatabaseForReading().GetPayrollAdjustments(salary)); } } } diff --git a/Logic/Financial/PayrollItem.cs b/Logic/Financial/PayrollItem.cs index d2eb3a52..3a678804 100644 --- a/Logic/Financial/PayrollItem.cs +++ b/Logic/Financial/PayrollItem.cs @@ -22,7 +22,7 @@ namespace Swarmops.Logic.Financial public static PayrollItem FromIdentity (int payrollItemId) { - return FromBasic (PirateDb.GetDatabaseForReading().GetPayrollItem(payrollItemId)); + return FromBasic (SwarmDb.GetDatabaseForReading().GetPayrollItem(payrollItemId)); } diff --git a/Logic/Financial/Refund.cs b/Logic/Financial/Refund.cs index 5b1d897d..3cbc9788 100644 --- a/Logic/Financial/Refund.cs +++ b/Logic/Financial/Refund.cs @@ -24,7 +24,7 @@ namespace Swarmops.Logic.Financial public static Refund FromIdentity (int refundId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetRefund(refundId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetRefund(refundId)); } public static Refund Create (Payment payment, Person creatingPerson) @@ -39,7 +39,7 @@ namespace Swarmops.Logic.Financial throw new ArgumentException("Refund amount cannot exceed payment amount"); } - Refund refund = FromIdentity(PirateDb.GetDatabaseForWriting().CreateRefund(payment.Identity, creatingPerson.Identity, amountCents)); + Refund refund = FromIdentity(SwarmDb.GetDatabaseForWriting().CreateRefund(payment.Identity, creatingPerson.Identity, amountCents)); PWEvents.CreateEvent(EventSource.PirateWeb, EventType.RefundCreated, 0, refund.Payment.OutboundInvoice.Organization.Identity, Geography.RootIdentity, 0, refund.Identity, string.Empty); diff --git a/Logic/Financial/Salaries.cs b/Logic/Financial/Salaries.cs index c876f2a3..b78270bb 100644 --- a/Logic/Financial/Salaries.cs +++ b/Logic/Financial/Salaries.cs @@ -17,7 +17,7 @@ namespace Swarmops.Logic.Financial static public Salaries ForOrganization(Organization organization, bool includeClosed) { - return FromArray (PirateDb.GetDatabaseForReading().GetSalaries(organization, + return FromArray (SwarmDb.GetDatabaseForReading().GetSalaries(organization, includeClosed? DatabaseCondition.None : DatabaseCondition.OpenTrue)); } diff --git a/Logic/Financial/Salary.cs b/Logic/Financial/Salary.cs index 1257c98a..d428742c 100644 --- a/Logic/Financial/Salary.cs +++ b/Logic/Financial/Salary.cs @@ -24,7 +24,7 @@ namespace Swarmops.Logic.Financial static public Salary FromIdentity (int salaryId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetSalary(salaryId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetSalary(salaryId)); } static public Salary Create (int payrollItemId, DateTime payoutDate) @@ -135,7 +135,7 @@ namespace Swarmops.Logic.Financial static private Salary Create (PayrollItem payrollItem, DateTime payoutDate, Int64 netSalaryCents, Int64 subtractiveTaxCents, Int64 additiveTaxCents) { return - FromIdentity(PirateDb.GetDatabaseForWriting().CreateSalary(payrollItem.Identity, payoutDate, payrollItem.BaseSalaryCents, netSalaryCents, + FromIdentity(SwarmDb.GetDatabaseForWriting().CreateSalary(payrollItem.Identity, payoutDate, payrollItem.BaseSalaryCents, netSalaryCents, subtractiveTaxCents, additiveTaxCents)); } @@ -185,7 +185,7 @@ namespace Swarmops.Logic.Financial { if (value != base.NetSalaryCents) { - PirateDb.GetDatabaseForWriting().SetSalaryNetSalary(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetSalaryNetSalary(this.Identity, value); base.NetSalaryCents = value; } } @@ -239,7 +239,7 @@ namespace Swarmops.Logic.Financial get { return base.NetPaid; } set { - PirateDb.GetDatabaseForWriting().SetSalaryNetPaid(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetSalaryNetPaid(this.Identity, value); base.NetPaid = value; base.Open = !(base.NetPaid && base.TaxPaid); } @@ -250,7 +250,7 @@ namespace Swarmops.Logic.Financial get { return base.TaxPaid; } set { - PirateDb.GetDatabaseForWriting().SetSalaryTaxPaid(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetSalaryTaxPaid(this.Identity, value); base.NetPaid = value; base.Open = !(base.NetPaid && base.TaxPaid); } @@ -287,9 +287,9 @@ namespace Swarmops.Logic.Financial public void Attest(Person attester) { - PirateDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Attestation, + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Attestation, FinancialDependencyType.Salary, this.Identity, DateTime.Now, attester.Identity, this.NetSalaryCents / 100.0); - PirateDb.GetDatabaseForWriting().SetSalaryAttested(this.Identity, true); + SwarmDb.GetDatabaseForWriting().SetSalaryAttested(this.Identity, true); } public void Deattest(Person deattester) diff --git a/Logic/Financial/TaxLevels.cs b/Logic/Financial/TaxLevels.cs index 0cbcf62e..5d1eb33e 100644 --- a/Logic/Financial/TaxLevels.cs +++ b/Logic/Financial/TaxLevels.cs @@ -16,7 +16,7 @@ namespace Swarmops.Logic.Financial return 0.0; // no tax } - double taxLevel = PirateDb.GetDatabaseForReading().GetTaxLevel(country.Identity, taxLevelIdentifier, + double taxLevel = SwarmDb.GetDatabaseForReading().GetTaxLevel(country.Identity, taxLevelIdentifier, (int) Math.Floor(grossSalary)); if (taxLevel < 1.0) @@ -39,7 +39,7 @@ namespace Swarmops.Logic.Financial // Clear existing tables for countryId - PirateDb.GetDatabaseForWriting().DeleteTaxLevels(country.Identity); + SwarmDb.GetDatabaseForWriting().DeleteTaxLevels(country.Identity); string[] lines = data.Split('\n'); // if \r\n is used, the \r will be harmlessly at the end of lines @@ -70,7 +70,7 @@ namespace Swarmops.Logic.Financial tax = tax / 100.0; } - PirateDb.GetDatabaseForWriting().CreateTaxLevel(country.Identity, taxLevelId, lowerBracket, tax); + SwarmDb.GetDatabaseForWriting().CreateTaxLevel(country.Identity, taxLevelId, lowerBracket, tax); } } diff --git a/Logic/Governance/Ballot.cs b/Logic/Governance/Ballot.cs index 26c8adfa..1dcf0fa6 100644 --- a/Logic/Governance/Ballot.cs +++ b/Logic/Governance/Ballot.cs @@ -22,29 +22,29 @@ namespace Swarmops.Logic.Governance public static Ballot FromIdentity (int ballotId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetBallot(ballotId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetBallot(ballotId)); } public static Ballot Create (Election election, Organization organization, Geography geography, string name, int ballotCount, string deliveryAddress) { - return FromIdentity(PirateDb.GetDatabaseForWriting().CreateBallot(election.Identity, name, organization.Identity, geography.Identity, ballotCount, deliveryAddress)); + return FromIdentity(SwarmDb.GetDatabaseForWriting().CreateBallot(election.Identity, name, organization.Identity, geography.Identity, ballotCount, deliveryAddress)); } public void AddCandidate (Person person) { - PirateDb.GetDatabaseForWriting().CreateBallotCandidate(this.Identity, person.Identity); + SwarmDb.GetDatabaseForWriting().CreateBallotCandidate(this.Identity, person.Identity); } public void ClearCandidates() { - PirateDb.GetDatabaseForWriting().ClearBallotCandidates(this.Identity); + SwarmDb.GetDatabaseForWriting().ClearBallotCandidates(this.Identity); } public People Candidates { get { - return People.FromIdentities(PirateDb.GetDatabaseForReading().GetBallotCandidates(this.Identity), true); + return People.FromIdentities(SwarmDb.GetDatabaseForReading().GetBallotCandidates(this.Identity), true); } } @@ -59,7 +59,7 @@ namespace Swarmops.Logic.Governance { if (value != base.Count) { base.Count = value; - PirateDb.GetDatabaseForWriting().SetBallotCount(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetBallotCount(this.Identity, value); } } get { return base.Count; } @@ -72,7 +72,7 @@ namespace Swarmops.Logic.Governance if (value != base.DeliveryAddress) { base.DeliveryAddress = value; - PirateDb.GetDatabaseForWriting().SetBallotDeliveryAddress(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetBallotDeliveryAddress(this.Identity, value); } } get { return base.DeliveryAddress; } diff --git a/Logic/Governance/Ballots.cs b/Logic/Governance/Ballots.cs index bdc102c5..7b79dcb4 100644 --- a/Logic/Governance/Ballots.cs +++ b/Logic/Governance/Ballots.cs @@ -15,12 +15,12 @@ namespace Swarmops.Logic.Governance public static Ballots ForElection (Election election) { - return FromArray(PirateDb.GetDatabaseForReading().GetBallots(election, Organization.PPSE)); // HACK HACK HACK -- PPSE hardcoded + return FromArray(SwarmDb.GetDatabaseForReading().GetBallots(election, Organization.PPSE)); // HACK HACK HACK -- PPSE hardcoded } public static Dictionary GetBallotsForPerson (Person person) { - return PirateDb.GetDatabaseForReading().GetBallotsForPerson(person.Identity); + return SwarmDb.GetDatabaseForReading().GetBallotsForPerson(person.Identity); } } } diff --git a/Logic/Governance/Election.cs b/Logic/Governance/Election.cs index f66b4daa..1bb64898 100644 --- a/Logic/Governance/Election.cs +++ b/Logic/Governance/Election.cs @@ -45,13 +45,13 @@ namespace Swarmops.Logic.Governance public People GetDocumentedCandidates (Organization organization) { return - People.FromIdentities(PirateDb.GetDatabaseForReading().GetDocumentedCandidates(this.Identity, + People.FromIdentities(SwarmDb.GetDatabaseForReading().GetDocumentedCandidates(this.Identity, organization.Identity)); } public void SetCandidateDocumented (Organization organization, Person candidate) { - PirateDb.GetDatabaseForWriting().SetCandidateDocumentationReceived(this.Identity, organization.Identity, candidate.Identity); + SwarmDb.GetDatabaseForWriting().SetCandidateDocumentationReceived(this.Identity, organization.Identity, candidate.Identity); } public static Election September2010 { get { return FromIdentity(3); } } diff --git a/Logic/Governance/Meeting.cs b/Logic/Governance/Meeting.cs index cc2ee653..717ae353 100644 --- a/Logic/Governance/Meeting.cs +++ b/Logic/Governance/Meeting.cs @@ -20,7 +20,7 @@ namespace Swarmops.Logic.Governance public static Meeting FromIdentity (int meetingId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetMeeting(meetingId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetMeeting(meetingId)); } } } \ No newline at end of file diff --git a/Logic/Governance/MeetingElection.cs b/Logic/Governance/MeetingElection.cs index a01888ea..36543433 100644 --- a/Logic/Governance/MeetingElection.cs +++ b/Logic/Governance/MeetingElection.cs @@ -24,7 +24,7 @@ namespace Swarmops.Logic.Governance public static MeetingElection Create (Person creator, Organization org, Geography geo, string name, InternalPollResultsType resultsType, int maxVoteLength, DateTime runningOpens, DateTime runningCloses, DateTime votingOpens, DateTime votingCloses) { return - FromIdentity(PirateDb.GetDatabaseForWriting().CreateInternalPoll(org.Identity, geo.Identity, name, maxVoteLength, + FromIdentity(SwarmDb.GetDatabaseForWriting().CreateInternalPoll(org.Identity, geo.Identity, name, maxVoteLength, resultsType, creator.Identity, runningOpens, runningCloses, votingOpens, votingCloses)); } @@ -32,7 +32,7 @@ namespace Swarmops.Logic.Governance public static MeetingElection FromIdentity (int internalPollId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetInternalPoll(internalPollId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetInternalPoll(internalPollId)); } @@ -63,12 +63,12 @@ namespace Swarmops.Logic.Governance public void AddVoter (Person person) { - PirateDb.GetDatabaseForWriting().CreateInternalPollVoter(this.Identity, person.Identity); + SwarmDb.GetDatabaseForWriting().CreateInternalPollVoter(this.Identity, person.Identity); } public MeetingElectionVote CreateVote(Person person, string ipAddress) { - if (PirateDb.GetDatabaseForReading().GetInternalPollVoterStatus(this.Identity, person.Identity) != InternalPollVoterStatus.CanVote) + if (SwarmDb.GetDatabaseForReading().GetInternalPollVoterStatus(this.Identity, person.Identity) != InternalPollVoterStatus.CanVote) { throw new InvalidOperationException("Voter status is not open"); } @@ -87,18 +87,18 @@ namespace Swarmops.Logic.Governance voteGeography = person.Geography; } - PirateDb.GetDatabaseForWriting().CloseInternalPollVoter(this.Identity, person.Identity, ipAddress); + SwarmDb.GetDatabaseForWriting().CloseInternalPollVoter(this.Identity, person.Identity, ipAddress); return MeetingElectionVote.Create(this, voteGeography); } public InternalPollVoterStatus GetVoterStatus (Person person) { - return PirateDb.GetDatabaseForReading().GetInternalPollVoterStatus(this.Identity, person.Identity); + return SwarmDb.GetDatabaseForReading().GetInternalPollVoterStatus(this.Identity, person.Identity); } public Dictionary GetCandidatePersonMap() { - return PirateDb.GetDatabaseForReading().GetCandidateIdPersonIdMap(this.Identity); + return SwarmDb.GetDatabaseForReading().GetCandidateIdPersonIdMap(this.Identity); } public MeetingElectionVoters GetClosedVoters() @@ -118,7 +118,7 @@ namespace Swarmops.Logic.Governance { if (value != base.VotingOpen) { - PirateDb.GetDatabaseForWriting().SetInternalPollVotingOpen(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetInternalPollVotingOpen(this.Identity, value); base.VotingOpen = value; } } @@ -131,7 +131,7 @@ namespace Swarmops.Logic.Governance { if (value != base.RunningOpen) { - PirateDb.GetDatabaseForWriting().SetInternalPollRunningOpen(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetInternalPollRunningOpen(this.Identity, value); base.RunningOpen = value; } } diff --git a/Logic/Governance/MeetingElectionCandidate.cs b/Logic/Governance/MeetingElectionCandidate.cs index 4d3ae18f..40f8f8d8 100644 --- a/Logic/Governance/MeetingElectionCandidate.cs +++ b/Logic/Governance/MeetingElectionCandidate.cs @@ -23,7 +23,7 @@ namespace Swarmops.Logic.Governance { if (!cache.ContainsKey(internalPollCandidateId)) { - cache [internalPollCandidateId] = FromBasic(PirateDb.GetDatabaseForReading().GetInternalPollCandidate(internalPollCandidateId)); + cache [internalPollCandidateId] = FromBasic(SwarmDb.GetDatabaseForReading().GetInternalPollCandidate(internalPollCandidateId)); } return cache[internalPollCandidateId]; @@ -32,7 +32,7 @@ namespace Swarmops.Logic.Governance public static MeetingElectionCandidate FromPersonAndPoll (Person person, MeetingElection poll) { MeetingElectionCandidates candidates = - MeetingElectionCandidates.FromArray(PirateDb.GetDatabaseForReading().GetInternalPollCandidates(person, poll)); + MeetingElectionCandidates.FromArray(SwarmDb.GetDatabaseForReading().GetInternalPollCandidates(person, poll)); if (candidates.Count == 0) { @@ -51,7 +51,7 @@ namespace Swarmops.Logic.Governance public static MeetingElectionCandidate Create (MeetingElection poll, Person person, string candidacyStatement) { - return FromIdentity (PirateDb.GetDatabaseForWriting().CreateInternalPollCandidate(poll.Identity, person.Identity, candidacyStatement)); + return FromIdentity (SwarmDb.GetDatabaseForWriting().CreateInternalPollCandidate(poll.Identity, person.Identity, candidacyStatement)); } private static Dictionary cache; @@ -121,12 +121,12 @@ namespace Swarmops.Logic.Governance public void SetSortOrder(string sortOrder) { - PirateDb.GetDatabaseForWriting().SetInternalPollCandidateSortOrder(this.Identity, sortOrder); + SwarmDb.GetDatabaseForWriting().SetInternalPollCandidateSortOrder(this.Identity, sortOrder); } public void RandomizeSortOrder() { - PirateDb.GetDatabaseForWriting().SetInternalPollCandidateSortOrder(this.Identity, System.Guid.NewGuid().ToString()); + SwarmDb.GetDatabaseForWriting().SetInternalPollCandidateSortOrder(this.Identity, System.Guid.NewGuid().ToString()); } public new string CandidacyStatement @@ -137,7 +137,7 @@ namespace Swarmops.Logic.Governance { base.CandidacyStatement = value; cache[this.Identity] = this; // Replace cache instance - PirateDb.GetDatabaseForWriting().SetInternalPollCandidateStatement(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetInternalPollCandidateStatement(this.Identity, value); } } } diff --git a/Logic/Governance/MeetingElectionCandidates.cs b/Logic/Governance/MeetingElectionCandidates.cs index 2719413f..7d8fd6ca 100644 --- a/Logic/Governance/MeetingElectionCandidates.cs +++ b/Logic/Governance/MeetingElectionCandidates.cs @@ -11,7 +11,7 @@ namespace Swarmops.Logic.Governance { public static MeetingElectionCandidates ForPoll (MeetingElection poll) { - return FromArray(PirateDb.GetDatabaseForReading().GetInternalPollCandidates(poll)); + return FromArray(SwarmDb.GetDatabaseForReading().GetInternalPollCandidates(poll)); } } } \ No newline at end of file diff --git a/Logic/Governance/MeetingElectionVote.cs b/Logic/Governance/MeetingElectionVote.cs index 7c187b9a..3247a073 100644 --- a/Logic/Governance/MeetingElectionVote.cs +++ b/Logic/Governance/MeetingElectionVote.cs @@ -22,35 +22,35 @@ namespace Swarmops.Logic.Governance static public MeetingElectionVote FromIdentity (int internalPollVoteId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetInternalPollVote(internalPollVoteId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetInternalPollVote(internalPollVoteId)); } static public MeetingElectionVote FromVerificationCode (string verificationCode) { - return FromBasic(PirateDb.GetDatabaseForReading().GetInternalPollVote(verificationCode)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetInternalPollVote(verificationCode)); } static public MeetingElectionVote Create (MeetingElection poll, Geography voteGeography) { return - FromIdentity(PirateDb.GetDatabaseForWriting().CreateInternalPollVote(poll.Identity, voteGeography.Identity, + FromIdentity(SwarmDb.GetDatabaseForWriting().CreateInternalPollVote(poll.Identity, voteGeography.Identity, Authentication. CreateRandomPassword(12))); } public void AddDetail (int position, MeetingElectionCandidate candidate) { - PirateDb.GetDatabaseForWriting().CreateInternalPollVoteDetail(this.Identity, candidate.Identity, position); + SwarmDb.GetDatabaseForWriting().CreateInternalPollVoteDetail(this.Identity, candidate.Identity, position); } public void Clear() { - PirateDb.GetDatabaseForWriting().ClearInternalPollVote(this.Identity); + SwarmDb.GetDatabaseForWriting().ClearInternalPollVote(this.Identity); } public int[] SelectedCandidateIdsInOrder { - get { return PirateDb.GetDatabaseForReading().GetInternalPollVoteDetails(this.Identity); } + get { return SwarmDb.GetDatabaseForReading().GetInternalPollVoteDetails(this.Identity); } } /* diff --git a/Logic/Governance/MeetingElectionVoters.cs b/Logic/Governance/MeetingElectionVoters.cs index 40bfb517..ff319213 100644 --- a/Logic/Governance/MeetingElectionVoters.cs +++ b/Logic/Governance/MeetingElectionVoters.cs @@ -25,11 +25,11 @@ namespace Swarmops.Logic.Governance { if (includeClosed) { - return FromArray(PirateDb.GetDatabaseForReading().GetInternalPollVoters(poll)); + return FromArray(SwarmDb.GetDatabaseForReading().GetInternalPollVoters(poll)); } else { - return FromArray(PirateDb.GetDatabaseForReading().GetInternalPollVoters(poll, DatabaseCondition.OpenTrue)); + return FromArray(SwarmDb.GetDatabaseForReading().GetInternalPollVoters(poll, DatabaseCondition.OpenTrue)); } } @@ -40,7 +40,7 @@ namespace Swarmops.Logic.Governance static public MeetingElectionVoters ForPollClosed (MeetingElection poll) { - return FromArray(PirateDb.GetDatabaseForReading().GetInternalPollVoters(poll, DatabaseCondition.OpenFalse)); + return FromArray(SwarmDb.GetDatabaseForReading().GetInternalPollVoters(poll, DatabaseCondition.OpenFalse)); } } diff --git a/Logic/Governance/MeetingElectionVotes.cs b/Logic/Governance/MeetingElectionVotes.cs index 32b2f31c..6d5d0b85 100644 --- a/Logic/Governance/MeetingElectionVotes.cs +++ b/Logic/Governance/MeetingElectionVotes.cs @@ -11,7 +11,7 @@ namespace Swarmops.Logic.Governance { static public MeetingElectionVotes ForInternalPoll (MeetingElection poll) { - return FromArray(PirateDb.GetDatabaseForReading().GetInternalPollVotes(poll)); + return FromArray(SwarmDb.GetDatabaseForReading().GetInternalPollVotes(poll)); } } } \ No newline at end of file diff --git a/Logic/Governance/MeetingElections.cs b/Logic/Governance/MeetingElections.cs index 1f2709c0..cfdeb3cc 100644 --- a/Logic/Governance/MeetingElections.cs +++ b/Logic/Governance/MeetingElections.cs @@ -12,17 +12,17 @@ namespace Swarmops.Logic.Governance { public static MeetingElections ForOrganization (Organization organization) { - return FromArray(PirateDb.GetDatabaseForReading().GetInternalPolls(organization)); + return FromArray(SwarmDb.GetDatabaseForReading().GetInternalPolls(organization)); } public static MeetingElections ForOrganizations (Organizations organizations) { - return FromArray(PirateDb.GetDatabaseForReading().GetInternalPolls(organizations)); + return FromArray(SwarmDb.GetDatabaseForReading().GetInternalPolls(organizations)); } public static MeetingElections GetAll() { - return FromArray(PirateDb.GetDatabaseForReading().GetInternalPolls()); + return FromArray(SwarmDb.GetDatabaseForReading().GetInternalPolls()); } } } \ No newline at end of file diff --git a/Logic/Governance/Motion.cs b/Logic/Governance/Motion.cs index d10a0b74..c76e5728 100644 --- a/Logic/Governance/Motion.cs +++ b/Logic/Governance/Motion.cs @@ -21,13 +21,13 @@ namespace Swarmops.Logic.Governance public static Motion FromIdentity (int motionId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetMotion(motionId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetMotion(motionId)); } public static Motion Create (Meeting meeting, Person submittingPerson, Person creatingPerson, string title, string text, string decisionPoints) { return - Motion.FromIdentity(PirateDb.GetDatabaseForWriting().CreateMotion(meeting.Identity, submittingPerson.Identity, creatingPerson.Identity, title, text, decisionPoints)); + Motion.FromIdentity(SwarmDb.GetDatabaseForWriting().CreateMotion(meeting.Identity, submittingPerson.Identity, creatingPerson.Identity, title, text, decisionPoints)); } public MotionAmendments Amendments diff --git a/Logic/Governance/MotionAmendment.cs b/Logic/Governance/MotionAmendment.cs index cbfce16b..0f2cb793 100644 --- a/Logic/Governance/MotionAmendment.cs +++ b/Logic/Governance/MotionAmendment.cs @@ -22,12 +22,12 @@ namespace Swarmops.Logic.Governance public static MotionAmendment FromIdentity (int motionAmendmentId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetMotionAmendment(motionAmendmentId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetMotionAmendment(motionAmendmentId)); } public static MotionAmendment Create (Motion motion, string title, string text, string decisionPoint, Person submittingPerson, Person creatingPerson) { - return FromIdentity(PirateDb.GetDatabaseForWriting().CreateMotionAmendment (motion.Identity, submittingPerson.Identity, creatingPerson.Identity, title, text, decisionPoint)); + return FromIdentity(SwarmDb.GetDatabaseForWriting().CreateMotionAmendment (motion.Identity, submittingPerson.Identity, creatingPerson.Identity, title, text, decisionPoint)); } public Motion Motion diff --git a/Logic/Governance/MotionAmendments.cs b/Logic/Governance/MotionAmendments.cs index 7c396d1b..f48868ac 100644 --- a/Logic/Governance/MotionAmendments.cs +++ b/Logic/Governance/MotionAmendments.cs @@ -11,12 +11,12 @@ namespace Swarmops.Logic.Governance { static public MotionAmendments ForMotion (Motion motion) { - return MotionAmendments.FromArray(PirateDb.GetDatabaseForReading().GetMotionAmendments(motion)); + return MotionAmendments.FromArray(SwarmDb.GetDatabaseForReading().GetMotionAmendments(motion)); } static public MotionAmendments ForMeeting (Meeting meeting) { - return FromArray(PirateDb.GetDatabaseForReading().GetMotionAmendmentsForMeeting(meeting.Identity)); + return FromArray(SwarmDb.GetDatabaseForReading().GetMotionAmendmentsForMeeting(meeting.Identity)); } } } \ No newline at end of file diff --git a/Logic/Governance/Motions.cs b/Logic/Governance/Motions.cs index 03114ece..85d41682 100644 --- a/Logic/Governance/Motions.cs +++ b/Logic/Governance/Motions.cs @@ -11,7 +11,7 @@ namespace Swarmops.Logic.Governance { static public Motions ForMeeting (Meeting meeting) { - return Motions.FromArray(PirateDb.GetDatabaseForReading().GetMotions(meeting)); + return Motions.FromArray(SwarmDb.GetDatabaseForReading().GetMotions(meeting)); } } } \ No newline at end of file diff --git a/Logic/Media/MediaCategories.cs b/Logic/Media/MediaCategories.cs index 25c5b41c..727b88f7 100644 --- a/Logic/Media/MediaCategories.cs +++ b/Logic/Media/MediaCategories.cs @@ -27,12 +27,12 @@ namespace Swarmops.Logic.Media public static MediaCategories FromIdentities (int[] identities) { - return FromArray (PirateDb.GetDatabaseForReading().GetMediaCategories (identities)); + return FromArray (SwarmDb.GetDatabaseForReading().GetMediaCategories (identities)); } public static MediaCategories GetAll() { - return FromArray(PirateDb.GetDatabaseForReading().GetMediaCategories()); + return FromArray(SwarmDb.GetDatabaseForReading().GetMediaCategories()); } } } \ No newline at end of file diff --git a/Logic/Media/MediaCategory.cs b/Logic/Media/MediaCategory.cs index 6c6e6a8b..3b91f7b8 100644 --- a/Logic/Media/MediaCategory.cs +++ b/Logic/Media/MediaCategory.cs @@ -11,7 +11,7 @@ namespace Swarmops.Logic.Media public static MediaCategory FromName (string name) { - return new MediaCategory(PirateDb.GetDatabaseForReading().GetMediaCategoryByName(name)); + return new MediaCategory(SwarmDb.GetDatabaseForReading().GetMediaCategoryByName(name)); } public static MediaCategory FromBasic (BasicMediaCategory basic) diff --git a/Logic/Media/MediaEntries.cs b/Logic/Media/MediaEntries.cs index 1572da3f..85f6a26d 100644 --- a/Logic/Media/MediaEntries.cs +++ b/Logic/Media/MediaEntries.cs @@ -30,32 +30,32 @@ namespace Swarmops.Logic.Media public static string[] GetBlogKeywords() { - return PirateDb.GetDatabaseForReading().GetBlogKeywords(); + return SwarmDb.GetDatabaseForReading().GetBlogKeywords(); } public static string[] GetOldMediaKeywords() { - return PirateDb.GetDatabaseForReading().GetOldMediaKeywords(); + return SwarmDb.GetDatabaseForReading().GetOldMediaKeywords(); } public static MediaEntries FromBlogKeyword (string keyword, DateTime minimumAge) { - return FromArray (PirateDb.GetDatabaseForReading().GetBlogEntriesForKeyword (keyword, minimumAge)); + return FromArray (SwarmDb.GetDatabaseForReading().GetBlogEntriesForKeyword (keyword, minimumAge)); } public static MediaEntries FromOldMediaKeyword (string keyword, DateTime minimumAge) { - return FromArray (PirateDb.GetDatabaseForReading().GetOldMediaEntriesForKeyword (keyword, minimumAge)); + return FromArray (SwarmDb.GetDatabaseForReading().GetOldMediaEntriesForKeyword (keyword, minimumAge)); } public static Dictionary GetMediaTypeTable() { - return PirateDb.GetDatabaseForReading().GetMediaTypeTable(); + return SwarmDb.GetDatabaseForReading().GetMediaTypeTable(); } public static Dictionary GetMediaKeywordTable() { - return PirateDb.GetDatabaseForReading().GetMediaKeywordTable(); + return SwarmDb.GetDatabaseForReading().GetMediaKeywordTable(); } public static MediaEntries FromKeywordsSimplified (string[] keywords) @@ -64,15 +64,15 @@ namespace Swarmops.Logic.Media foreach (string keyword in keywords) { - keywordIds.Add (PirateDb.GetDatabaseForReading().GetMediaKeywordId (keyword)); + keywordIds.Add (SwarmDb.GetDatabaseForReading().GetMediaKeywordId (keyword)); } - return FromArray (PirateDb.GetDatabaseForReading().GetMediaEntriesForKeywordIdsSimplified (keywordIds.ToArray())); + return FromArray (SwarmDb.GetDatabaseForReading().GetMediaEntriesForKeywordIdsSimplified (keywordIds.ToArray())); } public static int GetKeywordId (string keyword) { - return PirateDb.GetDatabaseForReading().GetMediaKeywordId (keyword); + return SwarmDb.GetDatabaseForReading().GetMediaKeywordId (keyword); } } } \ No newline at end of file diff --git a/Logic/Media/MediaEntry.cs b/Logic/Media/MediaEntry.cs index f1a2e3f6..b3d0b8f1 100644 --- a/Logic/Media/MediaEntry.cs +++ b/Logic/Media/MediaEntry.cs @@ -19,7 +19,7 @@ namespace Swarmops.Logic.Media public static bool CreateFromKeyword (string keyword, string mediaName, bool isBlog, string url, string title, DateTime dateTime) { - int id = PirateDb.GetDatabaseForWriting().CreateMediaEntryFromKeyword (keyword, mediaName, isBlog, url, title, + int id = SwarmDb.GetDatabaseForWriting().CreateMediaEntryFromKeyword (keyword, mediaName, isBlog, url, title, dateTime); if (id != 0) diff --git a/Logic/Media/Reporter.cs b/Logic/Media/Reporter.cs index b549db2a..f41a1c5e 100644 --- a/Logic/Media/Reporter.cs +++ b/Logic/Media/Reporter.cs @@ -14,11 +14,11 @@ namespace Swarmops.Logic.Media public static Reporter Create (string name, string email, string[] categories) { - Reporter reporter = FromIdentity(PirateDb.GetDatabaseForWriting().CreateReporter(name, email)); + Reporter reporter = FromIdentity(SwarmDb.GetDatabaseForWriting().CreateReporter(name, email)); foreach (string category in categories) { - PirateDb.GetDatabaseForWriting().CreateReporterMediaCategory(reporter.Identity, category); + SwarmDb.GetDatabaseForWriting().CreateReporterMediaCategory(reporter.Identity, category); } return reporter; @@ -27,7 +27,7 @@ namespace Swarmops.Logic.Media public void Delete() { - PirateDb.GetDatabaseForWriting().DeleteReporter(this.Identity); + SwarmDb.GetDatabaseForWriting().DeleteReporter(this.Identity); // After this operation, the object is no longer valid. } @@ -39,7 +39,7 @@ namespace Swarmops.Logic.Media { if (MediaCategoryIds == null) { - MediaCategoryIds = PirateDb.GetDatabaseForReading().GetReporterMediaCategories (Identity); + MediaCategoryIds = SwarmDb.GetDatabaseForReading().GetReporterMediaCategories (Identity); } if (this.mediaCategories == null) @@ -66,7 +66,7 @@ namespace Swarmops.Logic.Media public static Reporter FromIdentity (int identity) { - return Reporter.FromBasic(PirateDb.GetDatabaseForReading().GetReporter(identity)); + return Reporter.FromBasic(SwarmDb.GetDatabaseForReading().GetReporter(identity)); } #region IComparable Members diff --git a/Logic/Media/Reporters.cs b/Logic/Media/Reporters.cs index b9b0f9d0..d25ea7cd 100644 --- a/Logic/Media/Reporters.cs +++ b/Logic/Media/Reporters.cs @@ -21,14 +21,14 @@ namespace Swarmops.Logic.Media public static Reporters GetAll() { - BasicReporter[] basicReporters = PirateDb.GetDatabaseForReading().GetReporters(); + BasicReporter[] basicReporters = SwarmDb.GetDatabaseForReading().GetReporters(); return FromArray (basicReporters); } public static Reporters FromMediaCategories (MediaCategories categories) { BasicReporter[] basicReporters = - PirateDb.GetDatabaseForReading().GetReportersFromMediaCategories (categories.Identities); + SwarmDb.GetDatabaseForReading().GetReportersFromMediaCategories (categories.Identities); return FromArray (basicReporters); } } diff --git a/Logic/Security/Authentication.cs b/Logic/Security/Authentication.cs index b1a4df41..b18c48d8 100644 --- a/Logic/Security/Authentication.cs +++ b/Logic/Security/Authentication.cs @@ -197,7 +197,7 @@ namespace Swarmops.Logic.Security { People result = new People(); - PirateDb database = PirateDb.GetDatabaseForReading(); + SwarmDb database = SwarmDb.GetDatabaseForReading(); // First, is the login token numeric? If so, add it as is and is a valid person. @@ -258,7 +258,7 @@ namespace Swarmops.Logic.Security People candidatePeople = null; if (personID == 0) { - BasicPerson[] people = PirateDb.GetDatabaseForReading().GetPeopleFromEmailPattern(eMail.ToLower().Replace("%", "").Trim()); + BasicPerson[] people = SwarmDb.GetDatabaseForReading().GetPeopleFromEmailPattern(eMail.ToLower().Replace("%", "").Trim()); candidatePeople = People.FromArray(people); // if multiple people share same e-mail, suppose the last one registered is the one to change. @@ -439,7 +439,7 @@ namespace Swarmops.Logic.Security bool personIsActivist = false; if (personID == 0) { - BasicPerson[] people = PirateDb.GetDatabaseForReading().GetPeopleFromEmailPattern(eMail.ToLower().Replace("%", "").Trim()); + BasicPerson[] people = SwarmDb.GetDatabaseForReading().GetPeopleFromEmailPattern(eMail.ToLower().Replace("%", "").Trim()); candidatePeople = People.FromArray(people); // if multiple people share same e-mail, suppose the last one registered is the one to change. diff --git a/Logic/Security/Authorization.cs b/Logic/Security/Authorization.cs index f4fa53f5..e28e6252 100644 --- a/Logic/Security/Authorization.cs +++ b/Logic/Security/Authorization.cs @@ -127,7 +127,7 @@ namespace Swarmops.Logic.Security Dictionary> tempDict = new Dictionary>(); _PermissonsPerRoleTypeDict = new Dictionary>(); - BasicPermission[] allPermissions = PirateDb.GetDatabaseForReading().GetPermissionsTable(); + BasicPermission[] allPermissions = SwarmDb.GetDatabaseForReading().GetPermissionsTable(); foreach (BasicPermission bp in allPermissions) { RoleType role = bp.RoleType; @@ -166,7 +166,7 @@ namespace Swarmops.Logic.Security public static Authority GetPersonAuthority (int personId) { - return Authority.FromBasic(PirateDb.GetDatabaseForReading().GetPersonAuthority(Person.FromIdentity(personId))); + return Authority.FromBasic(SwarmDb.GetDatabaseForReading().GetPersonAuthority(Person.FromIdentity(personId))); } @@ -441,7 +441,7 @@ namespace Swarmops.Logic.Security return people; } - PirateDb databaseRead = PirateDb.GetDatabaseForReading(); + SwarmDb databaseRead = SwarmDb.GetDatabaseForReading(); if (gracePeriod == -1) gracePeriod = Membership.GracePeriod; @@ -570,7 +570,7 @@ namespace Swarmops.Logic.Security // Get ALL unlisted people from database. They're not that many. Build a hashtable with them. - int[] anonymousPersonIds = PirateDb.GetDatabaseForReading().GetObjectsByOptionalData(ObjectType.Person, ObjectOptionalDataType.Anonymous, "1"); + int[] anonymousPersonIds = SwarmDb.GetDatabaseForReading().GetObjectsByOptionalData(ObjectType.Person, ObjectOptionalDataType.Anonymous, "1"); foreach (int anonymousPersonId in anonymousPersonIds) { @@ -736,7 +736,7 @@ namespace Swarmops.Logic.Security line.Add(Organization.FromIdentity(p)); BasicPersonRole[] basPersons - = PirateDb.GetDatabaseForReading().GetPeopleWithRoleType(roleType, line.Identities, new int[] { }); + = SwarmDb.GetDatabaseForReading().GetPeopleWithRoleType(roleType, line.Identities, new int[] { }); List retList = new List(); diff --git a/Logic/Special/Sweden/SwedishForumDatabase.cs b/Logic/Special/Sweden/SwedishForumDatabase.cs index c3bd386f..925cca97 100644 --- a/Logic/Special/Sweden/SwedishForumDatabase.cs +++ b/Logic/Special/Sweden/SwedishForumDatabase.cs @@ -119,7 +119,7 @@ namespace Swarmops.Logic.Special.Sweden ProviderName = ConfigurationManager.ConnectionStrings["PirateWeb"].ProviderName; Logging.LogInformation(LogSource.PirateDb, - "PirateDb initialized from Config ConnectionString: [" + ConnectionString + + "SwarmDb initialized from Config ConnectionString: [" + ConnectionString + "] / [" + ProviderName + "]"); } @@ -138,7 +138,7 @@ namespace Swarmops.Logic.Special.Sweden ProviderName = reader.ReadLine(); Logging.LogInformation(LogSource.PirateDb, - "PirateDb initialized for Linux: [" + ConnectionString + "] / [" + + "SwarmDb initialized for Linux: [" + ConnectionString + "] / [" + ProviderName + "]"); } } @@ -151,7 +151,7 @@ namespace Swarmops.Logic.Special.Sweden ProviderName = reader.ReadLine(); Logging.LogInformation(LogSource.PirateDb, - "PirateDb initialized for web: [" + ConnectionString + "] / [" + + "SwarmDb initialized for web: [" + ConnectionString + "] / [" + ProviderName + "]"); } } @@ -165,7 +165,7 @@ namespace Swarmops.Logic.Special.Sweden ProviderName = reader.ReadLine(); Logging.LogInformation(LogSource.PirateDb, - "PirateDb initialized for application: [" + ConnectionString + + "SwarmDb initialized for application: [" + ConnectionString + "] / [" + ProviderName + "]"); } } diff --git a/Logic/Special/Sweden/SwedishForumHandleProvider.cs b/Logic/Special/Sweden/SwedishForumHandleProvider.cs index aa92d835..f97bf224 100644 --- a/Logic/Special/Sweden/SwedishForumHandleProvider.cs +++ b/Logic/Special/Sweden/SwedishForumHandleProvider.cs @@ -41,7 +41,7 @@ namespace Swarmops.Logic.Special.Sweden throw new HandleException(newHandle, HandleErrorType.HandleNotFound); } - int[] members = PirateDb.GetDatabaseForReading().GetObjectsByOptionalData(ObjectType.Person, ObjectOptionalDataType.ForumAccountId, "" + newHandleAccountId); + int[] members = SwarmDb.GetDatabaseForReading().GetObjectsByOptionalData(ObjectType.Person, ObjectOptionalDataType.ForumAccountId, "" + newHandleAccountId); if (members.Length > 1 || (members.Length == 1 && members[0] != personId)) { throw new HandleException(newHandle, HandleErrorType.HandleOccupied); diff --git a/Logic/Structure/Cities.cs b/Logic/Structure/Cities.cs index 527ddbfa..d1edff66 100644 --- a/Logic/Structure/Cities.cs +++ b/Logic/Structure/Cities.cs @@ -31,17 +31,17 @@ namespace Swarmops.Logic.Structure public static Cities FromPostalCode (string postalCode, int countryId) { - return FromArray(PirateDb.GetDatabaseForReading().GetCitiesByCountryAndPostalCode(countryId, postalCode)); + return FromArray(SwarmDb.GetDatabaseForReading().GetCitiesByCountryAndPostalCode(countryId, postalCode)); } public static Cities FromName (string cityName, int countryId) { - return FromArray(PirateDb.GetDatabaseForReading().GetCitiesByName(cityName, countryId)); + return FromArray(SwarmDb.GetDatabaseForReading().GetCitiesByName(cityName, countryId)); } public static Cities ForCountry (string countryCode) { - return FromArray(PirateDb.GetDatabaseForReading().GetCitiesByCountry (countryCode)); + return FromArray(SwarmDb.GetDatabaseForReading().GetCitiesByCountry (countryCode)); } } } \ No newline at end of file diff --git a/Logic/Structure/City.cs b/Logic/Structure/City.cs index 4542b780..32e41fe0 100644 --- a/Logic/Structure/City.cs +++ b/Logic/Structure/City.cs @@ -21,7 +21,7 @@ namespace Swarmops.Logic.Structure public static City FromIdentity (int cityId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetCity(cityId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetCity(cityId)); } @@ -37,17 +37,17 @@ namespace Swarmops.Logic.Structure public static City FromName (string cityName, int countryId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetCityByName(cityName, countryId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetCityByName(cityName, countryId)); } public static City FromName (string cityName, string countryCode) { - return FromBasic(PirateDb.GetDatabaseForReading().GetCityByName(cityName, countryCode)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetCityByName(cityName, countryCode)); } public static City Create (string cityName, int countryId, int geographyId) { - return City.FromIdentity(PirateDb.GetDatabaseForWriting().CreateCity(cityName, countryId, geographyId)); + return City.FromIdentity(SwarmDb.GetDatabaseForWriting().CreateCity(cityName, countryId, geographyId)); } } } \ No newline at end of file diff --git a/Logic/Structure/Countries.cs b/Logic/Structure/Countries.cs index 71cdf1ed..13f316df 100644 --- a/Logic/Structure/Countries.cs +++ b/Logic/Structure/Countries.cs @@ -8,12 +8,12 @@ namespace Swarmops.Logic.Structure { public static Countries GetAll () { - return FromArray(PirateDb.GetDatabaseForReading().GetAllCountries()); + return FromArray(SwarmDb.GetDatabaseForReading().GetAllCountries()); } public static Countries GetInUse () { - return FromArray(PirateDb.GetDatabaseForReading().GetCountriesInUse()); + return FromArray(SwarmDb.GetDatabaseForReading().GetCountriesInUse()); } public static Countries FromArray (BasicCountry[] basicArray) diff --git a/Logic/Structure/Country.cs b/Logic/Structure/Country.cs index 7feceea6..ddc2bcca 100644 --- a/Logic/Structure/Country.cs +++ b/Logic/Structure/Country.cs @@ -28,12 +28,12 @@ namespace Swarmops.Logic.Structure public static Country FromIdentity (int identity) { - return FromBasic(PirateDb.GetDatabaseForReading().GetCountry(identity)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetCountry(identity)); } public static Country FromCode (string countryCode) { - return FromBasic(PirateDb.GetDatabaseForReading().GetCountry(countryCode)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetCountry(countryCode)); } public Geography Geography diff --git a/Logic/Structure/Geographies.cs b/Logic/Structure/Geographies.cs index 023aa4c9..277f2b2a 100644 --- a/Logic/Structure/Geographies.cs +++ b/Logic/Structure/Geographies.cs @@ -36,7 +36,7 @@ namespace Swarmops.Logic.Structure public static Geographies FromIdentities (int[] geoIds) { return FromArray(GeographyCache.GetGeographies(geoIds)); - // return FromArray(PirateDb.GetDatabaseForReading().GetGeographies(geoIds)); + // return FromArray(SwarmDb.GetDatabaseForReading().GetGeographies(geoIds)); } @@ -47,7 +47,7 @@ namespace Swarmops.Logic.Structure public static Geographies FromLevel (int countryId, GeographyLevel level) { - return FromIdentities(PirateDb.GetDatabaseForReading().GetGeographyIdsFromLevel(countryId, level)); + return FromIdentities(SwarmDb.GetDatabaseForReading().GetGeographyIdsFromLevel(countryId, level)); } #endregion diff --git a/Logic/Structure/Geography.cs b/Logic/Structure/Geography.cs index 8d3d6117..fe2c623f 100644 --- a/Logic/Structure/Geography.cs +++ b/Logic/Structure/Geography.cs @@ -35,7 +35,7 @@ namespace Swarmops.Logic.Structure public static Geography FromIdentity (int geographyId) { return FromBasic(GeographyCache.GetGeography(geographyId)); - //return FromBasic(PirateDb.GetDatabaseForReading().GetGeography(geographyId)); + //return FromBasic(SwarmDb.GetDatabaseForReading().GetGeography(geographyId)); } public static Geography FromName (string geographyName) @@ -43,7 +43,7 @@ namespace Swarmops.Logic.Structure // TODO: Possible dupes here, need resolution once we see the extent of the problem return FromBasic(GeographyCache.GetGeographyByName(geographyName)); - //return FromBasic(PirateDb.GetDatabaseForReading().GetGeographyByName(geographyName)); + //return FromBasic(SwarmDb.GetDatabaseForReading().GetGeographyByName(geographyName)); } @@ -55,7 +55,7 @@ namespace Swarmops.Logic.Structure public static Geography FromOfficialDesignation (int countryId, GeographyLevel level, string designation) { return - FromIdentity(PirateDb.GetDatabaseForReading().GetGeographyIdFromOfficialDesignation(countryId, level, + FromIdentity(SwarmDb.GetDatabaseForReading().GetGeographyIdFromOfficialDesignation(countryId, level, designation)); } @@ -134,13 +134,13 @@ namespace Swarmops.Logic.Structure public Geographies GetTree () { return Geographies.FromArray(GeographyCache.GetGeographyTree(Identity)); - // return Geographies.FromArray(PirateDb.GetDatabaseForReading().GetGeographyTree(Identity)); + // return Geographies.FromArray(SwarmDb.GetDatabaseForReading().GetGeographyTree(Identity)); } public Geographies GetLine () { return Geographies.FromArray(GeographyCache.GetGeographyLine(Identity)); - //return Geographies.FromArray(PirateDb.GetDatabaseForReading().GetGeographyLine(Identity)); + //return Geographies.FromArray(SwarmDb.GetDatabaseForReading().GetGeographyLine(Identity)); } public bool Inherits (Geography prospectiveParent) @@ -168,7 +168,7 @@ namespace Swarmops.Logic.Structure public bool AtLevel (GeographyLevel level) { - GeographyLevel[] levels = PirateDb.GetDatabaseForReading().GetGeographyLevelsAtGeographyId(Identity); + GeographyLevel[] levels = SwarmDb.GetDatabaseForReading().GetGeographyLevelsAtGeographyId(Identity); foreach (GeographyLevel potentialMatch in levels) { @@ -183,7 +183,7 @@ namespace Swarmops.Logic.Structure public BasicGeographyDesignation[] GetGeographyDesignations () { - return PirateDb.GetDatabaseForReading().GetGeographyDesignationsForGeographyId(Identity); + return SwarmDb.GetDatabaseForReading().GetGeographyDesignationsForGeographyId(Identity); } } } \ No newline at end of file diff --git a/Logic/Structure/GeographyStatistics.cs b/Logic/Structure/GeographyStatistics.cs index ce63339c..94bb83c4 100644 --- a/Logic/Structure/GeographyStatistics.cs +++ b/Logic/Structure/GeographyStatistics.cs @@ -21,7 +21,7 @@ namespace Swarmops.Logic.Structure public static GeographyStatistics GeneratePresent (int[] memberCountForOrganizations) { - Dictionary voterCounts = PirateDb.GetDatabaseForReading().GetGeographyVoterCounts(); + Dictionary voterCounts = SwarmDb.GetDatabaseForReading().GetGeographyVoterCounts(); var result = new GeographyStatistics(); // Step 1 - tally the leaf nodes diff --git a/Logic/Structure/Organization.cs b/Logic/Structure/Organization.cs index 37c1e7ef..a4c957b7 100644 --- a/Logic/Structure/Organization.cs +++ b/Logic/Structure/Organization.cs @@ -40,12 +40,12 @@ namespace Swarmops.Logic.Structure { return FromBasic(OrganizationCache.GetOrganization(identity)); - //return FromBasic(PirateDb.GetDatabaseForReading().GetOrganization(identity)); + //return FromBasic(SwarmDb.GetDatabaseForReading().GetOrganization(identity)); } public static Organization FromIdentityAggressive(int identity) { - return FromBasic(PirateDb.GetDatabaseForWriting().GetOrganization(identity)); // Note "for writing". Intentional. Queries master db; bypasses replication lag. + return FromBasic(SwarmDb.GetDatabaseForWriting().GetOrganization(identity)); // Note "for writing". Intentional. Queries master db; bypasses replication lag. } public static Organization FromBasic(BasicOrganization basic) @@ -112,13 +112,13 @@ namespace Swarmops.Logic.Structure { return Organizations.FromArray(OrganizationCache.GetOrganizationLine(Identity)); - //return Organizations.FromArray(PirateDb.GetDatabaseForReading().GetOrganizationLine(Identity)); + //return Organizations.FromArray(SwarmDb.GetDatabaseForReading().GetOrganizationLine(Identity)); } public Organizations GetTree () { return Organizations.FromArray(OrganizationCache.GetOrganizationTree(Identity)); - //return Organizations.FromArray(PirateDb.GetDatabaseForReading().GetOrganizationTree(Identity)); + //return Organizations.FromArray(SwarmDb.GetDatabaseForReading().GetOrganizationTree(Identity)); } public int GetMemberCount () @@ -128,7 +128,7 @@ namespace Swarmops.Logic.Structure public NewsletterFeeds GetNewsletterFeeds () { - return NewsletterFeeds.FromArray(PirateDb.GetDatabaseForReading().GetNewsletterFeedsForOrganization(Identity)); + return NewsletterFeeds.FromArray(SwarmDb.GetDatabaseForReading().GetNewsletterFeedsForOrganization(Identity)); } @@ -414,7 +414,7 @@ namespace Swarmops.Logic.Structure if (this.uptakeGeographies == null) { this.uptakeGeographies = - Geographies.FromIdentities(PirateDb.GetDatabaseForReading().GetOrganizationUptakeGeographyIds(Identity)); + Geographies.FromIdentities(SwarmDb.GetDatabaseForReading().GetOrganizationUptakeGeographyIds(Identity)); } return this.uptakeGeographies.AsReadOnly(); @@ -423,7 +423,7 @@ namespace Swarmops.Logic.Structure public UptakeGeography[] GetUptakeGeographies (bool others) { - BasicUptakeGeography[] basics = PirateDb.GetDatabaseForReading().GetOrganizationUptakeGeographies(Identity, others); + BasicUptakeGeography[] basics = SwarmDb.GetDatabaseForReading().GetOrganizationUptakeGeographies(Identity, others); List retVal = new List(); foreach (BasicUptakeGeography b in basics) { @@ -747,7 +747,7 @@ namespace Swarmops.Logic.Structure { Organizations line = GetLine(); BasicPersonRole[] treasurers - = PirateDb.GetDatabaseForReading().GetPeopleWithRoleType(RoleType.OrganizationTreasurer, line.Identities, new int[] { }); + = SwarmDb.GetDatabaseForReading().GetPeopleWithRoleType(RoleType.OrganizationTreasurer, line.Identities, new int[] { }); if (treasurers.Length == 0) throw new Exception("No Treasurer Found"); diff --git a/Logic/Structure/Organizations.cs b/Logic/Structure/Organizations.cs index dc29a242..6763c09d 100644 --- a/Logic/Structure/Organizations.cs +++ b/Logic/Structure/Organizations.cs @@ -287,12 +287,12 @@ namespace Swarmops.Logic.Structure public int GetMemberCount () { - return PirateDb.GetDatabaseForReading().GetMemberCountForOrganizations(Identities); + return SwarmDb.GetDatabaseForReading().GetMemberCountForOrganizations(Identities); } public int GetMemberCountForGeographies (Geographies geographies) { - return PirateDb.GetDatabaseForReading().GetMemberCountForOrganizationsAndGeographies(Identities, + return SwarmDb.GetDatabaseForReading().GetMemberCountForOrganizationsAndGeographies(Identities, geographies.Identities); } @@ -300,7 +300,7 @@ namespace Swarmops.Logic.Structure { var result = new Dictionary(); - BasicPersonRole[] personRoles = PirateDb.GetDatabaseForReading().GetRolesForOrganizationsGeographies(Identities, + BasicPersonRole[] personRoles = SwarmDb.GetDatabaseForReading().GetRolesForOrganizationsGeographies(Identities, geographies.Identities); foreach (BasicPersonRole role in personRoles) @@ -316,7 +316,7 @@ namespace Swarmops.Logic.Structure { var result = new Dictionary(); - BasicPersonRole[] personRoles = PirateDb.GetDatabaseForReading().GetRolesForOrganizationsGeographies(Identities, + BasicPersonRole[] personRoles = SwarmDb.GetDatabaseForReading().GetRolesForOrganizationsGeographies(Identities, geographies.Identities); foreach (BasicPersonRole role in personRoles) diff --git a/Logic/Structure/PostalCodes.cs b/Logic/Structure/PostalCodes.cs index eab2043a..f98ff9b3 100644 --- a/Logic/Structure/PostalCodes.cs +++ b/Logic/Structure/PostalCodes.cs @@ -29,7 +29,7 @@ namespace Swarmops.Logic.Structure public static PostalCodes ForCountry (int countryId) { - return FromArray(PirateDb.GetDatabaseForReading().GetPostalCodesForCountry(countryId)); + return FromArray(SwarmDb.GetDatabaseForReading().GetPostalCodesForCountry(countryId)); } } } diff --git a/Logic/Support/DatabaseMaintenance.cs b/Logic/Support/DatabaseMaintenance.cs index cb46ac12..c17b9656 100644 --- a/Logic/Support/DatabaseMaintenance.cs +++ b/Logic/Support/DatabaseMaintenance.cs @@ -45,7 +45,7 @@ namespace Swarmops.Logic.Support foreach (string sqlCommand in sqlCommands) { - PirateDb.GetDatabaseForAdmin().ExecuteAdminCommand(sqlCommand.Trim()); + SwarmDb.GetDatabaseForAdmin().ExecuteAdminCommand(sqlCommand.Trim()); } } } diff --git a/Logic/Support/Document.cs b/Logic/Support/Document.cs index 4a55204d..54e24cd7 100644 --- a/Logic/Support/Document.cs +++ b/Logic/Support/Document.cs @@ -20,7 +20,7 @@ namespace Swarmops.Logic.Support public static Document FromIdentity (int documentId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetDocument(documentId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetDocument(documentId)); } public static Document FromBasic (BasicDocument basicDocument) @@ -31,7 +31,7 @@ namespace Swarmops.Logic.Support public static Document Create (string serverFileName, string clientFileName, Int64 fileSize, string description, IHasIdentity identifiableObject, Person uploader) { - int newDocumentId = PirateDb.GetDatabaseForWriting(). + int newDocumentId = SwarmDb.GetDatabaseForWriting(). CreateDocument(serverFileName, clientFileName, fileSize, description, GetDocumentTypeForObject(identifiableObject), identifiableObject.Identity, uploader.Identity); return FromIdentity(newDocumentId); @@ -78,14 +78,14 @@ namespace Swarmops.Logic.Support get { return base.ServerFileName; } set { - PirateDb.GetDatabaseForWriting().SetDocumentServerFileName(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetDocumentServerFileName(this.Identity, value); base.ServerFileName = value; } } public void SetForeignObject (IHasIdentity foreignObject) { - PirateDb.GetDatabaseForWriting().SetDocumentForeignObject(this.Identity, GetDocumentTypeForObject(foreignObject), foreignObject.Identity); + SwarmDb.GetDatabaseForWriting().SetDocumentForeignObject(this.Identity, GetDocumentTypeForObject(foreignObject), foreignObject.Identity); } diff --git a/Logic/Support/Documents.cs b/Logic/Support/Documents.cs index 2907562e..2f9076e2 100644 --- a/Logic/Support/Documents.cs +++ b/Logic/Support/Documents.cs @@ -15,7 +15,7 @@ namespace Swarmops.Logic.Support { Documents newInstance = FromArray( - PirateDb.GetDatabaseForReading().GetDocumentsForForeignObject( + SwarmDb.GetDatabaseForReading().GetDocumentsForForeignObject( Document.GetDocumentTypeForObject(identifiableObject), identifiableObject.Identity)); newInstance.sourceObject = identifiableObject; diff --git a/Logic/Support/ObjectOptionalData.cs b/Logic/Support/ObjectOptionalData.cs index e5e481fe..7c8990e4 100644 --- a/Logic/Support/ObjectOptionalData.cs +++ b/Logic/Support/ObjectOptionalData.cs @@ -28,7 +28,7 @@ namespace Swarmops.Logic.Support public static ObjectOptionalData ForObject (IHasIdentity identifiableObject) { - ObjectOptionalData thisObject = FromBasic(PirateDb.GetDatabaseForReading().GetObjectOptionalData((IHasIdentity)identifiableObject)); + ObjectOptionalData thisObject = FromBasic(SwarmDb.GetDatabaseForReading().GetObjectOptionalData((IHasIdentity)identifiableObject)); thisObject.forObject = identifiableObject; return thisObject; } @@ -58,7 +58,7 @@ namespace Swarmops.Logic.Support } set { - PirateDb.GetDatabaseForWriting().SetObjectOptionalData((IHasIdentity)forObject, dataType, value); + SwarmDb.GetDatabaseForWriting().SetObjectOptionalData((IHasIdentity)forObject, dataType, value); this.OptionalData[dataType] = value; } } @@ -135,7 +135,7 @@ namespace Swarmops.Logic.Support public void SetOptionalData (ObjectOptionalDataType dataType, string data) { - PirateDb.GetDatabaseForWriting().SetObjectOptionalData((IHasIdentity)forObject, dataType, data); + SwarmDb.GetDatabaseForWriting().SetObjectOptionalData((IHasIdentity)forObject, dataType, data); if (data == null && this.OptionalData.ContainsKey(dataType)) this.OptionalData.Remove(dataType); diff --git a/Logic/Support/Optimizations.cs b/Logic/Support/Optimizations.cs index 25269be0..01242f5f 100644 --- a/Logic/Support/Optimizations.cs +++ b/Logic/Support/Optimizations.cs @@ -10,17 +10,17 @@ namespace Swarmops.Logic.Support { public static Dictionary GetPeopleWhoDeclineLocalMail (int[] personIds) { - return PirateDb.GetDatabaseForReading().GetPeopleWhoDeclineLocalMail (personIds); + return SwarmDb.GetDatabaseForReading().GetPeopleWhoDeclineLocalMail (personIds); } public static Dictionary GetGeographyVoterCounts() { - return PirateDb.GetDatabaseForReading().GetGeographyVoterCounts(); + return SwarmDb.GetDatabaseForReading().GetGeographyVoterCounts(); } public static Dictionary GetInternalPollVoteCountsPerGeography(int pollId) { - return PirateDb.GetDatabaseForReading().GetInternalPollVoteCountsPerGeography(pollId); + return SwarmDb.GetDatabaseForReading().GetInternalPollVoteCountsPerGeography(pollId); } } } \ No newline at end of file diff --git a/Logic/Support/PWEvents.cs b/Logic/Support/PWEvents.cs index 08c68e64..5e710298 100644 --- a/Logic/Support/PWEvents.cs +++ b/Logic/Support/PWEvents.cs @@ -14,38 +14,38 @@ namespace Swarmops.Logic.Support //TODO: organizationId comes in hardcoded as 1 from a lot of places, should probably be changed based on affected person // to the party for that country if not swedish. - return PirateDb.GetDatabaseForWriting().CreateEvent(eventSource, eventType, actingPersonId, organizationId, + return SwarmDb.GetDatabaseForWriting().CreateEvent(eventSource, eventType, actingPersonId, organizationId, geographyId, affectedPersonId, parameterInt, parameterText); } public static BasicPWEvent[] GetTopUnprocessedEvents () { - return PirateDb.GetDatabaseForReading().GetTopUnprocessedEvents(); + return SwarmDb.GetDatabaseForReading().GetTopUnprocessedEvents(); } public static BasicPWEvent[] ForPerson (int personId) { - return PirateDb.GetDatabaseForReading().GetEventsForPerson(personId); + return SwarmDb.GetDatabaseForReading().GetEventsForPerson(personId); } public static Dictionary> ForPersons (int[] personIds) { - return PirateDb.GetDatabaseForReading().GetEventsForPersons(personIds, new EventType[] { }); + return SwarmDb.GetDatabaseForReading().GetEventsForPersons(personIds, new EventType[] { }); } public static Dictionary> ForPersons (int[] personIds, EventType[] eventTypes) { - return PirateDb.GetDatabaseForReading().GetEventsForPersons(personIds, eventTypes); + return SwarmDb.GetDatabaseForReading().GetEventsForPersons(personIds, eventTypes); } public static BasicPWEvent[] ByType (EventType eventType) { - return PirateDb.GetDatabaseForReading().GetEventsOfType(eventType); + return SwarmDb.GetDatabaseForReading().GetEventsOfType(eventType); } public static void SetEventProcessed (int eventId) { - PirateDb.GetDatabaseForWriting().SetEventProcessed(eventId); + SwarmDb.GetDatabaseForWriting().SetEventProcessed(eventId); } } } \ No newline at end of file diff --git a/Logic/Support/PWLog.cs b/Logic/Support/PWLog.cs index 05231646..594e66ad 100644 --- a/Logic/Support/PWLog.cs +++ b/Logic/Support/PWLog.cs @@ -17,7 +17,7 @@ namespace Swarmops.Logic.Support PWLogAction actionType, string actionDescription, string comment, string changedField, string valueBefore, string valueAfter) { - PirateDb.GetDatabaseForWriting().CreatePWLogEntry(dateTimeUtc, actingPersonId, affectedItem.ToString(), + SwarmDb.GetDatabaseForWriting().CreatePWLogEntry(dateTimeUtc, actingPersonId, affectedItem.ToString(), affectedItemId, actionType.ToString(), actionDescription, changedField, valueBefore, valueAfter, comment, GetCurrentIp()); } @@ -103,7 +103,7 @@ namespace Swarmops.Logic.Support public static DateTime CheckLatest (PWLogItem affectedItemType, int affectedItemId, PWLogAction actionType) { - return PirateDb.GetDatabaseForReading().CheckLogEntry(affectedItemType.ToString(), affectedItemId, actionType.ToString()); + return SwarmDb.GetDatabaseForReading().CheckLogEntry(affectedItemType.ToString(), affectedItemId, actionType.ToString()); } public static BasicPWLog[] GetLatestEvents (PWLogItem affectedItemType, DateTime beforeDate, int[] affectedIds, PWLogAction[] actionTypes) @@ -113,7 +113,7 @@ namespace Swarmops.Logic.Support foreach (var at in actionTypes) actionTypeList.Add(at.ToString()); - return PirateDb.GetDatabaseForReading().GetLatestEvents(affectedItemType.ToString(), beforeDate, affectedIds, actionTypeList.ToArray()); + return SwarmDb.GetDatabaseForReading().GetLatestEvents(affectedItemType.ToString(), beforeDate, affectedIds, actionTypeList.ToArray()); } private static string hostIp = "";//Used in batch programs diff --git a/Logic/Support/Persistence.cs b/Logic/Support/Persistence.cs index 469762e5..34020219 100644 --- a/Logic/Support/Persistence.cs +++ b/Logic/Support/Persistence.cs @@ -10,9 +10,9 @@ namespace Swarmops.Logic.Support public string this [string key] { - get { return PirateDb.GetDatabaseForReading().GetKeyValue (key); } + get { return SwarmDb.GetDatabaseForReading().GetKeyValue (key); } - set { PirateDb.GetDatabaseForWriting().SetKeyValue (key, value); } + set { SwarmDb.GetDatabaseForWriting().SetKeyValue (key, value); } } public static Persistence Key @@ -23,7 +23,7 @@ namespace Swarmops.Logic.Support /* -- Obsolete, used only once in migration MSSQL => MySQL public static Dictionary All { - get { return PirateDb.GetDatabaseForReading().GetOldKeyValues(); } // Migration-only function -- returns all key/value pairs + get { return SwarmDb.GetDatabaseForReading().GetOldKeyValues(); } // Migration-only function -- returns all key/value pairs }*/ } } \ No newline at end of file diff --git a/Logic/Support/TemporaryIdentity.cs b/Logic/Support/TemporaryIdentity.cs index 9dcf75f5..b8479493 100644 --- a/Logic/Support/TemporaryIdentity.cs +++ b/Logic/Support/TemporaryIdentity.cs @@ -15,7 +15,7 @@ namespace Swarmops.Logic.Support static public TemporaryIdentity GetNew() { - return new TemporaryIdentity (PirateDb.GetDatabaseForWriting().GetTemporaryIdentity()); // This is actually an Insert, not a Select + return new TemporaryIdentity (SwarmDb.GetDatabaseForWriting().GetTemporaryIdentity()); // This is actually an Insert, not a Select } private int temporaryId; diff --git a/Logic/Support/UrlTranslations.cs b/Logic/Support/UrlTranslations.cs index 2116659e..2f5b4c79 100644 --- a/Logic/Support/UrlTranslations.cs +++ b/Logic/Support/UrlTranslations.cs @@ -6,7 +6,7 @@ namespace Swarmops.Logic.Support { public static bool Create (string url) { - int id = PirateDb.GetDatabaseForWriting().CreateUrlTranslation(url); + int id = SwarmDb.GetDatabaseForWriting().CreateUrlTranslation(url); if (id > 0) { @@ -20,12 +20,12 @@ namespace Swarmops.Logic.Support public static void Set (string originalUrl, string translatedUrl) { - PirateDb.GetDatabaseForWriting().SetUrlTranslation(originalUrl, translatedUrl); + SwarmDb.GetDatabaseForWriting().SetUrlTranslation(originalUrl, translatedUrl); } public static string[] GetUntranslated (int maxCount) { - return PirateDb.GetDatabaseForReading().GetUntranslatedUrls(maxCount); + return SwarmDb.GetDatabaseForReading().GetUntranslatedUrls(maxCount); } } } \ No newline at end of file diff --git a/Logic/Swarm/Activists.cs b/Logic/Swarm/Activists.cs index 00920709..6dbb50aa 100644 --- a/Logic/Swarm/Activists.cs +++ b/Logic/Swarm/Activists.cs @@ -46,13 +46,13 @@ namespace Swarmops.Logic.Swarm { Geographies geographies = geography.GetTree(); - return PirateDb.GetDatabaseForReading().GetActivistCountForGeographies(geographies.Identities); + return SwarmDb.GetDatabaseForReading().GetActivistCountForGeographies(geographies.Identities); } public static Activists FromGeography (Geography geography) { Geographies geographies = geography.GetTree(); - return new Activists(PirateDb.GetDatabaseForReading().GetActivistPersonIds(geographies.Identities)); + return new Activists(SwarmDb.GetDatabaseForReading().GetActivistPersonIds(geographies.Identities)); } public void SendPhoneMessage (string message) diff --git a/Logic/Swarm/ChurnData.cs b/Logic/Swarm/ChurnData.cs index 112a5694..c09c3e72 100644 --- a/Logic/Swarm/ChurnData.cs +++ b/Logic/Swarm/ChurnData.cs @@ -53,28 +53,28 @@ namespace Swarmops.Logic.Swarm /// The organization churned from. public static void LogChurn (int personId, int organizationId) { - PirateDb.GetDatabaseForWriting().LogChurnData (personId, organizationId, true, DateTime.Now); + SwarmDb.GetDatabaseForWriting().LogChurnData (personId, organizationId, true, DateTime.Now); } public static void LogRetention (int personId, int organizationId, DateTime expiry) { - PirateDb.GetDatabaseForWriting().LogChurnData (personId, organizationId, false, expiry); + SwarmDb.GetDatabaseForWriting().LogChurnData (personId, organizationId, false, expiry); } public static void LogRetention (int personId, int organizationId, DateTime expiry, DateTime decisionDateTime) { - PirateDb.GetDatabaseForWriting().LogChurnData (personId, organizationId, false, expiry, decisionDateTime); + SwarmDb.GetDatabaseForWriting().LogChurnData (personId, organizationId, false, expiry, decisionDateTime); } public static ChurnData ForOrganization (Organization organization) { - return FromArray (PirateDb.GetDatabaseForReading().GetChurnData (organization)); + return FromArray (SwarmDb.GetDatabaseForReading().GetChurnData (organization)); } public static ChurnData ForPerson (Person person) { - return FromArray (PirateDb.GetDatabaseForReading().GetChurnData (person)); + return FromArray (SwarmDb.GetDatabaseForReading().GetChurnData (person)); } @@ -85,7 +85,7 @@ namespace Swarmops.Logic.Swarm public static ChurnData GetByDate (Organization organization, DateTime dateLower, DateTime dateUpper) { - return FromArray (PirateDb.GetDatabaseForReading().GetChurnDataForOrganization (organization, dateLower, dateUpper)); + return FromArray (SwarmDb.GetDatabaseForReading().GetChurnDataForOrganization (organization, dateLower, dateUpper)); } diff --git a/Logic/Swarm/ExternalActivities.cs b/Logic/Swarm/ExternalActivities.cs index c1b7ec1e..c871cf48 100644 --- a/Logic/Swarm/ExternalActivities.cs +++ b/Logic/Swarm/ExternalActivities.cs @@ -12,12 +12,12 @@ namespace Swarmops.Logic.Swarm { public static ExternalActivities ForOrganization (Organization organization) { - return FromArray(PirateDb.GetDatabaseForReading().GetExternalActivities(organization)); + return FromArray(SwarmDb.GetDatabaseForReading().GetExternalActivities(organization)); } public static ExternalActivities ForOrganization (Organization organization, SortOrder sort, int count) { - return FromArray(PirateDb.GetDatabaseForReading().GetExternalActivitiesSorted(sort.ToString(), count, organization)); + return FromArray(SwarmDb.GetDatabaseForReading().GetExternalActivitiesSorted(sort.ToString(), count, organization)); } public enum SortOrder diff --git a/Logic/Swarm/ExternalActivity.cs b/Logic/Swarm/ExternalActivity.cs index 0050e126..1a5bb957 100644 --- a/Logic/Swarm/ExternalActivity.cs +++ b/Logic/Swarm/ExternalActivity.cs @@ -22,13 +22,13 @@ namespace Swarmops.Logic.Swarm public static ExternalActivity FromIdentity (int externalActivityId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetExternalActivity(externalActivityId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetExternalActivity(externalActivityId)); } public static ExternalActivity Create (Organization organization, Geography geograpy, ExternalActivityType type, DateTime date, string description, Person createdByPerson) { return - FromIdentity(PirateDb.GetDatabaseForWriting().CreateExternalActivity(organization.Identity, geograpy.Identity, + FromIdentity(SwarmDb.GetDatabaseForWriting().CreateExternalActivity(organization.Identity, geograpy.Identity, date, type, description, createdByPerson.Identity)); } diff --git a/Logic/Swarm/ExternalIdentity.cs b/Logic/Swarm/ExternalIdentity.cs index 8bd79ad0..4a42329f 100644 --- a/Logic/Swarm/ExternalIdentity.cs +++ b/Logic/Swarm/ExternalIdentity.cs @@ -96,22 +96,22 @@ namespace Swarmops.Logic.Swarm public static ExternalIdentity FromIdentity (int externalIdentityId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetExternalIdentity(externalIdentityId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetExternalIdentity(externalIdentityId)); } public static ExternalIdentity FromUserIdAndType (string userid, ExternalIdentityType type) { - return FromBasic(PirateDb.GetDatabaseForReading().GetExternalIdentityFromUserIdAndType(userid, type)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetExternalIdentityFromUserIdAndType(userid, type)); } public static ExternalIdentity FromPersonIdAndType (int persId, ExternalIdentityType type) { - return FromBasic(PirateDb.GetDatabaseForReading().GetExternalIdentityFromPersonIdAndType(persId, type)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetExternalIdentityFromPersonIdAndType(persId, type)); } public static List ExternalItentitiesForPerson (int persId) { - List templist = PirateDb.GetDatabaseForReading().GetExternalIdentities(persId); + List templist = SwarmDb.GetDatabaseForReading().GetExternalIdentities(persId); List retlist = new List(); @@ -131,7 +131,7 @@ namespace Swarmops.Logic.Swarm int AttachedToPerson, ExternalIdentityType TypeOfAccount) { - return FromBasic(PirateDb.GetDatabaseForWriting().SetExternalIdentity( + return FromBasic(SwarmDb.GetDatabaseForWriting().SetExternalIdentity( this.Identity, TypeOfAccount, ExternalSystem, UserID, Password, AttachedToPerson)); @@ -146,7 +146,7 @@ namespace Swarmops.Logic.Swarm { try { - return FromBasic(PirateDb.GetDatabaseForWriting().SetExternalIdentity( + return FromBasic(SwarmDb.GetDatabaseForWriting().SetExternalIdentity( 0, TypeOfAccount, ExternalSystem, UserID, Password, AttachedToPerson)); } diff --git a/Logic/Swarm/Membership.cs b/Logic/Swarm/Membership.cs index d48a076e..82e2c3d3 100644 --- a/Logic/Swarm/Membership.cs +++ b/Logic/Swarm/Membership.cs @@ -60,7 +60,7 @@ namespace Swarmops.Logic.Swarm { ChurnData.LogRetention(this.PersonId, this.OrganizationId, base.Expires); } - PirateDb.GetDatabaseForWriting().SetMembershipExpires(Identity, value); + SwarmDb.GetDatabaseForWriting().SetMembershipExpires(Identity, value); base.Expires = value; } } @@ -68,7 +68,7 @@ namespace Swarmops.Logic.Swarm public void SetPaymentStatus (MembershipPaymentStatus status, DateTime dateTime) { - PirateDb.GetDatabaseForWriting().SetMembershipPaymentStatus(Identity, status, dateTime); + SwarmDb.GetDatabaseForWriting().SetMembershipPaymentStatus(Identity, status, dateTime); LoadPaymentStatus(); paymentStatus.Status = status; paymentStatus.StatusDateTime = dateTime; @@ -78,7 +78,7 @@ namespace Swarmops.Logic.Swarm { if (paymentStatus == null) { - paymentStatus = PirateDb.GetDatabaseForReading().GetMembershipPaymentStatus(this.Identity); + paymentStatus = SwarmDb.GetDatabaseForReading().GetMembershipPaymentStatus(this.Identity); } } @@ -87,7 +87,7 @@ namespace Swarmops.Logic.Swarm public static void LoadPaymentStatuses (Memberships mss) { Dictionary statuses = - PirateDb.GetDatabaseForReading().GetMembershipPaymentStatuses(mss.Identities); + SwarmDb.GetDatabaseForReading().GetMembershipPaymentStatuses(mss.Identities); foreach (Membership ms in mss) { if (ms.paymentStatus == null && statuses.ContainsKey(ms.Identity)) @@ -139,22 +139,22 @@ namespace Swarmops.Logic.Swarm public static Membership FromIdentity(int membershipId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetMembership(membershipId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetMembership(membershipId)); } public static Membership FromIdentityAggressive(int membershipId) { - return FromBasic(PirateDb.GetDatabaseForWriting().GetMembership(membershipId)); + return FromBasic(SwarmDb.GetDatabaseForWriting().GetMembership(membershipId)); } public static Membership FromPersonAndOrganization(int personId, int organizationId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetActiveMembership(personId, organizationId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetActiveMembership(personId, organizationId)); } public static Membership Create (int personId, int organizationId, DateTime expires) { - int membershipId = PirateDb.GetDatabaseForWriting().CreateMembership(personId, organizationId, expires); + int membershipId = SwarmDb.GetDatabaseForWriting().CreateMembership(personId, organizationId, expires); return FromIdentityAggressive(membershipId); } @@ -168,7 +168,7 @@ namespace Swarmops.Logic.Swarm DateTime expires) { return - FromIdentity(PirateDb.GetDatabaseForWriting().ImportMembership(person.Identity, organization.Identity, memberSince, + FromIdentity(SwarmDb.GetDatabaseForWriting().ImportMembership(person.Identity, organization.Identity, memberSince, expires)); } @@ -249,7 +249,7 @@ namespace Swarmops.Logic.Swarm { ChurnData.LogChurn(this.PersonId, this.OrganizationId); } - PirateDb.GetDatabaseForWriting().TerminateMembership(Identity); + SwarmDb.GetDatabaseForWriting().TerminateMembership(Identity); base.Active = false; base.DateTerminated = DateTime.Now; diff --git a/Logic/Swarm/MembershipEvents.cs b/Logic/Swarm/MembershipEvents.cs index 00633d81..51444657 100644 --- a/Logic/Swarm/MembershipEvents.cs +++ b/Logic/Swarm/MembershipEvents.cs @@ -24,7 +24,7 @@ namespace Swarmops.Logic.Swarm // In the person-gathering phase, we use BasicPerson in order to avoid the unneeded translation to Person. - BasicPerson[] allPeople = PirateDb.GetDatabaseForReading().GetAllPeople(); + BasicPerson[] allPeople = SwarmDb.GetDatabaseForReading().GetAllPeople(); var geoLookup = new Dictionary(); var genderLookup = new Dictionary(); @@ -39,7 +39,7 @@ namespace Swarmops.Logic.Swarm // Second phase, load all memberships - BasicMembership[] allMemberships = PirateDb.GetDatabaseForReading().GetMemberships(); + BasicMembership[] allMemberships = SwarmDb.GetDatabaseForReading().GetMemberships(); // Third phase - for every membership, generate one or two membership events diff --git a/Logic/Swarm/Memberships.cs b/Logic/Swarm/Memberships.cs index 9ac6640b..4b1a83c9 100644 --- a/Logic/Swarm/Memberships.cs +++ b/Logic/Swarm/Memberships.cs @@ -37,12 +37,12 @@ namespace Swarmops.Logic.Swarm public static int GetMemberCountForOrganization (Organization organization) { - return PirateDb.GetDatabaseForReading().GetMembershipCountForOrganizations(new[] {organization.Identity}); + return SwarmDb.GetDatabaseForReading().GetMembershipCountForOrganizations(new[] {organization.Identity}); } public static int GetMemberCountForOrganizations (int[] organizationIds) { - return PirateDb.GetDatabaseForReading().GetMembershipCountForOrganizations(organizationIds); + return SwarmDb.GetDatabaseForReading().GetMembershipCountForOrganizations(organizationIds); } public static int GetMemberCountForOrganizationSince (Organization org, DateTime sinceDateTime) @@ -52,7 +52,7 @@ namespace Swarmops.Logic.Swarm public static int GetMemberCountForOrganizationSince (int orgId, DateTime sinceDateTime) { - return PirateDb.GetDatabaseForReading().GetMembershipCountForOrganizationsSince(new[] {orgId}, sinceDateTime); + return SwarmDb.GetDatabaseForReading().GetMembershipCountForOrganizationsSince(new[] {orgId}, sinceDateTime); } public static int GetMemberCountForOrganizations (Organizations organizations) @@ -79,12 +79,12 @@ namespace Swarmops.Logic.Swarm return ForOrganization(organization); } - return FromArray(PirateDb.GetDatabaseForReading().GetMemberships(organization)); + return FromArray(SwarmDb.GetDatabaseForReading().GetMemberships(organization)); } public static Memberships ForOrganization (Organization organization) { - return FromArray(PirateDb.GetDatabaseForReading().GetMemberships(organization, DatabaseCondition.ActiveTrue)); + return FromArray(SwarmDb.GetDatabaseForReading().GetMemberships(organization, DatabaseCondition.ActiveTrue)); } public static Memberships ForOrganizations (Organizations organizations, bool includeTerminated) @@ -94,12 +94,12 @@ namespace Swarmops.Logic.Swarm return ForOrganizations(organizations); } - return FromArray(PirateDb.GetDatabaseForReading().GetMemberships(organizations)); + return FromArray(SwarmDb.GetDatabaseForReading().GetMemberships(organizations)); } public static Memberships ForOrganizations (Organizations organizations) { - return FromArray(PirateDb.GetDatabaseForReading().GetMemberships(organizations, DatabaseCondition.ActiveTrue)); + return FromArray(SwarmDb.GetDatabaseForReading().GetMemberships(organizations, DatabaseCondition.ActiveTrue)); } public static Memberships GetExpiring (Organization organization, DateTime dateExpiry) @@ -110,23 +110,23 @@ namespace Swarmops.Logic.Swarm public static Memberships GetExpired (Organization organization) { return - FromArray(PirateDb.GetDatabaseForReading().GetExpiringMemberships(organization, DateTime.MinValue, + FromArray(SwarmDb.GetDatabaseForReading().GetExpiringMemberships(organization, DateTime.MinValue, DateTime.Now)); } public static Memberships GetExpired (Organization organization, DateTime lowerBound, DateTime upperBound) { - return FromArray(PirateDb.GetDatabaseForReading().GetExpiringMemberships(organization, lowerBound, upperBound, DatabaseCondition.None)); + return FromArray(SwarmDb.GetDatabaseForReading().GetExpiringMemberships(organization, lowerBound, upperBound, DatabaseCondition.None)); } public static Memberships GetExpiring (Organization organization, DateTime lowerBound, DateTime upperBound) { - return FromArray(PirateDb.GetDatabaseForReading().GetExpiringMemberships(organization, lowerBound, upperBound)); + return FromArray(SwarmDb.GetDatabaseForReading().GetExpiringMemberships(organization, lowerBound, upperBound)); } public static Dictionary> GetMembershipsForPeople (int[] personIds, int gracePeriod) { - return PirateDb.GetDatabaseForReading().GetMembershipsForPeople(personIds, gracePeriod); + return SwarmDb.GetDatabaseForReading().GetMembershipsForPeople(personIds, gracePeriod); } } diff --git a/Logic/Swarm/Parley.cs b/Logic/Swarm/Parley.cs index db1df952..63e769a1 100644 --- a/Logic/Swarm/Parley.cs +++ b/Logic/Swarm/Parley.cs @@ -24,13 +24,13 @@ namespace Swarmops.Logic.Swarm public static Parley FromIdentity (int parleyId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetParley(parleyId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetParley(parleyId)); } public static Parley Create (Organization organization, Person person, FinancialAccount budgetInitial, string name, Geography geography, string description, string informationUrl, DateTime startDate, DateTime endDate, Int64 budgetCents, Int64 guaranteeCents, Int64 attendanceFeeCents) { Parley newParley = - FromIdentity(PirateDb.GetDatabaseForWriting().CreateParley(organization.Identity, person.Identity, + FromIdentity(SwarmDb.GetDatabaseForWriting().CreateParley(organization.Identity, person.Identity, -(budgetInitial.Identity), name, geography.Identity, description, informationUrl, startDate, endDate, budgetCents, guaranteeCents, attendanceFeeCents)); @@ -105,7 +105,7 @@ namespace Swarmops.Logic.Swarm if (base.Open != value) { base.Open = value; - PirateDb.GetDatabaseForWriting().SetParleyOpen(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetParleyOpen(this.Identity, value); } } } @@ -133,8 +133,8 @@ namespace Swarmops.Logic.Swarm } base.Attested = true; - PirateDb.GetDatabaseForWriting().SetParleyAttested(this.Identity, true); - PirateDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Attestation, + SwarmDb.GetDatabaseForWriting().SetParleyAttested(this.Identity, true); + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Attestation, FinancialDependencyType.Parley, this.Identity, DateTime.Now, attester.Identity, (double)(this.GuaranteeDecimal)); @@ -156,7 +156,7 @@ namespace Swarmops.Logic.Swarm parentBudget.SetBudget(DateTime.Today.Year, (double) parentBudget.GetBudget(year) + (double) this.BudgetDecimal); // cost budgets are negative - PirateDb.GetDatabaseForWriting().SetParleyBudget(this.Identity, newBudget.Identity); + SwarmDb.GetDatabaseForWriting().SetParleyBudget(this.Identity, newBudget.Identity); } // Reserve the guarantee money @@ -177,7 +177,7 @@ namespace Swarmops.Logic.Swarm throw new NotImplementedException(); /* base.Attested = false; - PirateDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Deattestation, + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Deattestation, FinancialDependencyType.Parley, this.Identity, DateTime.Now, deattester.Identity, (double)(this.GuaranteeDecimal+this.BudgetDecimal));*/ diff --git a/Logic/Swarm/ParleyAttendee.cs b/Logic/Swarm/ParleyAttendee.cs index adba8b57..3972d14a 100644 --- a/Logic/Swarm/ParleyAttendee.cs +++ b/Logic/Swarm/ParleyAttendee.cs @@ -24,17 +24,17 @@ namespace Swarmops.Logic.Swarm public static ParleyAttendee FromIdentity (int parleyAttendeeId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetParleyAttendee(parleyAttendeeId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetParleyAttendee(parleyAttendeeId)); } public static ParleyAttendee Create (Parley parley, Person person, bool asGuest) { - return FromIdentity(PirateDb.GetDatabaseForWriting().CreateParleyAttendee(parley.Identity, person.Identity, asGuest)); + return FromIdentity(SwarmDb.GetDatabaseForWriting().CreateParleyAttendee(parley.Identity, person.Identity, asGuest)); } public void AddOption (ParleyOption option) { - PirateDb.GetDatabaseForWriting().AddParleyAttendeeOption(this.Identity, option.Identity); + SwarmDb.GetDatabaseForWriting().AddParleyAttendeeOption(this.Identity, option.Identity); } public ParleyOptions Options @@ -54,7 +54,7 @@ namespace Swarmops.Logic.Swarm { if (value != base.Active) { - PirateDb.GetDatabaseForWriting().SetParleyAttendeeActive(this.Identity, value); + SwarmDb.GetDatabaseForWriting().SetParleyAttendeeActive(this.Identity, value); base.Active = value; } } @@ -120,7 +120,7 @@ namespace Swarmops.Logic.Swarm base.Invoiced = true; base.OutboundInvoiceId = invoice.Identity; - PirateDb.GetDatabaseForWriting().SetParleyAttendeeInvoiced(this.Identity, invoice.Identity); + SwarmDb.GetDatabaseForWriting().SetParleyAttendeeInvoiced(this.Identity, invoice.Identity); } } } diff --git a/Logic/Swarm/ParleyAttendees.cs b/Logic/Swarm/ParleyAttendees.cs index 8c67d6a0..bd548f52 100644 --- a/Logic/Swarm/ParleyAttendees.cs +++ b/Logic/Swarm/ParleyAttendees.cs @@ -11,7 +11,7 @@ namespace Swarmops.Logic.Swarm { public static ParleyAttendees ForParley (Parley parley) { - return FromArray(PirateDb.GetDatabaseForReading().GetParleyAttendees(parley)); + return FromArray(SwarmDb.GetDatabaseForReading().GetParleyAttendees(parley)); } } } diff --git a/Logic/Swarm/ParleyOption.cs b/Logic/Swarm/ParleyOption.cs index f0db6c31..50d80ebb 100644 --- a/Logic/Swarm/ParleyOption.cs +++ b/Logic/Swarm/ParleyOption.cs @@ -20,12 +20,12 @@ namespace Swarmops.Logic.Swarm public static ParleyOption FromIdentity (int parleyOptionId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetParleyOption(parleyOptionId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetParleyOption(parleyOptionId)); } public static ParleyOption Create (Parley parley, string description, Int64 amountCents) { - return FromIdentity(PirateDb.GetDatabaseForWriting().CreateParleyOption(parley.Identity, description, amountCents)); + return FromIdentity(SwarmDb.GetDatabaseForWriting().CreateParleyOption(parley.Identity, description, amountCents)); } public decimal AmountDecimal diff --git a/Logic/Swarm/ParleyOptions.cs b/Logic/Swarm/ParleyOptions.cs index f022ad75..b11acaf3 100644 --- a/Logic/Swarm/ParleyOptions.cs +++ b/Logic/Swarm/ParleyOptions.cs @@ -18,17 +18,17 @@ namespace Swarmops.Logic.Swarm { if (includeInactive) { - return FromArray(PirateDb.GetDatabaseForReading().GetParleyOptions(parley)); + return FromArray(SwarmDb.GetDatabaseForReading().GetParleyOptions(parley)); } else { - return FromArray(PirateDb.GetDatabaseForReading().GetParleyOptions(parley, DatabaseCondition.ActiveTrue)); + return FromArray(SwarmDb.GetDatabaseForReading().GetParleyOptions(parley, DatabaseCondition.ActiveTrue)); } } public static ParleyOptions ForParleyAttendee (ParleyAttendee attendee) { - int[] parleyOptionIds = PirateDb.GetDatabaseForReading().GetParleyAttendeeOptions(attendee.Identity); + int[] parleyOptionIds = SwarmDb.GetDatabaseForReading().GetParleyAttendeeOptions(attendee.Identity); return FromIdentities(parleyOptionIds); } diff --git a/Logic/Swarm/Parleys.cs b/Logic/Swarm/Parleys.cs index 8eb34367..c93b2b56 100644 --- a/Logic/Swarm/Parleys.cs +++ b/Logic/Swarm/Parleys.cs @@ -19,11 +19,11 @@ namespace Swarmops.Logic.Swarm { if (includeClosed) { - return FromArray(PirateDb.GetDatabaseForReading().GetParleys(organization)); + return FromArray(SwarmDb.GetDatabaseForReading().GetParleys(organization)); } else { - return FromArray(PirateDb.GetDatabaseForReading().GetParleys(organization, DatabaseCondition.OpenTrue)); + return FromArray(SwarmDb.GetDatabaseForReading().GetParleys(organization, DatabaseCondition.OpenTrue)); } } @@ -36,11 +36,11 @@ namespace Swarmops.Logic.Swarm { if (includeClosed) { - return FromArray(PirateDb.GetDatabaseForReading().GetParleys(person)); + return FromArray(SwarmDb.GetDatabaseForReading().GetParleys(person)); } else { - return FromArray(PirateDb.GetDatabaseForReading().GetParleys(person, DatabaseCondition.OpenTrue)); + return FromArray(SwarmDb.GetDatabaseForReading().GetParleys(person, DatabaseCondition.OpenTrue)); } } } diff --git a/Logic/Swarm/PaymentCode.cs b/Logic/Swarm/PaymentCode.cs index 2a307ee1..2a83db66 100644 --- a/Logic/Swarm/PaymentCode.cs +++ b/Logic/Swarm/PaymentCode.cs @@ -35,7 +35,7 @@ namespace Swarmops.Logic.Swarm public static PaymentCode FromCode (string paymentCode) { - return FromBasic(PirateDb.GetDatabaseForReading().GetPaymentCode(paymentCode)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetPaymentCode(paymentCode)); } @@ -49,9 +49,9 @@ namespace Swarmops.Logic.Swarm try { - int codeId = PirateDb.GetDatabaseForWriting().CreatePaymentCode(randomCode, phoneNumber, personId); + int codeId = SwarmDb.GetDatabaseForWriting().CreatePaymentCode(randomCode, phoneNumber, personId); success = true; - return FromBasic(PirateDb.GetDatabaseForReading().GetPaymentCode(randomCode)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetPaymentCode(randomCode)); } catch (Exception) { @@ -72,7 +72,7 @@ namespace Swarmops.Logic.Swarm public void Claim (int claimingPersonId) { - PirateDb.GetDatabaseForWriting().ClaimPaymentCode(Identity, claimingPersonId); + SwarmDb.GetDatabaseForWriting().ClaimPaymentCode(Identity, claimingPersonId); } private static string CreateRandomCode (int length) diff --git a/Logic/Swarm/People.cs b/Logic/Swarm/People.cs index f8d2a909..3983581d 100644 --- a/Logic/Swarm/People.cs +++ b/Logic/Swarm/People.cs @@ -42,7 +42,7 @@ namespace Swarmops.Logic.Swarm lookup[key] = true; } - BasicPerson[] basicArray = PirateDb.GetDatabaseForReading().GetAllPeople(); + BasicPerson[] basicArray = SwarmDb.GetDatabaseForReading().GetAllPeople(); var result = new People(); for (int index = 0; index < basicArray.Length; index++) @@ -57,13 +57,13 @@ namespace Swarmops.Logic.Swarm } else { - return People.FromArray(PirateDb.GetDatabaseForReading().GetPeople(personIds)); + return People.FromArray(SwarmDb.GetDatabaseForReading().GetPeople(personIds)); } } public static People GetAll () { - return People.FromArray(PirateDb.GetDatabaseForReading().GetAllPeople()); + return People.FromArray(SwarmDb.GetDatabaseForReading().GetAllPeople()); } public static People FromNamePattern (string namePattern) @@ -85,7 +85,7 @@ namespace Swarmops.Logic.Swarm namePattern = "%" + namePattern; } - return People.FromArray(PirateDb.GetDatabaseForReading().GetPeopleFromNamePattern(namePattern)); + return People.FromArray(SwarmDb.GetDatabaseForReading().GetPeopleFromNamePattern(namePattern)); } return null; // If no valid search string was supplied @@ -93,7 +93,7 @@ namespace Swarmops.Logic.Swarm public static People FromBirtDatePattern (DateTime fromdate, DateTime todate) { - return People.FromArray(PirateDb.GetDatabaseForReading().GetPeopleFromBirthdate(fromdate, todate)); + return People.FromArray(SwarmDb.GetDatabaseForReading().GetPeopleFromBirthdate(fromdate, todate)); } public static People FromEmailPattern (string emailPattern) @@ -105,7 +105,7 @@ namespace Swarmops.Logic.Swarm { emailPattern = "%" + emailPattern + "%"; - return People.FromArray(PirateDb.GetDatabaseForReading().GetPeopleFromEmailPattern(emailPattern)); + return People.FromArray(SwarmDb.GetDatabaseForReading().GetPeopleFromEmailPattern(emailPattern)); } return null; // If no valid search string was supplied @@ -120,7 +120,7 @@ namespace Swarmops.Logic.Swarm { cityPattern = "%" + cityPattern + "%"; - return People.FromArray(PirateDb.GetDatabaseForReading().GetPeopleFromCityPattern(cityPattern)); + return People.FromArray(SwarmDb.GetDatabaseForReading().GetPeopleFromCityPattern(cityPattern)); } return null; // If no valid search string was supplied @@ -135,7 +135,7 @@ namespace Swarmops.Logic.Swarm { pcPattern = pcPattern + "%"; - return People.FromArray(PirateDb.GetDatabaseForReading().GetPeopleFromPostalCodePattern(pcPattern)); + return People.FromArray(SwarmDb.GetDatabaseForReading().GetPeopleFromPostalCodePattern(pcPattern)); } return null; // If no valid search string was supplied @@ -147,7 +147,7 @@ namespace Swarmops.Logic.Swarm if (pcodes.Length > 0) { - return People.FromArray(PirateDb.GetDatabaseForReading().GetPeopleFromPostalCodes(pcodes)); + return People.FromArray(SwarmDb.GetDatabaseForReading().GetPeopleFromPostalCodes(pcodes)); } return null; // If no valid search string was supplied @@ -157,7 +157,7 @@ namespace Swarmops.Logic.Swarm { if (email.Length > 0) { - return People.FromArray(PirateDb.GetDatabaseForReading().GetPeopleFromEmail(email)); + return People.FromArray(SwarmDb.GetDatabaseForReading().GetPeopleFromEmail(email)); } return null; // If no valid search string was supplied @@ -275,7 +275,7 @@ namespace Swarmops.Logic.Swarm // First, get list of people in the geography, then filter on memberships - BasicPerson[] people = PirateDb.GetDatabaseForReading().GetPeopleInGeographies(geoTree.Identities); + BasicPerson[] people = SwarmDb.GetDatabaseForReading().GetPeopleInGeographies(geoTree.Identities); // Filter on memberships @@ -297,7 +297,7 @@ namespace Swarmops.Logic.Swarm // Get the list of all memberships Dictionary> memberships = - PirateDb.GetDatabaseForReading().GetMembershipsForPeople(LogicServices.ObjectsToIdentifiers(people)); + SwarmDb.GetDatabaseForReading().GetMembershipsForPeople(LogicServices.ObjectsToIdentifiers(people)); var result = new People(); @@ -331,7 +331,7 @@ namespace Swarmops.Logic.Swarm // First, get list of people in the geography, then filter on memberships - BasicPerson[] people = PirateDb.GetDatabaseForReading().GetPeopleInGeographies(geoTree.Identities); + BasicPerson[] people = SwarmDb.GetDatabaseForReading().GetPeopleInGeographies(geoTree.Identities); var result = new People(); @@ -383,17 +383,17 @@ namespace Swarmops.Logic.Swarm public static People FromOptionalData (ObjectOptionalDataType dataType, string data) { - return People.FromIdentities(PirateDb.GetDatabaseForReading().GetObjectsByOptionalData(ObjectType.Person, dataType, data)); + return People.FromIdentities(SwarmDb.GetDatabaseForReading().GetObjectsByOptionalData(ObjectType.Person, dataType, data)); } public static People FromPhoneNumber (int countryId, string phoneNumber) { - return People.FromArray(PirateDb.GetDatabaseForReading().GetPeopleFromPhoneNumber(countryId, phoneNumber)); + return People.FromArray(SwarmDb.GetDatabaseForReading().GetPeopleFromPhoneNumber(countryId, phoneNumber)); } public static People FromPhoneNumber (string countryCode, string phoneNumber) { - return People.FromArray(PirateDb.GetDatabaseForReading().GetPeopleFromPhoneNumber(countryCode, phoneNumber)); + return People.FromArray(SwarmDb.GetDatabaseForReading().GetPeopleFromPhoneNumber(countryCode, phoneNumber)); } public People GetVisiblePeopleByAuthority (Authority authority) @@ -467,7 +467,7 @@ namespace Swarmops.Logic.Swarm public static People FromNewsletterFeed (int feedId) { - int[] subscriberIds = PirateDb.GetDatabaseForReading().GetSubscribersForNewsletterFeed(2); + int[] subscriberIds = SwarmDb.GetDatabaseForReading().GetSubscribersForNewsletterFeed(2); return FromIdentities(subscriberIds); } @@ -487,7 +487,7 @@ namespace Swarmops.Logic.Swarm public static Dictionary GetPeopleGeographies () { - return PirateDb.GetDatabaseForReading().GetPeopleGeographies(); + return SwarmDb.GetDatabaseForReading().GetPeopleGeographies(); } public static People FromIdentities (int[] personIds, bool preserveOrder) diff --git a/Logic/Swarm/Person.cs b/Logic/Swarm/Person.cs index 3c5812e2..186da060 100644 --- a/Logic/Swarm/Person.cs +++ b/Logic/Swarm/Person.cs @@ -56,20 +56,20 @@ namespace Swarmops.Logic.Swarm public bool IsActivist { - get { return PirateDb.GetDatabaseForReading().GetActivistStatus(Identity); } + get { return SwarmDb.GetDatabaseForReading().GetActivistStatus(Identity); } } public new virtual string Name { get { return base.Name.Replace("|", " "); } - set { PirateDb.GetDatabaseForWriting().SetPersonName(Identity, value); } + set { SwarmDb.GetDatabaseForWriting().SetPersonName(Identity, value); } } public new virtual string Street { get { return base.Street; } - set { PirateDb.GetDatabaseForWriting().SetPersonStreet(Identity, value); } + set { SwarmDb.GetDatabaseForWriting().SetPersonStreet(Identity, value); } } @@ -78,7 +78,7 @@ namespace Swarmops.Logic.Swarm get { return base.PostalCode; } set { - PirateDb.GetDatabaseForWriting().SetPersonPostalCode(Identity, value); + SwarmDb.GetDatabaseForWriting().SetPersonPostalCode(Identity, value); base.PostalCode = value; ResolveGeography(); } @@ -90,7 +90,7 @@ namespace Swarmops.Logic.Swarm get { return base.CityName; } set { - PirateDb.GetDatabaseForWriting().SetPersonCity(Identity, value); + SwarmDb.GetDatabaseForWriting().SetPersonCity(Identity, value); base.CityName = value; ResolveGeography(); } @@ -102,7 +102,7 @@ namespace Swarmops.Logic.Swarm get { return Country.FromIdentity(base.CountryId); } set { - PirateDb.GetDatabaseForWriting().SetPersonCountry(Identity, value.Identity); + SwarmDb.GetDatabaseForWriting().SetPersonCountry(Identity, value.Identity); base.CountryId = value.Identity; ResolveGeography(); } @@ -114,7 +114,7 @@ namespace Swarmops.Logic.Swarm if (base.CountryId == 0) { base.GeographyId = 1; - PirateDb.GetDatabaseForWriting().SetPersonGeography(this.Identity, 1); + SwarmDb.GetDatabaseForWriting().SetPersonGeography(this.Identity, 1); return 1; // root geography, if no country set } @@ -144,7 +144,7 @@ namespace Swarmops.Logic.Swarm } base.GeographyId = city.GeographyId; - PirateDb.GetDatabaseForWriting().SetPersonGeography(this.Identity, base.GeographyId); + SwarmDb.GetDatabaseForWriting().SetPersonGeography(this.Identity, base.GeographyId); return city.GeographyId; } @@ -162,7 +162,7 @@ namespace Swarmops.Logic.Swarm } set { - PirateDb.GetDatabaseForWriting().SetPersonGeography(Identity, value.Identity); + SwarmDb.GetDatabaseForWriting().SetPersonGeography(Identity, value.Identity); base.GeographyId = value.Identity; } } @@ -184,27 +184,27 @@ namespace Swarmops.Logic.Swarm public new virtual string Email { get { return base.Email; } - set { PirateDb.GetDatabaseForWriting().SetPersonEmail(Identity, value); } + set { SwarmDb.GetDatabaseForWriting().SetPersonEmail(Identity, value); } } public new virtual string Phone { get { return base.Phone; } - set { PirateDb.GetDatabaseForWriting().SetPersonPhone(Identity, value); } + set { SwarmDb.GetDatabaseForWriting().SetPersonPhone(Identity, value); } } public new virtual DateTime Birthdate { get { return base.Birthdate; } - set { PirateDb.GetDatabaseForWriting().SetPersonBirthdate(Identity, value); } + set { SwarmDb.GetDatabaseForWriting().SetPersonBirthdate(Identity, value); } } public new virtual PersonGender Gender { get { return base.Gender; } - set { PirateDb.GetDatabaseForWriting().SetPersonGender(Identity, value); } + set { SwarmDb.GetDatabaseForWriting().SetPersonGender(Identity, value); } } @@ -370,12 +370,12 @@ namespace Swarmops.Logic.Swarm public static Person FromIdentity(int personId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetPerson(personId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetPerson(personId)); } public static Person FromIdentityAggressive(int personId) { - return FromBasic(PirateDb.GetDatabaseForWriting().GetPerson(personId)); // Note "for writing". Intentional. Queries master db and bypasses replication lag. + return FromBasic(SwarmDb.GetDatabaseForWriting().GetPerson(personId)); // Note "for writing". Intentional. Queries master db and bypasses replication lag. } public Authority GetAuthority() @@ -390,12 +390,12 @@ namespace Swarmops.Logic.Swarm return GetMemberships(); } - return Memberships.FromArray(PirateDb.GetDatabaseForReading().GetMemberships(this)); + return Memberships.FromArray(SwarmDb.GetDatabaseForReading().GetMemberships(this)); } public Memberships GetMemberships () { - return Memberships.FromArray(PirateDb.GetDatabaseForReading().GetMemberships(this, DatabaseCondition.ActiveTrue)); + return Memberships.FromArray(SwarmDb.GetDatabaseForReading().GetMemberships(this, DatabaseCondition.ActiveTrue)); } @@ -511,7 +511,7 @@ namespace Swarmops.Logic.Swarm if (countryCode.Length > 0) { - country = PirateDb.GetDatabaseForReading().GetCountry(countryCode); + country = SwarmDb.GetDatabaseForReading().GetCountry(countryCode); } // Clean data @@ -526,7 +526,7 @@ namespace Swarmops.Logic.Swarm phone = LogicServices.CleanNumber(phone); postal = postal.Replace(" ", "").Trim(); - int personId = PirateDb.GetDatabaseForWriting().CreatePerson(name, email, phone, street, postal, city, + int personId = SwarmDb.GetDatabaseForWriting().CreatePerson(name, email, phone, street, postal, city, country == null? 0: country.Identity, dateOfBirth, gender); @@ -565,7 +565,7 @@ namespace Swarmops.Logic.Swarm { if (null == this.subscriptions) { - this.subscriptions = PirateDb.GetDatabaseForReading().GetNewsletterFeedsForSubscriber(PersonId); + this.subscriptions = SwarmDb.GetDatabaseForReading().GetNewsletterFeedsForSubscriber(PersonId); } if (this.subscriptions.ContainsKey(newsletterFeedId)) @@ -604,14 +604,14 @@ namespace Swarmops.Logic.Swarm bool? subscription = HasExplicitSubscription(newsletterFeedId); if (subscription != null && subscription != subscribe) { - PirateDb.GetDatabaseForWriting().SetNewsletterSubscription(PersonId, newsletterFeedId, subscribe); + SwarmDb.GetDatabaseForWriting().SetNewsletterSubscription(PersonId, newsletterFeedId, subscribe); } else { NewsletterFeed feed = NewsletterFeed.FromIdentity(newsletterFeedId); if (subscribe != feed.DefaultSubscribed) { - PirateDb.GetDatabaseForWriting().SetNewsletterSubscription(PersonId, newsletterFeedId, subscribe); + SwarmDb.GetDatabaseForWriting().SetNewsletterSubscription(PersonId, newsletterFeedId, subscribe); } } this.subscriptions[newsletterFeedId] = subscribe; @@ -620,7 +620,7 @@ namespace Swarmops.Logic.Swarm public void DeleteSubscriptionData () { - PirateDb.GetDatabaseForWriting().DeletePersonNewsletterSubscriptions(Identity); + SwarmDb.GetDatabaseForWriting().DeletePersonNewsletterSubscriptions(Identity); } @@ -633,7 +633,7 @@ namespace Swarmops.Logic.Swarm try { PhoneMessageTransmitter.Send(Phone, message); - // PirateDb.GetDatabase().LogTransmittedPhoneMessage(Identity, Phone, message); + // SwarmDb.GetDatabase().LogTransmittedPhoneMessage(Identity, Phone, message); } catch (Exception ex) { @@ -645,7 +645,7 @@ namespace Swarmops.Logic.Swarm public virtual void SetPassword (string newPassword) { string hash = Authentication.GeneratePasswordHash(Identity, newPassword); - PirateDb.GetDatabaseForWriting().SetPersonPasswordHash(Identity, hash); + SwarmDb.GetDatabaseForWriting().SetPersonPasswordHash(Identity, hash); base.PasswordHash = hash; } @@ -655,7 +655,7 @@ namespace Swarmops.Logic.Swarm get { return base.PasswordHash; } set { - PirateDb.GetDatabaseForWriting().SetPersonPasswordHash(Identity, value); + SwarmDb.GetDatabaseForWriting().SetPersonPasswordHash(Identity, value); base.PasswordHash = value; } } @@ -669,13 +669,13 @@ namespace Swarmops.Logic.Swarm private void SendNotice (string subject, string body, int organizationId, bool asOfficer) { - int mailId = PirateDb.GetDatabaseForWriting().CreateOutboundMail( + int mailId = SwarmDb.GetDatabaseForWriting().CreateOutboundMail( asOfficer ? MailAuthorType.PirateWeb : MailAuthorType.Service, 0, subject, body, OutboundMail.PriorityNormal, 0, GeographyId, organizationId, DateTime.Now); - PirateDb.GetDatabaseForWriting().CreateOutboundMailRecipient(mailId, Identity, asOfficer, (int)OutboundMailRecipient.RecipientType.Person); - PirateDb.GetDatabaseForWriting().SetOutboundMailRecipientCount(mailId, 1); - PirateDb.GetDatabaseForWriting().SetOutboundMailResolved(mailId); - PirateDb.GetDatabaseForWriting().SetOutboundMailReadyForPickup(mailId); + SwarmDb.GetDatabaseForWriting().CreateOutboundMailRecipient(mailId, Identity, asOfficer, (int)OutboundMailRecipient.RecipientType.Person); + SwarmDb.GetDatabaseForWriting().SetOutboundMailRecipientCount(mailId, 1); + SwarmDb.GetDatabaseForWriting().SetOutboundMailResolved(mailId); + SwarmDb.GetDatabaseForWriting().SetOutboundMailReadyForPickup(mailId); } public void SendNotice (string subject, string body, int organizationId) @@ -715,12 +715,12 @@ namespace Swarmops.Logic.Swarm public void CreateActivist (bool isPublic, bool isConfirmed) { - PirateDb.GetDatabaseForWriting().CreateActivist(Identity, isPublic, isConfirmed); + SwarmDb.GetDatabaseForWriting().CreateActivist(Identity, isPublic, isConfirmed); } public void TerminateActivist () { - PirateDb.GetDatabaseForWriting().TerminateActivist(Identity); + SwarmDb.GetDatabaseForWriting().TerminateActivist(Identity); } public PersonRole AddRole (RoleType roleType, Organization organization, Geography geography) diff --git a/Logic/Swarm/PersonRole.cs b/Logic/Swarm/PersonRole.cs index ed9b0f0b..836242ba 100644 --- a/Logic/Swarm/PersonRole.cs +++ b/Logic/Swarm/PersonRole.cs @@ -19,7 +19,7 @@ namespace Swarmops.Logic.Swarm public static PersonRole Create (int personId, RoleType roleType, int organizationId, int nodeId) { - return FromIdentityAggressive(PirateDb.GetDatabaseForWriting().CreateRole(personId, roleType, organizationId, nodeId)); + return FromIdentityAggressive(SwarmDb.GetDatabaseForWriting().CreateRole(personId, roleType, organizationId, nodeId)); } public static PersonRole FromBasic (BasicPersonRole basic) @@ -29,12 +29,12 @@ namespace Swarmops.Logic.Swarm public static PersonRole FromIdentity(int roleId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetRole(roleId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetRole(roleId)); } public static PersonRole FromIdentityAggressive(int roleId) { - return FromBasic(PirateDb.GetDatabaseForWriting().GetRole(roleId)); // Note "for writing". Intentional. Queries master db and bypasses replication lag to avoid race conditions. + return FromBasic(SwarmDb.GetDatabaseForWriting().GetRole(roleId)); // Note "for writing". Intentional. Queries master db and bypasses replication lag to avoid race conditions. } #endregion @@ -58,7 +58,7 @@ namespace Swarmops.Logic.Swarm public void Delete() { - PirateDb.GetDatabaseForWriting().DeleteRole(Identity); + SwarmDb.GetDatabaseForWriting().DeleteRole(Identity); // After this call, the role will be invalid. } diff --git a/Logic/Swarm/RoleLookup.cs b/Logic/Swarm/RoleLookup.cs index b5269bae..96825fe3 100644 --- a/Logic/Swarm/RoleLookup.cs +++ b/Logic/Swarm/RoleLookup.cs @@ -40,7 +40,7 @@ namespace Swarmops.Logic.Swarm public static RoleLookup FromOrganization (int organizationId) { Roles roles = - Roles.FromArray(PirateDb.GetDatabaseForReading().GetRolesForOrganization(organizationId)); + Roles.FromArray(SwarmDb.GetDatabaseForReading().GetRolesForOrganization(organizationId)); return new RoleLookup(roles); } @@ -48,7 +48,7 @@ namespace Swarmops.Logic.Swarm public static RoleLookup FromGeographyAndOrganization (int geographyId, int organizationId) { Roles roles = - Roles.FromArray(PirateDb.GetDatabaseForReading().GetRolesForOrganizationGeography(organizationId, geographyId)); + Roles.FromArray(SwarmDb.GetDatabaseForReading().GetRolesForOrganizationGeography(organizationId, geographyId)); return new RoleLookup(roles); } diff --git a/Logic/Swarm/Roles.cs b/Logic/Swarm/Roles.cs index 9831f53e..91a1e954 100644 --- a/Logic/Swarm/Roles.cs +++ b/Logic/Swarm/Roles.cs @@ -53,7 +53,7 @@ namespace Swarmops.Logic.Swarm foreach (Organization org in orgLine) { - BasicPersonRole[] upwardPersonRoles = PirateDb.GetDatabaseForReading().GetRolesForOrganizationGeographies(org.Identity, + BasicPersonRole[] upwardPersonRoles = SwarmDb.GetDatabaseForReading().GetRolesForOrganizationGeographies(org.Identity, nodeIds); foreach (BasicPersonRole role in upwardPersonRoles) @@ -102,7 +102,7 @@ namespace Swarmops.Logic.Swarm foreach (Organization org in orgTree) { - BasicPersonRole[] downwardPersonRoles = PirateDb.GetDatabaseForReading().GetRolesForOrganizationGeographies(org.Identity, + BasicPersonRole[] downwardPersonRoles = SwarmDb.GetDatabaseForReading().GetRolesForOrganizationGeographies(org.Identity, nodeIds); foreach (BasicPersonRole role in downwardPersonRoles) @@ -144,7 +144,7 @@ namespace Swarmops.Logic.Swarm nodeIds = new int[0]; } - return PirateDb.GetDatabaseForReading().GetRolesForOrganizationsGeographies(orgIds, nodeIds);; + return SwarmDb.GetDatabaseForReading().GetRolesForOrganizationsGeographies(orgIds, nodeIds);; } @@ -156,7 +156,7 @@ namespace Swarmops.Logic.Swarm public static Roles FromOrganization (int organizationId) { - BasicPersonRole[] basicPersonRoles = PirateDb.GetDatabaseForReading().GetRolesForOrganization (organizationId); + BasicPersonRole[] basicPersonRoles = SwarmDb.GetDatabaseForReading().GetRolesForOrganization (organizationId); return FromArray(basicPersonRoles); } @@ -168,7 +168,7 @@ namespace Swarmops.Logic.Swarm public static Person GetLocalLead(int organizationId, int geographyId) { - BasicPersonRole[] personRoles = PirateDb.GetDatabaseForReading().GetRolesForOrganizationGeography(organizationId, geographyId); + BasicPersonRole[] personRoles = SwarmDb.GetDatabaseForReading().GetRolesForOrganizationGeography(organizationId, geographyId); foreach (BasicPersonRole role in personRoles) { @@ -183,7 +183,7 @@ namespace Swarmops.Logic.Swarm public static Person GetChairman (Organization organization) { - BasicPersonRole[] personRoles = PirateDb.GetDatabaseForReading().GetRolesForOrganization(organization.Identity); + BasicPersonRole[] personRoles = SwarmDb.GetDatabaseForReading().GetRolesForOrganization(organization.Identity); foreach (BasicPersonRole role in personRoles) { @@ -203,7 +203,7 @@ namespace Swarmops.Logic.Swarm public static People GetLocalDeputies(int organizationId, int geographyId) { - BasicPersonRole[] personRoles = PirateDb.GetDatabaseForReading().GetRolesForOrganizationGeography(organizationId, geographyId); + BasicPersonRole[] personRoles = SwarmDb.GetDatabaseForReading().GetRolesForOrganizationGeography(organizationId, geographyId); People result = new People(); foreach (BasicPersonRole role in personRoles) @@ -224,7 +224,7 @@ namespace Swarmops.Logic.Swarm // Expensive op: BasicPersonRole[] basicPersonRoles = - PirateDb.GetDatabaseForReading().GetRolesForOrganizationsGeographies(organization.GetTree().Identities, + SwarmDb.GetDatabaseForReading().GetRolesForOrganizationsGeographies(organization.GetTree().Identities, geography.GetTree().Identities); var lookup = new Dictionary(); @@ -248,7 +248,7 @@ namespace Swarmops.Logic.Swarm public static Roles GetAll() { - return FromArray(PirateDb.GetDatabaseForReading().GetRoles()); + return FromArray(SwarmDb.GetDatabaseForReading().GetRoles()); } } } \ No newline at end of file diff --git a/Logic/Swarm/Volunteer.cs b/Logic/Swarm/Volunteer.cs index 97e0395c..b9a03e97 100644 --- a/Logic/Swarm/Volunteer.cs +++ b/Logic/Swarm/Volunteer.cs @@ -24,7 +24,7 @@ namespace Swarmops.Logic.Swarm public static Volunteer FromIdentity (int volunteerId) { - return FromBasic(PirateDb.GetDatabaseForReading().GetVolunteer(volunteerId)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetVolunteer(volunteerId)); } public static Volunteer FromBasic (BasicVolunteer basic) @@ -39,7 +39,7 @@ namespace Swarmops.Logic.Swarm public static Volunteer Create (int personId, int ownerPersonId) { - return FromIdentity(PirateDb.GetDatabaseForWriting().CreateVolunteer(personId, ownerPersonId)); + return FromIdentity(SwarmDb.GetDatabaseForWriting().CreateVolunteer(personId, ownerPersonId)); } #endregion @@ -67,7 +67,7 @@ namespace Swarmops.Logic.Swarm set { this.ownerPerson = value; - PirateDb.GetDatabaseForWriting().SetVolunteerOwnerPersonId(Identity, value.Identity); + SwarmDb.GetDatabaseForWriting().SetVolunteerOwnerPersonId(Identity, value.Identity); } } @@ -120,7 +120,7 @@ namespace Swarmops.Logic.Swarm public VolunteerRoles Roles { - get { return VolunteerRoles.FromArray(PirateDb.GetDatabaseForReading().GetVolunteerRolesByVolunteer(Identity)); } + get { return VolunteerRoles.FromArray(SwarmDb.GetDatabaseForReading().GetVolunteerRolesByVolunteer(Identity)); } } public void AddRole (Organization organization, Geography geography, RoleType roleType) @@ -130,12 +130,12 @@ namespace Swarmops.Logic.Swarm public void AddRole (int organizationId, int geographyId, RoleType roleType) { - PirateDb.GetDatabaseForWriting().CreateVolunteerRole(Identity, organizationId, geographyId, roleType); + SwarmDb.GetDatabaseForWriting().CreateVolunteerRole(Identity, organizationId, geographyId, roleType); } public void Close (string comments) { - PirateDb.GetDatabaseForWriting().CloseVolunteer(Identity, comments); + SwarmDb.GetDatabaseForWriting().CloseVolunteer(Identity, comments); } private void PopulateCache () diff --git a/Logic/Swarm/VolunteerRole.cs b/Logic/Swarm/VolunteerRole.cs index 691dbaa4..491418ca 100644 --- a/Logic/Swarm/VolunteerRole.cs +++ b/Logic/Swarm/VolunteerRole.cs @@ -23,7 +23,7 @@ namespace Swarmops.Logic.Swarm public static VolunteerRole FromIdentity (int identity) { - return FromBasic(PirateDb.GetDatabaseForReading().GetVolunteerRole(identity)); + return FromBasic(SwarmDb.GetDatabaseForReading().GetVolunteerRole(identity)); } public void Close (bool wasAssigned) diff --git a/Logic/Swarm/Volunteers.cs b/Logic/Swarm/Volunteers.cs index 9b6ce2ab..b865d4d8 100644 --- a/Logic/Swarm/Volunteers.cs +++ b/Logic/Swarm/Volunteers.cs @@ -13,7 +13,7 @@ namespace Swarmops.Logic.Swarm { public static Volunteers GetOpen() { - return FromArray(PirateDb.GetDatabaseForReading().GetOpenVolunteers()); + return FromArray(SwarmDb.GetDatabaseForReading().GetOpenVolunteers()); } public static Volunteers FromArray (BasicVolunteer[] basicArray) diff --git a/Site5/Pages/v5/Init/Default.aspx.cs b/Site5/Pages/v5/Init/Default.aspx.cs index 36a77a94..8f302e07 100644 --- a/Site5/Pages/v5/Init/Default.aspx.cs +++ b/Site5/Pages/v5/Init/Default.aspx.cs @@ -269,19 +269,19 @@ public partial class Pages_v5_Init_Default : System.Web.UI.Page // Store database credentials - PirateDb.Configuration.Set( - new PirateDb.Configuration( - new PirateDb.Credentials( + SwarmDb.Configuration.Set( + new SwarmDb.Configuration( + new SwarmDb.Credentials( this.TextCredentialsReadDatabase.Text, - new PirateDb.ServerSet(this.TextCredentialsReadServer.Text), + new SwarmDb.ServerSet(this.TextCredentialsReadServer.Text), this.TextCredentialsReadUser.Text, this.TextCredentialsReadPassword.Text), - new PirateDb.Credentials(this.TextCredentialsWriteDatabase.Text, - new PirateDb.ServerSet(this.TextCredentialsWriteServer.Text), + new SwarmDb.Credentials(this.TextCredentialsWriteDatabase.Text, + new SwarmDb.ServerSet(this.TextCredentialsWriteServer.Text), this.TextCredentialsWriteUser.Text, this.TextCredentialsWritePassword.Text), - new PirateDb.Credentials(this.TextCredentialsAdminDatabase.Text, - new PirateDb.ServerSet(this.TextCredentialsAdminServer.Text), + new SwarmDb.Credentials(this.TextCredentialsAdminDatabase.Text, + new SwarmDb.ServerSet(this.TextCredentialsAdminServer.Text), this.TextCredentialsAdminUser.Text, this.TextCredentialsAdminPassword.Text))); } @@ -344,7 +344,7 @@ public partial class Pages_v5_Init_Default : System.Web.UI.Page // Initialize the root geography (which becomes #1 if everything works) - int rootGeographyId = PirateDb.GetDatabaseForWriting().CreateGeography("World", 0); + int rootGeographyId = SwarmDb.GetDatabaseForWriting().CreateGeography("World", 0); // Get the list of countries @@ -360,7 +360,7 @@ public partial class Pages_v5_Init_Default : System.Web.UI.Page foreach (Swarmops.Site.Automation.Country country in countries) { - countryIdTranslation[country.Code] = PirateDb.GetDatabaseForWriting().CreateCountry(country.Name, + countryIdTranslation[country.Code] = SwarmDb.GetDatabaseForWriting().CreateCountry(country.Name, country.Code, country.Culture, rootGeographyId, 5, @@ -401,10 +401,10 @@ public partial class Pages_v5_Init_Default : System.Web.UI.Page // Create the country's root geography - int countryRootGeographyId = PirateDb.GetDatabaseForWriting().CreateGeography(geography.Name, + int countryRootGeographyId = SwarmDb.GetDatabaseForWriting().CreateGeography(geography.Name, rootGeographyId); geographyIdTranslation[geography.GeographyId] = countryRootGeographyId; - PirateDb.GetDatabaseForWriting().SetCountryGeographyId(countryIdTranslation[countryCode], + SwarmDb.GetDatabaseForWriting().SetCountryGeographyId(countryIdTranslation[countryCode], countryRootGeographyId); InitDatabaseThreadCreateGeographyChildren(geography.Children, countryRootGeographyId, @@ -450,7 +450,7 @@ public partial class Pages_v5_Init_Default : System.Web.UI.Page int newCountryId = countryIdTranslation[countryCode]; - int cityIdHighwater = PirateDb.GetDatabaseForAdmin().ExecuteAdminCommandScalar("SELECT Max(CityId) FROM Cities;"); + int cityIdHighwater = SwarmDb.GetDatabaseForAdmin().ExecuteAdminCommandScalar("SELECT Max(CityId) FROM Cities;"); _initMessage = string.Format("Setting up {0:N0} cities for {1}...", cities.Length, countryCode); @@ -483,7 +483,7 @@ public partial class Pages_v5_Init_Default : System.Web.UI.Page sqlCityBuild.Append(";"); - PirateDb.GetDatabaseForAdmin().ExecuteAdminCommand(sqlCityBuild.ToString()); // Inserts all cities in one bulk op, to save roundtrips + SwarmDb.GetDatabaseForAdmin().ExecuteAdminCommand(sqlCityBuild.ToString()); // Inserts all cities in one bulk op, to save roundtrips // Insert postal codes @@ -516,7 +516,7 @@ public partial class Pages_v5_Init_Default : System.Web.UI.Page sqlBuild.Append(";"); - PirateDb.GetDatabaseForAdmin().ExecuteAdminCommand(sqlBuild.ToString()); // Inserts all postal codes in one bulk op, to save roundtrips + SwarmDb.GetDatabaseForAdmin().ExecuteAdminCommand(sqlBuild.ToString()); // Inserts all postal codes in one bulk op, to save roundtrips countryCount++; @@ -541,7 +541,7 @@ public partial class Pages_v5_Init_Default : System.Web.UI.Page { foreach (Swarmops.Site.Automation.Geography geography in children) { - int newGeographyId = PirateDb.GetDatabaseForWriting().CreateGeography(geography.Name, parentGeographyId); + int newGeographyId = SwarmDb.GetDatabaseForWriting().CreateGeography(geography.Name, parentGeographyId); geographyIdTranslation[geography.GeographyId] = newGeographyId; InitDatabaseThreadCreateGeographyChildren(geography.Children, newGeographyId, ref geographyIdTranslation); @@ -624,7 +624,7 @@ public partial class Pages_v5_Init_Default : System.Web.UI.Page [WebMethod(true)] public static bool IsConfigurationFileWritable() { - return PirateDb.Configuration.TestConfigurationWritable(); + return SwarmDb.Configuration.TestConfigurationWritable(); } [WebMethod] diff --git a/Site5/Security/Login.aspx.cs b/Site5/Security/Login.aspx.cs index 1c6b60f6..79c00d40 100644 --- a/Site5/Security/Login.aspx.cs +++ b/Site5/Security/Login.aspx.cs @@ -18,7 +18,7 @@ namespace Swarmops.Pages.Security { // Check if this is the first run ever. If so, redirect to Init. - if (!PirateDb.Configuration.IsConfigured()) + if (!SwarmDb.Configuration.IsConfigured()) { Response.Redirect("/Pages/v5/Init/", true); return; diff --git a/Utility/BotCode/BlogTop50Scraper.cs b/Utility/BotCode/BlogTop50Scraper.cs index 9a246b1d..d2925bc1 100644 --- a/Utility/BotCode/BlogTop50Scraper.cs +++ b/Utility/BotCode/BlogTop50Scraper.cs @@ -16,7 +16,7 @@ namespace Swarmops.Utility.BotCode // Every hour of the day, we check that this has been recorded for the day. This is just in case // the bot isn't running at midnight, to make sure that we get one entry per day. - if (PirateDb.GetDatabaseForReading().GetBlogTopList(DateTime.Today) == null) + if (SwarmDb.GetDatabaseForReading().GetBlogTopList(DateTime.Today) == null) { ScrapeAndStore(); } @@ -49,7 +49,7 @@ namespace Swarmops.Utility.BotCode match = match.NextMatch(); } - PirateDb.GetDatabaseForWriting().StoreBlogTopList(DateTime.Today, rankingList.ToArray()); + SwarmDb.GetDatabaseForWriting().StoreBlogTopList(DateTime.Today, rankingList.ToArray()); } } } \ No newline at end of file diff --git a/Utility/BotCode/RosterHousekeeping.cs b/Utility/BotCode/RosterHousekeeping.cs index 08270f4d..9a4b0ef9 100644 --- a/Utility/BotCode/RosterHousekeeping.cs +++ b/Utility/BotCode/RosterHousekeeping.cs @@ -760,7 +760,7 @@ namespace Swarmops.Utility.BotCode + fromOrgReport + "\r\n" + toOrgReport; - BasicPersonRole[] UPSecretary = PirateDb.GetDatabaseForReading().GetPeopleWithRoleType(RoleType.OrganizationSecretary, + BasicPersonRole[] UPSecretary = SwarmDb.GetDatabaseForReading().GetPeopleWithRoleType(RoleType.OrganizationSecretary, new int[] { Organization.UPSEid }, new int[] { }); if (UPSecretary.Length > 0) diff --git a/Utility/BotCode/TurnaroundTracker.cs b/Utility/BotCode/TurnaroundTracker.cs index ca932a1a..56f59685 100644 --- a/Utility/BotCode/TurnaroundTracker.cs +++ b/Utility/BotCode/TurnaroundTracker.cs @@ -100,7 +100,7 @@ namespace Swarmops.Utility.BotCode dateTimeClosed = turnaround.DateTimeOpened; } - PirateDb.GetDatabaseForWriting().SetCommunicationTurnaroundClosed(Organization.PPSEid, 1, turnaround.CommunicationId, (DateTime) dateTimeClosed, 0); + SwarmDb.GetDatabaseForWriting().SetCommunicationTurnaroundClosed(Organization.PPSEid, 1, turnaround.CommunicationId, (DateTime) dateTimeClosed, 0); } } } diff --git a/Utility/ExceptionMail.cs b/Utility/ExceptionMail.cs index 9a0149cd..e327ef71 100644 --- a/Utility/ExceptionMail.cs +++ b/Utility/ExceptionMail.cs @@ -19,7 +19,7 @@ namespace Swarmops.Utility { try { - PirateDb.GetDatabaseForWriting().CreateExceptionLogEntry(DateTime.Now, "ExceptionMail", e); + SwarmDb.GetDatabaseForWriting().CreateExceptionLogEntry(DateTime.Now, "ExceptionMail", e); } catch { diff --git a/Utility/Migrations/PeopleOptionalData.cs b/Utility/Migrations/PeopleOptionalData.cs index 405bef64..cf89918c 100644 --- a/Utility/Migrations/PeopleOptionalData.cs +++ b/Utility/Migrations/PeopleOptionalData.cs @@ -13,7 +13,7 @@ namespace Swarmops.Utility.Migrations { public static void Migrate() { - PirateDb db = PirateDb.GetDatabaseForAdmin(); + SwarmDb db = SwarmDb.GetDatabaseForAdmin(); using (DbConnection connection = db.GetSqlServerDbConnection()) {