Added social media IDs to Person

This commit is contained in:
Rick Falkvinge
2015-06-12 22:40:30 +02:00
parent d235a5bdbb
commit d58feec70d
7 changed files with 104 additions and 11 deletions
+4 -2
View File
@@ -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
+6 -1
View File
@@ -319,6 +319,11 @@ namespace Swarmops.Common.Enums
/// <summary>
/// Early Hack - the mail address used for a PayPal account (before properties like this one are rolled into up into automation classes)
/// </summary>
OrgPaypalAccountMailAddress
OrgPaypalAccountMailAddress,
/// <summary>
/// If bitcoin is preferred instead of banking details
/// </summary>
BitcoinPayoutAddress
}
}
+1 -1
View File
@@ -14,7 +14,7 @@ namespace Swarmops.Database
/// </summary>
public static int DbVersionExpected
{
get { return 22; }
get { return 23; }
}
+12 -6
View File
@@ -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);
+1
View File
@@ -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]
+67
View File
@@ -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
+13 -1
View File
@@ -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)
{