diff --git a/Basic/Types/Swarm/BasicPerson.cs b/Basic/Types/Swarm/BasicPerson.cs
index 4a94d845..23d475db 100644
--- a/Basic/Types/Swarm/BasicPerson.cs
+++ b/Basic/Types/Swarm/BasicPerson.cs
@@ -15,7 +15,7 @@ namespace Swarmops.Basic.Types.Swarm
public BasicPerson (int personId, string passwordHash, string name, string email, string street,
string postalCode, string cityName, int countryId, string phone, int geographyId,
- DateTime birthdate, PersonGender gender)
+ DateTime birthdate, PersonGender gender, string twitterId)
{
this.PersonId = personId;
this.PasswordHash = passwordHash;
@@ -29,12 +29,13 @@ namespace Swarmops.Basic.Types.Swarm
this.GeographyId = geographyId;
this.Birthdate = birthdate;
this.Gender = gender;
+ this.TwitterId = twitterId;
}
public BasicPerson (BasicPerson original)
: this (original.PersonId, original.PasswordHash, original.Name, original.Email, original.Street,
original.PostalCode, original.CityName, original.CountryId, original.Phone,
- original.GeographyId, original.Birthdate, original.Gender)
+ original.GeographyId, original.Birthdate, original.Gender, original.TwitterId)
{
}
@@ -62,6 +63,7 @@ namespace Swarmops.Basic.Types.Swarm
public PersonGender Gender { get; protected set; }
public string Name { get; protected set; }
public string Email { get; protected set; }
+ public string TwitterId { get; protected set; }
public int Identity
diff --git a/Common/Enums/ObjectOptionalDataType.cs b/Common/Enums/ObjectOptionalDataType.cs
index 390c8a1b..e025cb18 100644
--- a/Common/Enums/ObjectOptionalDataType.cs
+++ b/Common/Enums/ObjectOptionalDataType.cs
@@ -319,6 +319,11 @@ namespace Swarmops.Common.Enums
///
/// Early Hack - the mail address used for a PayPal account (before properties like this one are rolled into up into automation classes)
///
- OrgPaypalAccountMailAddress
+ OrgPaypalAccountMailAddress,
+
+ ///
+ /// If bitcoin is preferred instead of banking details
+ ///
+ BitcoinPayoutAddress
}
}
\ No newline at end of file
diff --git a/Database/Configuration.cs b/Database/Configuration.cs
index 14c5589d..38641f18 100644
--- a/Database/Configuration.cs
+++ b/Database/Configuration.cs
@@ -14,7 +14,7 @@ namespace Swarmops.Database
///
public static int DbVersionExpected
{
- get { return 22; }
+ get { return 23; }
}
diff --git a/Database/Database-People.cs b/Database/Database-People.cs
index b1e6e78b..f6087b30 100644
--- a/Database/Database-People.cs
+++ b/Database/Database-People.cs
@@ -17,7 +17,7 @@ namespace Swarmops.Database
private const string personFieldSequence =
" PersonId, PasswordHash, Name, Email, Street, " + // 0-4
" PostalCode, City, CountryId, PhoneNumber, GeographyId, " + // 5-9
- " Birthdate, GenderId " + // 10-11
+ " Birthdate, GenderId, TwitterId " + // 10-12
" FROM People ";
private static BasicPerson ReadPersonFromDataReader (DbDataReader reader)
@@ -34,6 +34,7 @@ namespace Swarmops.Database
int geographyId = reader.GetInt32 (9);
DateTime birthdate = reader.GetDateTime (10);
int genderId = reader.GetInt32 (11);
+ string twitterId = reader.GetString (12);
// Fix broken names, emails
@@ -48,7 +49,7 @@ namespace Swarmops.Database
return new BasicPerson (personId, passwordHash, name, email, street, postalCode, cityName, countryId, phone,
- geographyId, birthdate, (PersonGender) genderId);
+ geographyId, birthdate, (PersonGender) genderId, twitterId);
}
#endregion
@@ -395,7 +396,7 @@ namespace Swarmops.Database
{
return new BasicPerson (personId, string.Empty,
"PERSON #" + personId.ToString() + " NOT IN DEV DB", "noreply@example.com", "Foobar 12",
- "12345", "Duckville", 1, "", 1, new DateTime (1972, 1, 21), PersonGender.Unknown);
+ "12345", "Duckville", 1, "", 1, new DateTime (1972, 1, 21), PersonGender.Unknown, "Dumbguy");
}
throw new ArgumentException ("No such PersonId: " + personId.ToString());
}
@@ -536,12 +537,17 @@ namespace Swarmops.Database
SetPersonBasicStringValue (personId, "PhoneNumber", phone);
}
- public void SetPersonEmail (int personId, string email)
+ public void SetPersonEmail(int personId, string email)
{
- SetPersonBasicStringValue (personId, "Email", email);
+ SetPersonBasicStringValue(personId, "Email", email);
}
- public int CreatePerson (string name, string email)
+ public void SetPersonTwitterId(int personId, string twitterId)
+ {
+ SetPersonBasicStringValue(personId, "TwitterId", twitterId);
+ }
+
+ public int CreatePerson(string name, string email)
{
return CreatePerson (name, email, string.Empty, string.Empty, string.Empty, string.Empty, 0,
DateTime.MinValue, PersonGender.Unknown);
diff --git a/Database/Schemata/revisions.txt b/Database/Schemata/revisions.txt
index c3955aa1..a3d8e18a 100644
--- a/Database/Schemata/revisions.txt
+++ b/Database/Schemata/revisions.txt
@@ -20,3 +20,4 @@
0020 - Added concurrency check to TerminatePositionAssignment [RF]
0021 - Added PositionCustomTitles and its stored procedures [RF]
0022 - Added VolunteerPositions and its stored procedures [RF]
+0023 - Added procs to change Facebook, Twitter, GPlus IDs [RF]
\ No newline at end of file
diff --git a/Database/Schemata/upgrade-0023.sql b/Database/Schemata/upgrade-0023.sql
new file mode 100644
index 00000000..cb61e5bb
--- /dev/null
+++ b/Database/Schemata/upgrade-0023.sql
@@ -0,0 +1,67 @@
+DROP procedure IF EXISTS `SetPersonFacebookId`
+
+
+#
+
+
+DROP procedure IF EXISTS `SetPersonTwitterId`
+
+
+#
+
+
+DROP procedure IF EXISTS `SetPersonGPlusId`
+
+
+#
+
+
+CREATE PROCEDURE `SetPersonFacebookId`(
+ IN personId INTEGER,
+ IN facebookId VARCHAR(64)
+)
+BEGIN
+
+ UPDATE People SET People.FacebookId=facebookId
+ WHERE People.PersonId=personId;
+
+ SELECT ROW_COUNT() AS RowsUpdated;
+
+
+END
+
+
+#
+
+
+CREATE PROCEDURE `SetPersonTwitterId`(
+ IN personId INTEGER,
+ IN twitterId VARCHAR(64)
+)
+BEGIN
+
+ UPDATE People SET People.TwitterId=twitterId
+ WHERE People.PersonId=personId;
+
+ SELECT ROW_COUNT() AS RowsUpdated;
+
+
+END
+
+
+#
+
+
+CREATE PROCEDURE `SetPersonGPlusId`(
+ IN personId INTEGER,
+ IN gPlusId VARCHAR(64)
+)
+BEGIN
+
+ UPDATE People SET People.GPlusId=gPlusId
+ WHERE People.PersonId=personId;
+
+ SELECT ROW_COUNT() AS RowsUpdated;
+
+
+END
diff --git a/Logic/Swarm/Person.cs b/Logic/Swarm/Person.cs
index 2e6e4101..1899c2d4 100644
--- a/Logic/Swarm/Person.cs
+++ b/Logic/Swarm/Person.cs
@@ -171,6 +171,12 @@ namespace Swarmops.Logic.Swarm
set { SwarmDb.GetDatabaseForWriting().SetPersonGender (Identity, value); }
}
+ public new virtual string TwitterId
+ {
+ get { return base.TwitterId; }
+ set { SwarmDb.GetDatabaseForWriting().SetPersonTwitterId (Identity, value); }
+ }
+
// Optional data properties
@@ -603,7 +609,7 @@ namespace Swarmops.Logic.Swarm
{
return
FromBasic (new BasicPerson (personId, string.Empty, "Open Ledgers", string.Empty, string.Empty,
- string.Empty, string.Empty, 0, string.Empty, 0, DateTime.MinValue, PersonGender.Unknown));
+ string.Empty, string.Empty, 0, string.Empty, 0, DateTime.MinValue, PersonGender.Unknown, ""));
}
throw new ArgumentException("No such PersonId: " + personId);
@@ -880,6 +886,12 @@ namespace Swarmops.Logic.Swarm
}
+ public string BitcoinPayoutAddress
+ {
+ get { return OptionalData.GetOptionalDataString (ObjectOptionalDataType.BitcoinPayoutAddress); }
+ set { OptionalData.SetOptionalDataString (ObjectOptionalDataType.BitcoinPayoutAddress, value ); }
+ }
+
public virtual void SetPassword (string newPassword)
{