Пример #1
0
 public void UpdateRole(ExtendedRole role, string originalRole)
 {
     using (SqlConnection connection = new SqlConnection(this.connectionString))
     {
         SqlCommand cmd = new SqlCommand("UPDATE aspnet_Roles SET RoleName=@newname, LoweredRoleName=@newnamelower, owners=@owners, emailaddress=@email, externaldest=@destinations WHERE RoleName = @name", connection);
         cmd.Parameters.AddWithValue("newname", role.Name);
         cmd.Parameters.AddWithValue("newnamelower", role.Name.ToLowerInvariant());
         cmd.Parameters.AddWithValue("name", originalRole ?? role.Name);
         cmd.Parameters.AddWithValue("owners", string.Join(",", role.Owners.Select(f => f.ToString()).ToArray()));
         cmd.Parameters.AddWithValue("destinations", string.Join(",", role.Destinations.ToArray()));
         cmd.Parameters.AddWithValue("email", (object)role.EmailAddress ?? DBNull.Value);
         connection.Open();
         cmd.ExecuteNonQuery();
     }
 }
Пример #2
0
 public void UpdateRole(ExtendedRole role, string originalRole)
 {
     using (SqlConnection connection = new SqlConnection(this.connectionString))
     {
         SqlCommand cmd = new SqlCommand("UPDATE aspnet_Roles SET RoleName=@newname, LoweredRoleName=@newnamelower, owners=@owners, emailaddress=@email, externaldest=@destinations WHERE RoleName = @name", connection);
         cmd.Parameters.AddWithValue("newname", role.Name);
         cmd.Parameters.AddWithValue("newnamelower", role.Name.ToLowerInvariant());
         cmd.Parameters.AddWithValue("name", originalRole ?? role.Name);
         cmd.Parameters.AddWithValue("owners", string.Join(",", role.Owners.Select(f => f.ToString()).ToArray()));
         cmd.Parameters.AddWithValue("destinations", string.Join(",", role.Destinations.ToArray()));
         cmd.Parameters.AddWithValue("email", (object)role.EmailAddress ?? DBNull.Value);
         connection.Open();
         cmd.ExecuteNonQuery();
     }
 }