Adds UI to enrole members

This commit is contained in:
Paul Schneider 2015-11-04 16:20:21 +01:00
commit 0b8b717f3e
12 changed files with 58 additions and 11 deletions

View file

@ -1,3 +1,8 @@
2015-11-04 Paul Schneider <paul@pschneider.fr>
* NpgsqlProfileProvider.cs:
* NpgsqlMembershipProvider.cs:
2015-11-03 Paul Schneider <paul@pschneider.fr>
* NpgsqlMembershipProvider.cs: Fixes the latest commit

View file

@ -378,15 +378,20 @@ namespace Npgsql.Web
conn.Open ();
NpgsqlTransaction tran = conn.BeginTransaction();
long prid = 0;
using (NpgsqlCommand cmd = new NpgsqlCommand ("INSERT INTO profiles (username,applicationname,isanonymous)\n" +
"VALUES (:uname,:app,FALSE)")) {
"VALUES (:uname,:app,FALSE) returning uniqueid")) {
cmd.Connection = conn;
cmd.Parameters.AddWithValue ("uname", username);
cmd.Parameters.AddWithValue ("app", pApplicationName);
cmd.ExecuteNonQuery ();
prid = (long) cmd.ExecuteScalar();
}
using (NpgsqlCommand cmdpdins = conn.CreateCommand ()) {
cmdpdins.CommandText = "insert into profiledata (uniqueid) values (@puid)";
cmdpdins.Parameters.AddWithValue ("@puid", prid);
cmdpdins.ExecuteNonQuery ();
}
using (NpgsqlCommand cmd = new NpgsqlCommand ("INSERT INTO Users " +
" (PKID, Username, Passw, Email, PasswordQuestion, " +
" PasswordAnswer, IsApproved," +

View file

@ -275,11 +275,12 @@ namespace Npgsql.Web
long c = (long)cmdpi.ExecuteScalar ();
if (c == 0) {
// the `isanonymous` field is specified true by default
// This is a new anonymous profile.
// the `isanonymous` field should be specified true by default in the ddl
cmdpi.CommandText = "insert into profiles (username,applicationname) " +
"values ( @username, @appname ) " +
"returning uniqueid";
puid = (long)cmdpi.ExecuteScalar ();
puid = (long) cmdpi.ExecuteScalar ();
using (NpgsqlCommand cmdpdins = cnx.CreateCommand ()) {
cmdpdins.CommandText = "insert into profiledata (uniqueid) values (@puid)";
@ -287,13 +288,13 @@ namespace Npgsql.Web
cmdpdins.ExecuteNonQuery ();
}
} else {
// here we're roughly sure to get the id
cmdpi.CommandText = "select uniqueid from profiles where username = @username " +
"and applicationname = @appname";
puid = (long)cmdpi.ExecuteScalar ();
}
}
foreach (SettingsPropertyValue s in collection) {
if (s.UsingDefaultValue) {
//TODO Drop the property in the profile