Error on unused private properties (#2008)

* Error on unused private properties

* Remove nullable

* Delete some commented out code

* Fix compile
This commit is contained in:
Charles Gagnon
2023-04-17 13:27:13 -07:00
committed by GitHub
parent efc8d8f0be
commit c15108808f
8 changed files with 399 additions and 988 deletions

View File

@@ -14,6 +14,11 @@ dotnet_diagnostic.IDE0073.severity = none
dotnet_analyzer_diagnostic.severity = error
# The private field 'field' is assigned but its value is never used
dotnet_diagnostic.CS0414.severity = error
# The private field 'class member' is never used
dotnet_diagnostic.CS0169.severity = error
# Errors flagged when this file was added. These should be
# investigated and either fixed or marked as acceptable with
# a reason why

View File

@@ -23,7 +23,6 @@ namespace Microsoft.SqlTools.Extensibility
{
private ExtensibleServiceHostOptions options;
private static bool isLoaded;
public ExtensionServiceProvider serviceProvider;
private List<IHostedService> initializedServices = new List<IHostedService>();
@@ -39,8 +38,6 @@ namespace Microsoft.SqlTools.Extensibility
// as otherwise the Initialize event can be lost - it's processed and discarded before the handler
// is hooked up to receive the message
this.Start().GetAwaiter().GetResult();
isLoaded = true;
}
private void Initialize()
@@ -242,13 +239,13 @@ namespace Microsoft.SqlTools.Extensibility
public class ExtensibleServiceHostOptions
{
/// <summary>
/// The folder where the extension service assemblies are located. By default it is
/// The folder where the extension service assemblies are located. By default it is
/// the folder where the current server assembly is located.
/// </summary>
public string ExtensionServiceAssemblyDirectory { get; set; } = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
/// <summary>
/// The dlls that contain the extension services.
/// The dlls that contain the extension services.
/// </summary>
public string[] ExtensionServiceAssemblyDllFileNames { get; set; } = new string[0];
@@ -258,7 +255,7 @@ namespace Microsoft.SqlTools.Extensibility
public string HostName { get; set; } = HostDetails.DefaultHostName;
/// <summary>
/// Gets the profile ID of the host, used to determine the
/// Gets the profile ID of the host, used to determine the
/// host-specific profile path.
/// </summary>
public string HostProfileId { get; set; } = HostDetails.DefaultHostProfileId;

View File

@@ -62,11 +62,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
/// </summary>
public static ConnectionService Instance => instance.Value;
/// <summary>
/// The authenticator instance for AAD MFA authentication needs.
/// </summary>
private IAuthenticator authenticator;
/// <summary>
/// IV and Key as received from Encryption Key Notification event.
/// </summary>
@@ -171,7 +166,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
}
/// <summary>
/// Enables configured 'Sql Authentication Provider' for 'Active Directory Interactive' authentication mode to be used
/// Enables configured 'Sql Authentication Provider' for 'Active Directory Interactive' authentication mode to be used
/// when user chooses 'Azure MFA'.
/// </summary>
public bool EnableSqlAuthenticationProvider { get; set; }
@@ -433,7 +428,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
while (counter <= MaxServerlessReconnectTries)
{
// The OpenAsync function used in TryOpenConnection does not retry when a database is sleeping.
// SqlClient will be implemented at a later time, which will have automatic retries.
// SqlClient will be implemented at a later time, which will have automatic retries.
response = await TryOpenConnection(connectionInfo, connectionParams);
// If a serverless database is sleeping, it will return this error number and will need to be retried.
// See here for details: https://docs.microsoft.com/en-us/azure/azure-sql/database/serverless-tier-overview?view=azuresql#connectivity
@@ -1086,7 +1081,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
public void InitializeService(IProtocolEndpoint serviceHost, ServiceLayerCommandOptions commandOptions)
{
this.ServiceHost = serviceHost;
if (commandOptions != null && commandOptions.EnableSqlAuthenticationProvider)
{

View File

@@ -394,7 +394,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
/// <param name="nodeToCompare"></param>
/// <param name="ignoreDatabaseName"></param>
/// <returns></returns>
///
///
public bool IsLogicallyEquivalentTo(Node nodeToCompare, bool ignoreDatabaseName)
{
// same exact node
@@ -416,7 +416,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
ExpandableObjectWrapper objectProp1 = (ExpandableObjectWrapper)this[objectProperty];
ExpandableObjectWrapper objectProp2 = (ExpandableObjectWrapper)nodeToCompare[objectProperty];
// object property doesn't match
// by default, we ignore DB name
// by default, we ignore DB name
// for ex: "[master].[sys].[sysobjvalues].[clst] [e]" and "[master_copy].[sys].[sysobjvalues].[clst] [e]" would be same
if (ignoreDatabaseName)
{
@@ -742,8 +742,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
private ShowPlanGraph graph;
private Edge parentEdge;
private List<Edge> childrenEdges;
private string nodeType;
private Node root;
/// <summary>

View File

@@ -30,7 +30,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
}
/// <summary>
///
///
/// </summary>
/// <param name="name">Operator name</param>
/// <param name="displayNameKey">Display name resource ID</param>
@@ -118,8 +118,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
private string displayNameKey;
private string descriptionKey;
private string imageName;
private string helpKeyword;
private Type displayNodeType;
private string image;
private string displayName;

View File

@@ -37,14 +37,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Management
/// </summary>
private string contextUrn;
/// <summary>
/// Parent node in the tree
/// </summary>
//private INodeInformation parent;
/// <summary>
/// Weak reference to the tree node this is paired with
/// </summary>
WeakReference NavigableItemReference;
/// <summary>
/// Property handlers
/// </summary>
//private IList<IPropertyHandler> propertyHandlers;
@@ -63,7 +55,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Management
#endregion
#region constructors
public ActionContext(ServerConnection connection, string name, string contextUrn)
{
if (connection == null)
@@ -83,8 +75,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Management
this.name = name;
properties = new NameObjectCollection();
//propertyHandlers = null;
NavigableItemReference = null;
}
#endregion
@@ -263,13 +253,13 @@ namespace Microsoft.SqlTools.ServiceLayer.Management
if (info == null || info.UrnProperties == null)
yield break;
// Special order for Schema and Name
if (properties.Contains("Schema"))
yield return urn.GetAttribute("Schema");
if (properties.Contains("Name"))
yield return urn.GetAttribute("Name");
yield return urn.GetAttribute("Name");
foreach (ObjectProperty obj in info.UrnProperties)
{
@@ -440,7 +430,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Management
#region construction
/// <summary>
///
///
/// </summary>
public DataContainerXmlGenerator(ActionContext context, string mode = "new")
{
@@ -452,7 +442,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Management
#region IObjectBuilder implementation
/// <summary>
///
///
/// </summary>
/// <param name="name"></param>
/// <param name="value"></param>
@@ -580,7 +570,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Management
{
System.Diagnostics.Debug.Assert(xmlWriter != null, "xmlWriter should never be null.");
// There are two ways we can add context information.
// There are two ways we can add context information.
// The first is just off of the node we were launched against. We will break the urn down
// into it's individual components. And pass them to the dialog.
// The second is by performing a query relative to the node we were launched against

View File

@@ -22,9 +22,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
/// </summary>
internal class AppRoleGeneral
{
#region Members
private IServiceProvider serviceProvider = null;
#region Members
/// <summary>
/// data container member that contains data specific information like
@@ -38,40 +36,10 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
//property by the initialization code
private ServerConnection serverConnection;
/// <summary>
/// execution mode by default for now is success
/// </summary>
private ExecutionMode m_executionMode = ExecutionMode.Success;
/// <summary>
/// should UI be enabled?
/// </summary>
private bool executeEnabled = true;
/// <summary>
/// should script buttons be enabled?
/// </summary>
private bool scriptEnabled = true;
/// <summary>
/// F1 keyword to be passed to books on-line
/// </summary>
private string helpF1Keyword = null;
private RunType runType;
//if derived class tries to call a protected method that relies on service provider,
//and the service provider hasn't been set yet, we will cache the values and will
//propagate them when we get the provider set
private System.Drawing.Icon cachedIcon = null;
private string cachedCaption = null;
//whether or not try to auto resize grid columns inside OnLoad method
private bool attemtGridAutoResize = true;
#endregion
#endregion
#region Trace support
#region Trace support
private const string componentName = "AppRoleGeneral";
public string ComponentName
@@ -81,18 +49,18 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
return componentName;
}
}
#endregion
#endregion
#region Constants - urn fields, etc...
#region Constants - urn fields, etc...
private const string ownerField = "Owner";
private const string defaultSchemaField = "DefaultSchema";
private const string schemaNameField = "Name";
private const string schemaOwnerField = "Owner";
private const string memberNameField = "Name";
private const string memberUrnField = "Urn";
#endregion
#endregion
#region Constants - grid columns positions, etc...
#region Constants - grid columns positions, etc...
private const int colSchemasChecked = 0;
private const int colSchemasOwnedSchemas = 1;
@@ -101,17 +69,15 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
private const int sizeCheckboxColumn = 20;
private const int sizeBitmapColumn = 20;
#endregion
#endregion
#region Non-UI variables
#region Non-UI variables
private System.Xml.XmlDocument document = null;
private bool panelInitialized = false;
// info extracted from context
private string serverName;
private string databaseName;
private string approleName;
private string serverName;
private string databaseName;
private string approleName;
private bool passwordChanged = false;
@@ -119,21 +85,21 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
private string initialDefaultSchema;
private bool isYukonOrLater;
#endregion
private bool isYukonOrLater;
#endregion
#region Properties: CreateNew/Properties mode
#region Properties: CreateNew/Properties mode
private bool IsPropertiesMode
{
get
{
return(approleName!=null) && (approleName.Trim().Length != 0);
return (approleName != null) && (approleName.Trim().Length != 0);
}
}
#endregion
#endregion
#region Constructors / Dispose
#region Constructors / Dispose
public AppRoleGeneral()
{
// This call is required by the Windows.Forms Form Designer.
@@ -142,11 +108,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
public AppRoleGeneral(CDataContainer context)
{
// STrace.SetDefaultLevel(ComponentName , SQLToolsCommonTraceLvl.L1);
// this.HelpF1Keyword = AssemblyVersionInfo.VersionHelpKeywordPrefix + @".swb.approle.general.f1";
// InitializeComponent();
dataContainer = context;
if (dataContainer != null)
@@ -176,9 +137,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
// base.Dispose( disposing );
// }
#endregion
#endregion
#region Implementation: LoadData(), InitProp(), SendDataToServer()
#region Implementation: LoadData(), InitProp(), SendDataToServer()
/// <summary>
@@ -191,16 +152,16 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
{
// STrace.Params(ComponentName, "LoadData", "XmlDocument doc=\"{0}\"", doc.OuterXml);
STParameters param;
bool bStatus;
STParameters param;
bool bStatus;
param = new STParameters();
param = new STParameters();
param.SetDocument(doc);
bStatus = param.GetParam("servername", ref this.serverName);
bStatus = param.GetParam("database", ref this.databaseName);
bStatus = param.GetParam("applicationrole", ref this.approleName);
bStatus = param.GetParam("servername", ref this.serverName);
bStatus = param.GetParam("database", ref this.databaseName);
bStatus = param.GetParam("applicationrole", ref this.approleName);
}
/// <summary>
@@ -235,7 +196,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
Enumerator enumerator = new Enumerator();
Request request = new Request();
request.Urn = this.dataContainer.ObjectUrn;
request.Fields = new String[] { AppRoleGeneral.defaultSchemaField};
request.Fields = new String[] { AppRoleGeneral.defaultSchemaField };
DataTable dataTable = enumerator.Process(serverConnection, request);
// STrace.Assert(dataTable != null, "dataTable is null");
@@ -247,7 +208,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
}
DataRow dataRow = dataTable.Rows[0];
this.initialDefaultSchema = Convert.ToString(dataRow[AppRoleGeneral.defaultSchemaField],System.Globalization.CultureInfo.InvariantCulture);
this.initialDefaultSchema = Convert.ToString(dataRow[AppRoleGeneral.defaultSchemaField], System.Globalization.CultureInfo.InvariantCulture);
// this.textBoxDefaultSchema.Text = this.initialDefaultSchema;
}
@@ -346,17 +307,17 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(this.databaseName), "databaseName is empty");
Microsoft.SqlServer.Management.Smo.Server srv = this.dataContainer.Server;
System.Diagnostics.Debug.Assert(srv!=null, "server object is null");
System.Diagnostics.Debug.Assert(srv != null, "server object is null");
Database db = srv.Databases[this.databaseName];
System.Diagnostics.Debug.Assert(db!=null, "database object is null");
System.Diagnostics.Debug.Assert(db != null, "database object is null");
if (this.IsPropertiesMode == true) // in properties mode -> alter role
{
System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(this.approleName), "approleName is empty");
ApplicationRole approle = db.ApplicationRoles[this.approleName];
System.Diagnostics.Debug.Assert(approle!=null, "approle object is null");
System.Diagnostics.Debug.Assert(approle != null, "approle object is null");
bool alterRequired = false;
@@ -368,7 +329,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
if (passwordChanged == true)
{
approle.ChangePassword((string) "_textBoxPaswordText");
approle.ChangePassword((string)"_textBoxPaswordText");
}
if (alterRequired == true)
@@ -387,238 +348,18 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
approle.DefaultSchema = _selectedDefaultSchema;
}
approle.Create((string) "_textBoxPaswordText");
approle.Create((string)"_textBoxPaswordText");
SendToServerSchemaOwnershipChanges(db,approle);
SendToServerMembershipChanges(db,approle);
SendToServerSchemaOwnershipChanges(db, approle);
SendToServerMembershipChanges(db, approle);
this.dataContainer.SqlDialogSubject = approle; // needed by extended properties page
}
}
#endregion
#endregion
// #region Update UI enable/disable controls
// private void EnableDisableControls()
// {
// if (!this.isYukonOrLater)
// {
// panelSchema.Enabled = false;
// textBoxDefaultSchema.Enabled = false;
// buttonBrowseSchema.Enabled = false;
// }
// if (this.IsPropertiesMode == true)
// {
// System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(this.textBoxRoleName.Text), "textBoxRoleName is empty");
// this.textBoxRoleName.Enabled = false;
// this.AllUIEnabled = true;
// }
// else
// {
// this.textBoxRoleName.Enabled = true;
// this.AllUIEnabled = (this.textBoxRoleName.Text.Trim().Length != 0);
// }
// if ((passwordChanged==true) && (textBoxPasword.Text != textBoxConfirmPassword.Text))
// {
// this.AllUIEnabled = false;
// }
// buttonRemove.Enabled = (gridRoleMembership.SelectedRow>=0);
// panelMembership.Enabled = false; // app role currently doesnt support any members
// }
// #endregion
// #region Component Designer generated code
// /// <summary>
// /// Required method for Designer support - do not modify
// /// the contents of this method with the code editor.
// /// </summary>
// private void InitializeComponent()
// {
// System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AppRoleGeneral));
// this.panelEntireUserControl = new System.Windows.Forms.Panel();
// this.panelGeneral = new System.Windows.Forms.Panel();
// this.buttonBrowseSchema = new System.Windows.Forms.Button();
// this.textBoxDefaultSchema = new System.Windows.Forms.TextBox();
// this.textBoxPasword = new System.Windows.Forms.TextBox();
// this.labelPassword = new System.Windows.Forms.Label();
// this.labelDefaultSchema = new System.Windows.Forms.Label();
// this.textBoxRoleName = new System.Windows.Forms.TextBox();
// this.labelRoleName = new System.Windows.Forms.Label();
// this.textBoxConfirmPassword = new System.Windows.Forms.TextBox();
// this.labelConfirmPassword = new System.Windows.Forms.Label();
// this.panelMembership = new System.Windows.Forms.Panel();
// this.buttonRemove = new System.Windows.Forms.Button();
// this.buttonAdd = new System.Windows.Forms.Button();
// this.gridRoleMembership = new Microsoft.SqlServer.Management.SqlManagerUI.SqlManagerUIDlgGrid();
// this.labelMembersOfAppRole = new System.Windows.Forms.Label();
// this.panelSchema = new System.Windows.Forms.Panel();
// this.gridSchemasOwned = new Microsoft.SqlServer.Management.SqlManagerUI.SqlManagerUIDlgGrid();
// this.labelSchemasOwnedByAppRole = new System.Windows.Forms.Label();
// this.panelEntireUserControl.SuspendLayout();
// this.panelGeneral.SuspendLayout();
// this.panelMembership.SuspendLayout();
// ((System.ComponentModel.ISupportInitialize)(this.gridRoleMembership)).BeginInit();
// this.panelSchema.SuspendLayout();
// ((System.ComponentModel.ISupportInitialize)(this.gridSchemasOwned)).BeginInit();
// this.SuspendLayout();
// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
// this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
// //
// // panelEntireUserControl
// // Important: For narrator accessibility please make sure all Controls.Add are in order from top to bottom, left to right
// //
// this.panelEntireUserControl.Controls.Add(this.panelGeneral);
// this.panelEntireUserControl.Controls.Add(this.panelMembership);
// this.panelEntireUserControl.Controls.Add(this.panelSchema);
// resources.ApplyResources(this.panelEntireUserControl, "panelEntireUserControl");
// this.panelEntireUserControl.Name = "panelEntireUserControl";
// //
// // panelGeneral
// // Important: For narrator accessibility please make sure all Controls.Add are in order from top to bottom, left to right
// //
// resources.ApplyResources(this.panelGeneral, "panelGeneral");
// this.panelGeneral.Controls.Add(this.labelRoleName);
// this.panelGeneral.Controls.Add(this.textBoxRoleName);
// this.panelGeneral.Controls.Add(this.labelDefaultSchema);
// this.panelGeneral.Controls.Add(this.textBoxDefaultSchema);
// this.panelGeneral.Controls.Add(this.buttonBrowseSchema);
// this.panelGeneral.Controls.Add(this.labelPassword);
// this.panelGeneral.Controls.Add(this.textBoxPasword);
// this.panelGeneral.Controls.Add(this.labelConfirmPassword);
// this.panelGeneral.Controls.Add(this.textBoxConfirmPassword);
// this.panelGeneral.Name = "panelGeneral";
// //
// // buttonBrowseSchema
// //
// resources.ApplyResources(this.buttonBrowseSchema, "buttonBrowseSchema");
// this.buttonBrowseSchema.Name = "buttonBrowseSchema";
// this.buttonBrowseSchema.Click += new System.EventHandler(this.buttonBrowseSchema_Click);
// //
// // textBoxDefaultSchema
// //
// resources.ApplyResources(this.textBoxDefaultSchema, "textBoxDefaultSchema");
// this.textBoxDefaultSchema.Name = "textBoxDefaultSchema";
// this.textBoxDefaultSchema.TextChanged += new System.EventHandler(this.textBoxRoleName_TextChanged);
// //
// // textBoxPasword
// //
// resources.ApplyResources(this.textBoxPasword, "textBoxPasword");
// this.textBoxPasword.Name = "textBoxPasword";
// this.textBoxPasword.TextChanged += new System.EventHandler(this.textBoxPasword_TextChanged);
// //
// // labelPassword
// //
// resources.ApplyResources(this.labelPassword, "labelPassword");
// this.labelPassword.Name = "labelPassword";
// //
// // labelDefaultSchema
// //
// resources.ApplyResources(this.labelDefaultSchema, "labelDefaultSchema");
// this.labelDefaultSchema.Name = "labelDefaultSchema";
// //
// // textBoxRoleName
// //
// resources.ApplyResources(this.textBoxRoleName, "textBoxRoleName");
// this.textBoxRoleName.Name = "textBoxRoleName";
// this.textBoxRoleName.TextChanged += new System.EventHandler(this.textBoxRoleName_TextChanged);
// //
// // labelRoleName
// //
// resources.ApplyResources(this.labelRoleName, "labelRoleName");
// this.labelRoleName.Name = "labelRoleName";
// //
// // textBoxConfirmPassword
// //
// resources.ApplyResources(this.textBoxConfirmPassword, "textBoxConfirmPassword");
// this.textBoxConfirmPassword.Name = "textBoxConfirmPassword";
// this.textBoxConfirmPassword.TextChanged += new System.EventHandler(this.textBoxConfirmPassword_TextChanged);
// //
// // labelConfirmPassword
// //
// resources.ApplyResources(this.labelConfirmPassword, "labelConfirmPassword");
// this.labelConfirmPassword.Name = "labelConfirmPassword";
// //
// // panelMembership
// // Important: For narrator accessibility please make sure all Controls.Add are in order from top to bottom, left to right
// //
// resources.ApplyResources(this.panelMembership, "panelMembership");
// this.panelMembership.Controls.Add(this.labelMembersOfAppRole);
// this.panelMembership.Controls.Add(this.gridRoleMembership);
// this.panelMembership.Controls.Add(this.buttonAdd);
// this.panelMembership.Controls.Add(this.buttonRemove);
// this.panelMembership.Name = "panelMembership";
// //
// // buttonRemove
// //
// resources.ApplyResources(this.buttonRemove, "buttonRemove");
// this.buttonRemove.Name = "buttonRemove";
// this.buttonRemove.Click += new System.EventHandler(this.buttonRemove_Click);
// //
// // buttonAdd
// //
// resources.ApplyResources(this.buttonAdd, "buttonAdd");
// this.buttonAdd.Name = "buttonAdd";
// this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
// //
// // gridRoleMembership
// //
// resources.ApplyResources(this.gridRoleMembership, "gridRoleMembership");
// this.gridRoleMembership.BackColor = System.Drawing.SystemColors.Window;
// this.gridRoleMembership.ForceEnabled = false;
// this.gridRoleMembership.Name = "gridRoleMembership";
// this.gridRoleMembership.SelectionChanged += new Microsoft.SqlServer.Management.UI.Grid.SelectionChangedEventHandler(this.gridRoleMembership_SelectionChanged);
// //
// // labelMembersOfAppRole
// //
// resources.ApplyResources(this.labelMembersOfAppRole, "labelMembersOfAppRole");
// this.labelMembersOfAppRole.Name = "labelMembersOfAppRole";
// //
// // panelSchema
// // Important: For narrator accessibility please make sure all Controls.Add are in order from top to bottom, left to right
// //
// resources.ApplyResources(this.panelSchema, "panelSchema");
// this.panelSchema.Controls.Add(this.labelSchemasOwnedByAppRole);
// this.panelSchema.Controls.Add(this.gridSchemasOwned);
// this.panelSchema.Name = "panelSchema";
// //
// // gridSchemasOwned
// //
// resources.ApplyResources(this.gridSchemasOwned, "gridSchemasOwned");
// this.gridSchemasOwned.BackColor = System.Drawing.SystemColors.Window;
// this.gridSchemasOwned.ForceEnabled = false;
// this.gridSchemasOwned.Name = "gridSchemasOwned";
// this.gridSchemasOwned.MouseButtonClicked += new Microsoft.SqlServer.Management.UI.Grid.MouseButtonClickedEventHandler(this.gridSchemasOwned_MouseButtonClicked);
// //
// // labelSchemasOwnedByAppRole
// //
// resources.ApplyResources(this.labelSchemasOwnedByAppRole, "labelSchemasOwnedByAppRole");
// this.labelSchemasOwnedByAppRole.Name = "labelSchemasOwnedByAppRole";
// //
// // AppRoleGeneral
// //
// this.Controls.Add(this.panelEntireUserControl);
// this.Name = "AppRoleGeneral";
// resources.ApplyResources(this, "$this");
// this.panelEntireUserControl.ResumeLayout(false);
// this.panelGeneral.ResumeLayout(false);
// this.panelGeneral.PerformLayout();
// this.panelMembership.ResumeLayout(false);
// ((System.ComponentModel.ISupportInitialize)(this.gridRoleMembership)).EndInit();
// this.panelSchema.ResumeLayout(false);
// ((System.ComponentModel.ISupportInitialize)(this.gridSchemasOwned)).EndInit();
// this.ResumeLayout(false);
// }
// #endregion
#region Schemas - general operations with ...
#region Schemas - general operations with ...
HybridDictionary dictSchemas = null;
StringCollection schemaNames = null;
/// <summary>
@@ -633,17 +374,17 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
Enumerator en = new Enumerator();
Request req = new Request();
req.Fields = new String[] { AppRoleGeneral.schemaNameField, AppRoleGeneral.schemaOwnerField};
req.Fields = new String[] { AppRoleGeneral.schemaNameField, AppRoleGeneral.schemaOwnerField };
req.Urn = "Server/Database[@Name='" + Urn.EscapeString(this.databaseName) + "']/Schema";
req.OrderByList = new OrderBy[] { new OrderBy("Name", OrderBy.Direction.Asc)};
req.OrderByList = new OrderBy[] { new OrderBy("Name", OrderBy.Direction.Asc) };
DataTable dt = en.Process(serverConnection, req);
// STrace.Assert((dt != null) && (dt.Rows.Count > 0), "No rows returned from schema enumerator");
foreach (DataRow dr in dt.Rows)
{
string name = Convert.ToString(dr[AppRoleGeneral.schemaNameField],System.Globalization.CultureInfo.InvariantCulture);
string owner = Convert.ToString(dr[AppRoleGeneral.schemaOwnerField],System.Globalization.CultureInfo.InvariantCulture);
string name = Convert.ToString(dr[AppRoleGeneral.schemaNameField], System.Globalization.CultureInfo.InvariantCulture);
string owner = Convert.ToString(dr[AppRoleGeneral.schemaOwnerField], System.Globalization.CultureInfo.InvariantCulture);
dictSchemas.Add(name, owner);
schemaNames.Add(name);
@@ -651,82 +392,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
}
}
/// <summary>
/// initializes the columns and headers of schema grid - but doesnt populate grid with any data
/// </summary>
// private void InitializeSchemasGridColumns()
// {
// Microsoft.SqlServer.Management.UI.Grid.DlgGridControl grid = this.gridSchemasOwned;
// if (grid.RowsNumber != 0)
// {
// grid.DeleteAllRows();
// }
// while (grid.ColumnsNumber != 0)
// {
// grid.DeleteColumn(0);
// }
// GridColumnInfo colInfo = null;
// // checkbox owned/not-owned
// colInfo = new GridColumnInfo();
// colInfo.ColumnWidth = sizeCheckboxColumn;
// colInfo.WidthType = GridColumnWidthType.InPixels;
// colInfo.ColumnType = GridColumnType.Checkbox;
// grid.AddColumn(colInfo);
// // schema name
// colInfo = new GridColumnInfo();
// colInfo.ColumnWidth = grid.Width - sizeCheckboxColumn - 2;
// colInfo.WidthType = GridColumnWidthType.InPixels;
// grid.AddColumn(colInfo);
// grid.SetHeaderInfo(colSchemasOwnedSchemas, AppRoleSR.HeaderOwnedSchemas, null);
// grid.SelectionType = GridSelectionType.SingleRow;
// grid.UpdateGrid();
// }
// private void FillSchemasGrid()
// {
// if (this.isYukonOrLater)
// {
// Microsoft.SqlServer.Management.UI.Grid.DlgGridControl grid = this.gridSchemasOwned;
// grid.DeleteAllRows();
// foreach (string schemaName in this.schemaNames)
// {
// GridCellCollection row = new GridCellCollection();
// GridCell cell = null;
// STrace.Assert(!string.IsNullOrWhiteSpace(schemaName), "schemaName is empty");
// string owner = this.dictSchemas[schemaName].ToString();
// STrace.Assert(!string.IsNullOrWhiteSpace(owner), "owner is empty");
// bool owned = IsPropertiesMode ? (0 == String.Compare(owner, approleName, StringComparison.Ordinal)) : false;
// // grid is filled either
// // a) disabled-checked checkboxes: Indeterminate - if already owning schema - we cannot renounce ownership
// // b) enabled-unchecked checkboxes: Unchecked - user can check / uncheck them and we read final state
// cell = new GridCell(owned ? GridCheckBoxState.Indeterminate : GridCheckBoxState.Unchecked); row.Add(cell);
// cell = new GridCell(schemaName); row.Add(cell);
// grid.AddRow(row);
// }
// if (grid.RowsNumber > 0)
// {
// grid.SelectedRow = 0;
// }
// }
// }
/// <summary>
/// sends to server changes related to schema ownership
/// </summary>
@@ -805,9 +470,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
// }
// }
#endregion
#endregion
#region Membership - general operations with ...
#region Membership - general operations with ...
System.Collections.Specialized.HybridDictionary dictMembership = null;
/// <summary>
@@ -823,20 +488,20 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
Enumerator en = new Enumerator();
Request req = new Request();
req.Fields = new String [] {AppRoleGeneral.memberNameField, AppRoleGeneral.memberUrnField};
req.Fields = new String[] { AppRoleGeneral.memberNameField, AppRoleGeneral.memberUrnField };
req.Urn = "Server/Database[@Name='" + Urn.EscapeString(this.databaseName) + "']/ApplicationRole[@Name='" + Urn.EscapeString(this.approleName) + "']/Member";
try
{
DataTable dt = en.Process(serverConnection,req);
System.Diagnostics.Debug.Assert(dt!=null, "No results returned from membership query");
DataTable dt = en.Process(serverConnection, req);
System.Diagnostics.Debug.Assert(dt != null, "No results returned from membership query");
foreach (DataRow dr in dt.Rows)
{
string name = Convert.ToString(dr[AppRoleGeneral.memberNameField],System.Globalization.CultureInfo.InvariantCulture);
string urn = Convert.ToString(dr[AppRoleGeneral.memberUrnField],System.Globalization.CultureInfo.InvariantCulture);
string name = Convert.ToString(dr[AppRoleGeneral.memberNameField], System.Globalization.CultureInfo.InvariantCulture);
string urn = Convert.ToString(dr[AppRoleGeneral.memberUrnField], System.Globalization.CultureInfo.InvariantCulture);
dictMembership.Add(name,urn);
dictMembership.Add(name, urn);
}
}
catch (Exception e)
@@ -922,7 +587,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
if (IsPropertiesMode == true)
{
// members to add
for (int i=0; i<1; ++i)
for (int i = 0; i < 1; ++i)
{
string name = "grid.GetCellInfo(i, colMembershipRoleMembers).CellData.ToString()";
bool nameExistedInitially = dictMembership.Contains(name);
@@ -944,7 +609,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
else
{
// add only
for (int i=0; i<1; ++i)
for (int i = 0; i < 1; ++i)
{
string name = "grid.GetCellInfo(i, colMembershipRoleMembers).CellData.ToString()";
// need SMO for: role.Members.Add();
@@ -973,210 +638,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
return false;
}
// private void gridRoleMembership_SelectionChanged(object sender, Microsoft.SqlServer.Management.UI.Grid.SelectionChangedEventArgs args)
// {
// EnableDisableControls();
// }
// private void buttonAdd_Click(object sender, System.EventArgs e)
// {
// DlgGridControl grid = this.gridRoleMembership;
// using (SqlObjectSearch dlg = new SqlObjectSearch(this.Font,
// iconSearchUsers,
// this.HelpProvider,
// AppRoleSR.SearchUsers,
// this.DataContainer.ConnectionInfo,
// this.databaseName,
// new SearchableObjectTypeCollection(SearchableObjectType.User),
// new SearchableObjectTypeCollection(SearchableObjectType.User)))
// {
// DialogResult dr = dlg.ShowDialog(this.FindForm());
// if (dr == DialogResult.OK)
// {
// foreach (SearchableObject principal in dlg.SearchResults)
// {
// grid = this.gridRoleMembership;
// GridCellCollection row = new GridCellCollection();
// GridCell cell = null;
// string name = principal.Name;
// cell = new GridCell(bitmapMember); row.Add(cell); // compute type based on urn
// cell = new GridCell(name); row.Add(cell);
// // row.Tag = urn == de.Value.ToString();
// grid.AddRow(row);
// }
// if (grid.RowsNumber > 0)
// {
// grid.SelectedRow = grid.RowsNumber-1;
// }
// }
// }
// }
// private void buttonRemove_Click(object sender, System.EventArgs e)
// {
// DlgGridControl grid = this.gridRoleMembership;
// int rowNo = grid.SelectedRow;
// System.Diagnostics.Debug.Assert(rowNo >= 0, "Invalid selected row");
// if (rowNo >= 0)
// {
// grid.DeleteRow(rowNo);
// }
// }
#endregion
// #region Bitmaps and Icons
// private Bitmap bitmapMember = null;
// private Icon iconSearchUsers = null;
// private Icon iconSchema = null;
// /// <summary>
// /// initialize bitmaps used for membership grid
// /// </summary>
// private void InitializeBitmapAndIcons()
// {
// CUtils utils = new CUtils();
// bitmapMember = utils.LoadIcon("member.ico").ToBitmap();
// iconSearchUsers = utils.LoadIcon("search_users_roles.ico");
// iconSchema = utils.LoadIcon("database_schema.ico");
// }
// #endregion
// #region General Grid operations - helpers
// /// <summary>
// /// gets status of checkbox
// /// </summary>
// /// <param name="grid"></param>
// /// <param name="rowno"></param>
// /// <param name="colno"></param>
// /// <returns></returns>
// bool IsEmbeededCheckboxChecked(DlgGridControl grid, int rowno, int colno)
// {
// // get the storage for the cell
// GridCell cell = grid.GetCellInfo(rowno, colno);
// GridCheckBoxState state = (GridCheckBoxState) cell.CellData;
// return(state == GridCheckBoxState.Checked);
// }
// /// <summary>
// /// flips on/off checkboxes from grid
// /// </summary>
// /// <param name="rowsno"></param>
// /// <param name="colno"></param>
// void FlipCheckbox(DlgGridControl grid, int rowno, int colno)
// {
// // get the storage for the cell
// GridCell cell = grid.GetCellInfo(rowno, colno);
// GridCheckBoxState state = (GridCheckBoxState) cell.CellData;
// // explicitly invert the cell state
// switch (state)
// {
// case GridCheckBoxState.Checked:
// cell.CellData = GridCheckBoxState.Unchecked;
// break;
// case GridCheckBoxState.Unchecked:
// cell.CellData = GridCheckBoxState.Checked;
// break;
// case GridCheckBoxState.Indeterminate:
// // do nothing if Indeterminate - this means that entry is checked and r/o (e.g. schemas already owned)
// break;
// case GridCheckBoxState.None:
// break;
// default:
// System.Diagnostics.Debug.Assert(false,"unknown checkbox state");
// break;
// }
// }
// #endregion
// #region Non-Grid related Events
// private void textBoxRoleName_TextChanged(object sender, System.EventArgs e)
// {
// EnableDisableControls();
// }
// bool passwordChanged = false;
// private void textBoxPasword_TextChanged(object sender, System.EventArgs e)
// {
// passwordChanged = true;
// EnableDisableControls();
// }
// private void textBoxConfirmPassword_TextChanged(object sender, System.EventArgs e)
// {
// passwordChanged = true;
// EnableDisableControls();
// }
// #endregion
// #region ISupportValidation Members
// bool ISupportValidation.Validate()
// {
// if (this.textBoxRoleName.Text.Trim().Length == 0)
// {
// System.Exception e = new System.Exception(AppRoleSR.ErrorApplicationRoleNameMustBeSpecified);
// this.DisplayExceptionMessage(e);
// return false;
// }
// if (this.textBoxPasword.Text.Trim().Length == 0)
// {
// System.Exception e = new System.Exception(AppRoleSR.ErrorPasswordIsBlank);
// this.DisplayExceptionMessage(e);
// return false;
// }
// if (this.textBoxPasword.Text != this.textBoxConfirmPassword.Text)
// {
// System.Exception e = new System.Exception(AppRoleSR.ErrorPasswordMismatch);
// this.DisplayExceptionMessage(e);
// return false;
// }
// return true;
// }
// #endregion
// private void buttonBrowseSchema_Click(object sender, System.EventArgs e)
// {
// //
// // pop up object picker
// //
// using (SqlObjectSearch dlg = new SqlObjectSearch(this.Font,
// this.iconSchema,
// this.HelpProvider,
// AppRoleSR.BrowseSchemaTitle,
// this.DataContainer.ConnectionInfo,
// this.databaseName,
// new SearchableObjectTypeCollection(SearchableObjectType.Schema),
// new SearchableObjectTypeCollection(SearchableObjectType.Schema)))
// {
// if (DialogResult.OK == dlg.ShowDialog(this.FindForm()))
// {
// this.textBoxDefaultSchema.Text = dlg.SearchResults[0].Name;
// }
// }
// }
#endregion
}
}

View File

@@ -23,10 +23,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
/// </summary>
internal class DatabaseRoleGeneral
{
#region Members
private IServiceProvider serviceProvider = null;
#region Members
/// <summary>
/// data container member that contains data specific information like
/// connection infor, SMO server object or an AMO server object as well
@@ -39,39 +36,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
//property by the initialization code
private ServerConnection serverConnection;
#endregion
/// <summary>
/// execution mode by default for now is success
/// </summary>
private ExecutionMode m_executionMode = ExecutionMode.Success;
/// <summary>
/// should UI be enabled?
/// </summary>
private bool executeEnabled = true;
/// <summary>
/// should script buttons be enabled?
/// </summary>
private bool scriptEnabled = true;
/// <summary>
/// F1 keyword to be passed to books on-line
/// </summary>
private string helpF1Keyword = null;
private RunType runType;
//if derived class tries to call a protected method that relies on service provider,
//and the service provider hasn't been set yet, we will cache the values and will
//propagate them when we get the provider set
private System.Drawing.Icon cachedIcon = null;
private string cachedCaption = null;
//whether or not try to auto resize grid columns inside OnLoad method
private bool attemtGridAutoResize = true;
#endregion
#region Trace support
#region Trace support
private const string componentName = "DatabaseRoleGeneral";
public string ComponentName
@@ -81,7 +48,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
return componentName;
}
}
#endregion
#endregion
private class SchemaOwnership
{
@@ -114,15 +81,15 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
}
#region Constants - urn fields, etc...
#region Constants - urn fields, etc...
private const string ownerField = "Owner";
private const string schemaOwnerField = "Owner";
private const string schemaNameField = "Name";
private const string memberNameField = "Name";
private const string memberUrnField = "Urn";
#endregion
#endregion
#region Constants - grid columns positions, etc...
#region Constants - grid columns positions, etc...
private const int colSchemasChecked = 0;
private const int colSchemasOwnedSchemas = 1;
@@ -131,40 +98,39 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
private const int sizeCheckboxColumn = 20;
private const int sizeBitmapColumn = 20;
#endregion
#endregion
#region Non-UI variables
#region Non-UI variables
private System.Xml.XmlDocument document = null;
private bool panelInitialized = false;
// info extracted from context
private string serverName;
private string databaseName;
private string dbroleName;
private string dbroleUrn;
private string serverName;
private string databaseName;
private string dbroleName;
private string dbroleUrn;
// initial values loaded from server
private string initialOwner;
private string initialOwner;
private string ownerName = String.Empty;
private string roleName = String.Empty;
private HybridDictionary schemaOwnership = null;
private HybridDictionary roleMembers = null;
private string ownerName = String.Empty;
private string roleName = String.Empty;
private HybridDictionary schemaOwnership = null;
private HybridDictionary roleMembers = null;
#endregion
#endregion
#region Properties: CreateNew/Properties mode
#region Properties: CreateNew/Properties mode
private bool IsPropertiesMode
{
get
{
return(dbroleName!=null) && (dbroleName.Trim().Length != 0);
return (dbroleName != null) && (dbroleName.Trim().Length != 0);
}
}
#endregion
#endregion
#region Constructors / Dispose
#region Constructors / Dispose
public DatabaseRoleGeneral()
{
// This call is required by the Windows.Forms Form Designer.
@@ -186,14 +152,14 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
}
}
#endregion
#endregion
#region Implementation: LoadData(), InitProp(), SendDataToServer()
#region Implementation: LoadData(), InitProp(), SendDataToServer()
/// <summary>
/// LoadData
///
///
/// loads connection parameters from an xml
/// </summary>
/// <param name="doc"></param>
@@ -201,32 +167,32 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
{
// STrace.Params(ComponentName, "LoadData", "XmlDocument doc=\"{0}\"", doc.OuterXml);
STParameters param;
bool bStatus;
STParameters param;
bool bStatus;
param = new STParameters();
param = new STParameters();
param.SetDocument(doc);
bStatus = param.GetParam("servername", ref this.serverName);
bStatus = param.GetParam("database", ref this.databaseName);
bStatus = param.GetParam("servername", ref this.serverName);
bStatus = param.GetParam("database", ref this.databaseName);
bStatus = param.GetParam("role", ref this.dbroleName);
bStatus = param.GetParam("urn", ref this.dbroleUrn);
bStatus = param.GetParam("role", ref this.dbroleName);
bStatus = param.GetParam("urn", ref this.dbroleUrn);
}
/// <summary>
/// InitProp
///
///
/// talks with enumerator an retrievives info
/// </summary>
private void InitProp()
{
// STrace.Params(ComponentName, "InitProp", "", null);
System.Diagnostics.Debug.Assert(this.serverName!=null);
System.Diagnostics.Debug.Assert((this.databaseName!=null) && (this.databaseName.Trim().Length!=0));
System.Diagnostics.Debug.Assert(this.serverName != null);
System.Diagnostics.Debug.Assert((this.databaseName != null) && (this.databaseName.Trim().Length != 0));
// InitializeSchemasGridColumns();
@@ -247,18 +213,18 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
if (this.IsPropertiesMode == true)
{
// initialize from enumerator in properties mode
System.Diagnostics.Debug.Assert(this.dbroleName!=null);
System.Diagnostics.Debug.Assert(this.dbroleName.Trim().Length !=0);
System.Diagnostics.Debug.Assert(this.dbroleUrn!=null);
System.Diagnostics.Debug.Assert(this.dbroleName != null);
System.Diagnostics.Debug.Assert(this.dbroleName.Trim().Length != 0);
System.Diagnostics.Debug.Assert(this.dbroleUrn != null);
System.Diagnostics.Debug.Assert(this.dbroleUrn.Trim().Length != 0);
// this.textBoxDbRoleName.Text = this.dbroleName;
Enumerator en = new Enumerator();
Request req = new Request();
req.Fields = new String [] {DatabaseRoleGeneral.ownerField};
req.Fields = new String[] { DatabaseRoleGeneral.ownerField };
if ((this.dbroleUrn!=null) && (this.dbroleUrn.Trim().Length != 0))
if ((this.dbroleUrn != null) && (this.dbroleUrn.Trim().Length != 0))
{
req.Urn = this.dbroleUrn;
}
@@ -267,17 +233,17 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
req.Urn = "Server/Database[@Name='" + Urn.EscapeString(this.databaseName) + "']/Role[@Name='" + Urn.EscapeString(this.dbroleName) + "]";
}
DataTable dt = en.Process(serverConnection,req);
System.Diagnostics.Debug.Assert(dt!=null);
System.Diagnostics.Debug.Assert(dt.Rows.Count==1);
DataTable dt = en.Process(serverConnection, req);
System.Diagnostics.Debug.Assert(dt != null);
System.Diagnostics.Debug.Assert(dt.Rows.Count == 1);
if (dt.Rows.Count==0)
if (dt.Rows.Count == 0)
{
throw new Exception("DatabaseRoleSR.ErrorDbRoleNotFound");
}
DataRow dr = dt.Rows[0];
this.initialOwner = Convert.ToString(dr[DatabaseRoleGeneral.ownerField],System.Globalization.CultureInfo.InvariantCulture);
this.initialOwner = Convert.ToString(dr[DatabaseRoleGeneral.ownerField], System.Globalization.CultureInfo.InvariantCulture);
// this.textBoxOwner.Text = this.initialOwner;
}
else
@@ -302,7 +268,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
/// <summary>
/// SendDataToServer
///
///
/// here we talk with server via smo and do the actual data changing
/// </summary>
private void SendDataToServer()
@@ -344,206 +310,206 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
SendToServerSchemaOwnershipChanges(database, role);
SendToServerMembershipChanges(database, role);
this.dataContainer.ObjectName = role.Name;
this.dataContainer.ObjectName = role.Name;
this.dataContainer.SqlDialogSubject = role; // needed by extended properties page
}
#endregion
#endregion
// #region Update UI enable/disable controls
// private void EnableDisableControls()
// {
// if (this.DataContainer.Server.Information.Version.Major<9)
// {
// panelSchema.Enabled = false;
// }
// #region Update UI enable/disable controls
// private void EnableDisableControls()
// {
// if (this.DataContainer.Server.Information.Version.Major<9)
// {
// panelSchema.Enabled = false;
// }
// if (this.IsPropertiesMode == true)
// {
// this.textBoxDbRoleName.Enabled = false;
// if (this.IsPropertiesMode == true)
// {
// this.textBoxDbRoleName.Enabled = false;
// this.AllUIEnabled = true;
// }
// else
// {
// this.textBoxDbRoleName.Enabled = true;
// this.AllUIEnabled = true;
// }
// else
// {
// this.textBoxDbRoleName.Enabled = true;
// this.AllUIEnabled = (this.textBoxDbRoleName.Text.Trim().Length!=0);
// }
// this.AllUIEnabled = (this.textBoxDbRoleName.Text.Trim().Length!=0);
// }
// buttonRemove.Enabled = (gridRoleMembership.SelectedRow>=0);
// }
// #endregion
// buttonRemove.Enabled = (gridRoleMembership.SelectedRow>=0);
// }
// #endregion
// #region ISupportValidation Members
// #region ISupportValidation Members
// bool ISupportValidation.Validate()
// {
// if (IsPropertiesMode == false)
// {
// if (this.textBoxDbRoleName.Text.Trim().Length==0)
// {
// System.Exception e = new System.Exception(DatabaseRoleSR.Error_SpecifyAName);
// this.DisplayExceptionMessage(e);
// bool ISupportValidation.Validate()
// {
// if (IsPropertiesMode == false)
// {
// if (this.textBoxDbRoleName.Text.Trim().Length==0)
// {
// System.Exception e = new System.Exception(DatabaseRoleSR.Error_SpecifyAName);
// this.DisplayExceptionMessage(e);
// return false;
// }
// }
// return false;
// }
// }
// return true;
// }
// return true;
// }
// #endregion
// #endregion
// #region Component Designer generated code
// /// <summary>
// /// Required method for Designer support - do not modify
// /// the contents of this method with the code editor.
// /// </summary>
// private void InitializeComponent()
// {
// System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DatabaseRoleGeneral));
// this.panelEntireUserControl = new System.Windows.Forms.Panel();
// this.panelSchema = new System.Windows.Forms.Panel();
// this.gridSchemasOwned = new Microsoft.SqlServer.Management.SqlManagerUI.SqlManagerUIDlgGrid();
// this.labelSchemasOwnedByDbRole = new System.Windows.Forms.Label();
// this.panelMembership = new System.Windows.Forms.Panel();
// this.buttonRemove = new System.Windows.Forms.Button();
// this.buttonAdd = new System.Windows.Forms.Button();
// this.gridRoleMembership = new Microsoft.SqlServer.Management.SqlManagerUI.SqlManagerUIDlgGrid();
// this.labelMembersOfDbRole = new System.Windows.Forms.Label();
// this.panelDbRoleGeneralInfo = new System.Windows.Forms.Panel();
// this.buttonSearchOwner = new System.Windows.Forms.Button();
// this.textBoxOwner = new System.Windows.Forms.TextBox();
// this.labelDbRoleOwner = new System.Windows.Forms.Label();
// this.textBoxDbRoleName = new System.Windows.Forms.TextBox();
// this.labelDbRoleName = new System.Windows.Forms.Label();
// this.panelEntireUserControl.SuspendLayout();
// this.panelSchema.SuspendLayout();
// ((System.ComponentModel.ISupportInitialize)(this.gridSchemasOwned)).BeginInit();
// this.panelMembership.SuspendLayout();
// ((System.ComponentModel.ISupportInitialize)(this.gridRoleMembership)).BeginInit();
// this.panelDbRoleGeneralInfo.SuspendLayout();
// this.SuspendLayout();
// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
// this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
// //
// // panelEntireUserControl
// //
// this.panelEntireUserControl.Controls.Add(this.panelSchema);
// this.panelEntireUserControl.Controls.Add(this.panelMembership);
// this.panelEntireUserControl.Controls.Add(this.panelDbRoleGeneralInfo);
// resources.ApplyResources(this.panelEntireUserControl, "panelEntireUserControl");
// this.panelEntireUserControl.Name = "panelEntireUserControl";
// //
// // panelSchema
// //
// resources.ApplyResources(this.panelSchema, "panelSchema");
// this.panelSchema.Controls.Add(this.gridSchemasOwned);
// this.panelSchema.Controls.Add(this.labelSchemasOwnedByDbRole);
// this.panelSchema.Name = "panelSchema";
// //
// // gridSchemasOwned
// //
// resources.ApplyResources(this.gridSchemasOwned, "gridSchemasOwned");
// this.gridSchemasOwned.BackColor = System.Drawing.SystemColors.Window;
// this.gridSchemasOwned.ForceEnabled = false;
// this.gridSchemasOwned.Name = "gridSchemasOwned";
// this.gridSchemasOwned.MouseButtonClicked += new Microsoft.SqlServer.Management.UI.Grid.MouseButtonClickedEventHandler(this.gridSchemasOwned_MouseButtonClicked);
// //
// // labelSchemasOwnedByDbRole
// //
// resources.ApplyResources(this.labelSchemasOwnedByDbRole, "labelSchemasOwnedByDbRole");
// this.labelSchemasOwnedByDbRole.Name = "labelSchemasOwnedByDbRole";
// //
// // panelMembership
// //
// resources.ApplyResources(this.panelMembership, "panelMembership");
// this.panelMembership.Controls.Add(this.buttonRemove);
// this.panelMembership.Controls.Add(this.buttonAdd);
// this.panelMembership.Controls.Add(this.gridRoleMembership);
// this.panelMembership.Controls.Add(this.labelMembersOfDbRole);
// this.panelMembership.Name = "panelMembership";
// //
// // buttonRemove
// //
// resources.ApplyResources(this.buttonRemove, "buttonRemove");
// this.buttonRemove.Name = "buttonRemove";
// this.buttonRemove.Click += new System.EventHandler(this.buttonRemove_Click);
// //
// // buttonAdd
// //
// resources.ApplyResources(this.buttonAdd, "buttonAdd");
// this.buttonAdd.Name = "buttonAdd";
// this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
// //
// // gridRoleMembership
// //
// resources.ApplyResources(this.gridRoleMembership, "gridRoleMembership");
// this.gridRoleMembership.BackColor = System.Drawing.SystemColors.Window;
// this.gridRoleMembership.ForceEnabled = false;
// this.gridRoleMembership.Name = "gridRoleMembership";
// this.gridRoleMembership.SelectionChanged += new Microsoft.SqlServer.Management.UI.Grid.SelectionChangedEventHandler(this.gridRoleMembership_SelectionChanged);
// //
// // labelMembersOfDbRole
// //
// resources.ApplyResources(this.labelMembersOfDbRole, "labelMembersOfDbRole");
// this.labelMembersOfDbRole.Name = "labelMembersOfDbRole";
// //
// // panelDbRoleGeneralInfo
// //
// resources.ApplyResources(this.panelDbRoleGeneralInfo, "panelDbRoleGeneralInfo");
// this.panelDbRoleGeneralInfo.Controls.Add(this.buttonSearchOwner);
// this.panelDbRoleGeneralInfo.Controls.Add(this.textBoxOwner);
// this.panelDbRoleGeneralInfo.Controls.Add(this.labelDbRoleOwner);
// this.panelDbRoleGeneralInfo.Controls.Add(this.textBoxDbRoleName);
// this.panelDbRoleGeneralInfo.Controls.Add(this.labelDbRoleName);
// this.panelDbRoleGeneralInfo.Name = "panelDbRoleGeneralInfo";
// //
// // buttonSearchOwner
// //
// resources.ApplyResources(this.buttonSearchOwner, "buttonSearchOwner");
// this.buttonSearchOwner.Name = "buttonSearchOwner";
// this.buttonSearchOwner.Click += new System.EventHandler(this.buttonSearchOwner_Click);
// //
// // textBoxOwner
// //
// resources.ApplyResources(this.textBoxOwner, "textBoxOwner");
// this.textBoxOwner.Name = "textBoxOwner";
// //
// // labelDbRoleOwner
// //
// resources.ApplyResources(this.labelDbRoleOwner, "labelDbRoleOwner");
// this.labelDbRoleOwner.Name = "labelDbRoleOwner";
// //
// // textBoxDbRoleName
// //
// resources.ApplyResources(this.textBoxDbRoleName, "textBoxDbRoleName");
// this.textBoxDbRoleName.Name = "textBoxDbRoleName";
// //
// // labelDbRoleName
// //
// resources.ApplyResources(this.labelDbRoleName, "labelDbRoleName");
// this.labelDbRoleName.Name = "labelDbRoleName";
// //
// // DatabaseRoleGeneral
// //
// this.Controls.Add(this.panelEntireUserControl);
// this.Name = "DatabaseRoleGeneral";
// resources.ApplyResources(this, "$this");
// this.panelEntireUserControl.ResumeLayout(false);
// this.panelSchema.ResumeLayout(false);
// ((System.ComponentModel.ISupportInitialize)(this.gridSchemasOwned)).EndInit();
// this.panelMembership.ResumeLayout(false);
// ((System.ComponentModel.ISupportInitialize)(this.gridRoleMembership)).EndInit();
// this.panelDbRoleGeneralInfo.ResumeLayout(false);
// this.panelDbRoleGeneralInfo.PerformLayout();
// this.ResumeLayout(false);
// #region Component Designer generated code
// /// <summary>
// /// Required method for Designer support - do not modify
// /// the contents of this method with the code editor.
// /// </summary>
// private void InitializeComponent()
// {
// System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DatabaseRoleGeneral));
// this.panelEntireUserControl = new System.Windows.Forms.Panel();
// this.panelSchema = new System.Windows.Forms.Panel();
// this.gridSchemasOwned = new Microsoft.SqlServer.Management.SqlManagerUI.SqlManagerUIDlgGrid();
// this.labelSchemasOwnedByDbRole = new System.Windows.Forms.Label();
// this.panelMembership = new System.Windows.Forms.Panel();
// this.buttonRemove = new System.Windows.Forms.Button();
// this.buttonAdd = new System.Windows.Forms.Button();
// this.gridRoleMembership = new Microsoft.SqlServer.Management.SqlManagerUI.SqlManagerUIDlgGrid();
// this.labelMembersOfDbRole = new System.Windows.Forms.Label();
// this.panelDbRoleGeneralInfo = new System.Windows.Forms.Panel();
// this.buttonSearchOwner = new System.Windows.Forms.Button();
// this.textBoxOwner = new System.Windows.Forms.TextBox();
// this.labelDbRoleOwner = new System.Windows.Forms.Label();
// this.textBoxDbRoleName = new System.Windows.Forms.TextBox();
// this.labelDbRoleName = new System.Windows.Forms.Label();
// this.panelEntireUserControl.SuspendLayout();
// this.panelSchema.SuspendLayout();
// ((System.ComponentModel.ISupportInitialize)(this.gridSchemasOwned)).BeginInit();
// this.panelMembership.SuspendLayout();
// ((System.ComponentModel.ISupportInitialize)(this.gridRoleMembership)).BeginInit();
// this.panelDbRoleGeneralInfo.SuspendLayout();
// this.SuspendLayout();
// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
// this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
// //
// // panelEntireUserControl
// //
// this.panelEntireUserControl.Controls.Add(this.panelSchema);
// this.panelEntireUserControl.Controls.Add(this.panelMembership);
// this.panelEntireUserControl.Controls.Add(this.panelDbRoleGeneralInfo);
// resources.ApplyResources(this.panelEntireUserControl, "panelEntireUserControl");
// this.panelEntireUserControl.Name = "panelEntireUserControl";
// //
// // panelSchema
// //
// resources.ApplyResources(this.panelSchema, "panelSchema");
// this.panelSchema.Controls.Add(this.gridSchemasOwned);
// this.panelSchema.Controls.Add(this.labelSchemasOwnedByDbRole);
// this.panelSchema.Name = "panelSchema";
// //
// // gridSchemasOwned
// //
// resources.ApplyResources(this.gridSchemasOwned, "gridSchemasOwned");
// this.gridSchemasOwned.BackColor = System.Drawing.SystemColors.Window;
// this.gridSchemasOwned.ForceEnabled = false;
// this.gridSchemasOwned.Name = "gridSchemasOwned";
// this.gridSchemasOwned.MouseButtonClicked += new Microsoft.SqlServer.Management.UI.Grid.MouseButtonClickedEventHandler(this.gridSchemasOwned_MouseButtonClicked);
// //
// // labelSchemasOwnedByDbRole
// //
// resources.ApplyResources(this.labelSchemasOwnedByDbRole, "labelSchemasOwnedByDbRole");
// this.labelSchemasOwnedByDbRole.Name = "labelSchemasOwnedByDbRole";
// //
// // panelMembership
// //
// resources.ApplyResources(this.panelMembership, "panelMembership");
// this.panelMembership.Controls.Add(this.buttonRemove);
// this.panelMembership.Controls.Add(this.buttonAdd);
// this.panelMembership.Controls.Add(this.gridRoleMembership);
// this.panelMembership.Controls.Add(this.labelMembersOfDbRole);
// this.panelMembership.Name = "panelMembership";
// //
// // buttonRemove
// //
// resources.ApplyResources(this.buttonRemove, "buttonRemove");
// this.buttonRemove.Name = "buttonRemove";
// this.buttonRemove.Click += new System.EventHandler(this.buttonRemove_Click);
// //
// // buttonAdd
// //
// resources.ApplyResources(this.buttonAdd, "buttonAdd");
// this.buttonAdd.Name = "buttonAdd";
// this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
// //
// // gridRoleMembership
// //
// resources.ApplyResources(this.gridRoleMembership, "gridRoleMembership");
// this.gridRoleMembership.BackColor = System.Drawing.SystemColors.Window;
// this.gridRoleMembership.ForceEnabled = false;
// this.gridRoleMembership.Name = "gridRoleMembership";
// this.gridRoleMembership.SelectionChanged += new Microsoft.SqlServer.Management.UI.Grid.SelectionChangedEventHandler(this.gridRoleMembership_SelectionChanged);
// //
// // labelMembersOfDbRole
// //
// resources.ApplyResources(this.labelMembersOfDbRole, "labelMembersOfDbRole");
// this.labelMembersOfDbRole.Name = "labelMembersOfDbRole";
// //
// // panelDbRoleGeneralInfo
// //
// resources.ApplyResources(this.panelDbRoleGeneralInfo, "panelDbRoleGeneralInfo");
// this.panelDbRoleGeneralInfo.Controls.Add(this.buttonSearchOwner);
// this.panelDbRoleGeneralInfo.Controls.Add(this.textBoxOwner);
// this.panelDbRoleGeneralInfo.Controls.Add(this.labelDbRoleOwner);
// this.panelDbRoleGeneralInfo.Controls.Add(this.textBoxDbRoleName);
// this.panelDbRoleGeneralInfo.Controls.Add(this.labelDbRoleName);
// this.panelDbRoleGeneralInfo.Name = "panelDbRoleGeneralInfo";
// //
// // buttonSearchOwner
// //
// resources.ApplyResources(this.buttonSearchOwner, "buttonSearchOwner");
// this.buttonSearchOwner.Name = "buttonSearchOwner";
// this.buttonSearchOwner.Click += new System.EventHandler(this.buttonSearchOwner_Click);
// //
// // textBoxOwner
// //
// resources.ApplyResources(this.textBoxOwner, "textBoxOwner");
// this.textBoxOwner.Name = "textBoxOwner";
// //
// // labelDbRoleOwner
// //
// resources.ApplyResources(this.labelDbRoleOwner, "labelDbRoleOwner");
// this.labelDbRoleOwner.Name = "labelDbRoleOwner";
// //
// // textBoxDbRoleName
// //
// resources.ApplyResources(this.textBoxDbRoleName, "textBoxDbRoleName");
// this.textBoxDbRoleName.Name = "textBoxDbRoleName";
// //
// // labelDbRoleName
// //
// resources.ApplyResources(this.labelDbRoleName, "labelDbRoleName");
// this.labelDbRoleName.Name = "labelDbRoleName";
// //
// // DatabaseRoleGeneral
// //
// this.Controls.Add(this.panelEntireUserControl);
// this.Name = "DatabaseRoleGeneral";
// resources.ApplyResources(this, "$this");
// this.panelEntireUserControl.ResumeLayout(false);
// this.panelSchema.ResumeLayout(false);
// ((System.ComponentModel.ISupportInitialize)(this.gridSchemasOwned)).EndInit();
// this.panelMembership.ResumeLayout(false);
// ((System.ComponentModel.ISupportInitialize)(this.gridRoleMembership)).EndInit();
// this.panelDbRoleGeneralInfo.ResumeLayout(false);
// this.panelDbRoleGeneralInfo.PerformLayout();
// this.ResumeLayout(false);
// }
// #endregion
// }
// #endregion
#region Schemas - general operations with ...
#region Schemas - general operations with ...
/// <summary>
/// loads initial schemas from server together with information about the schema owner
/// </summary>
@@ -553,18 +519,18 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
Enumerator en = new Enumerator();
Request req = new Request();
req.Fields = new String [] {DatabaseRoleGeneral.schemaNameField, DatabaseRoleGeneral.schemaOwnerField};
req.Fields = new String[] { DatabaseRoleGeneral.schemaNameField, DatabaseRoleGeneral.schemaOwnerField };
req.Urn = "Server/Database[@Name='" + Urn.EscapeString(this.databaseName) + "']/Schema";
DataTable dt = en.Process(serverConnection,req);
DataTable dt = en.Process(serverConnection, req);
// STrace.Assert((dt != null) && (0 < dt.Rows.Count), "enumerator did not return schemas");
// STrace.Assert(!this.IsPropertiesMode || (this.dbroleName.Length != 0), "role name is not known");
foreach (DataRow dr in dt.Rows)
{
string schemaName = Convert.ToString(dr[DatabaseRoleGeneral.schemaNameField],System.Globalization.CultureInfo.InvariantCulture);
string schemaOwner = Convert.ToString(dr[DatabaseRoleGeneral.schemaOwnerField],System.Globalization.CultureInfo.InvariantCulture);
bool roleOwnsSchema =
string schemaName = Convert.ToString(dr[DatabaseRoleGeneral.schemaNameField], System.Globalization.CultureInfo.InvariantCulture);
string schemaOwner = Convert.ToString(dr[DatabaseRoleGeneral.schemaOwnerField], System.Globalization.CultureInfo.InvariantCulture);
bool roleOwnsSchema =
this.IsPropertiesMode &&
(0 == String.Compare(this.dbroleName, schemaOwner, StringComparison.Ordinal));
@@ -632,10 +598,10 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
// // grid is filled either
// // a) disabled-checked checkboxes: Indeterminate - if already owning schema - we cannot renounce ownership
// // b) enabled-unchecked checkboxes: Unchecked - user can check / uncheck them and we read final state
// cell = new GridCell(roleCurrentlyOwnsSchema ? GridCheckBoxState.Indeterminate : GridCheckBoxState.Unchecked);
// cell = new GridCell(roleCurrentlyOwnsSchema ? GridCheckBoxState.Indeterminate : GridCheckBoxState.Unchecked);
// row.Add(cell);
// cell = new GridCell(schemaName);
// cell = new GridCell(schemaName);
// row.Add(cell);
// grid.AddRow(row);
@@ -661,9 +627,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
enumerator.Reset();
while (enumerator.MoveNext())
{
DictionaryEntry de = enumerator.Entry;
string schemaName = de.Key.ToString();
SchemaOwnership ownership = (SchemaOwnership)de.Value;
DictionaryEntry de = enumerator.Entry;
string schemaName = de.Key.ToString();
SchemaOwnership ownership = (SchemaOwnership)de.Value;
// If we are creating a new role, then no schema will have been initially owned by this role.
// If we are modifying an existing role, we can only take ownership of roles. (Ownership can't
@@ -692,9 +658,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
// }
// }
#endregion
#endregion
#region Membership - general operations with ...
#region Membership - general operations with ...
/// <summary>
/// loads from server initial membership information
@@ -705,15 +671,15 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
if (this.IsPropertiesMode)
{
Enumerator enumerator = new Enumerator();
Urn urn = String.Format(System.Globalization.CultureInfo.InvariantCulture,
Enumerator enumerator = new Enumerator();
Urn urn = String.Format(System.Globalization.CultureInfo.InvariantCulture,
"Server/Database[@Name='{0}']/Role[@Name='{1}']/Member",
Urn.EscapeString(this.databaseName),
Urn.EscapeString(this.dbroleName));
string[] fields = new string[] { DatabaseRoleGeneral.memberNameField};
OrderBy[] orderBy = new OrderBy[] { new OrderBy(DatabaseRoleGeneral.memberNameField, OrderBy.Direction.Asc)};
Request request = new Request(urn, fields, orderBy);
DataTable dt = enumerator.Process(this.serverConnection, request);
string[] fields = new string[] { DatabaseRoleGeneral.memberNameField };
OrderBy[] orderBy = new OrderBy[] { new OrderBy(DatabaseRoleGeneral.memberNameField, OrderBy.Direction.Asc) };
Request request = new Request(urn, fields, orderBy);
DataTable dt = enumerator.Process(this.serverConnection, request);
foreach (DataRow dr in dt.Rows)
{
@@ -784,10 +750,10 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
// GridCellCollection row = new GridCellCollection();
// GridCell cell = null;
// cell = new GridCell(bitmapMember);
// cell = new GridCell(bitmapMember);
// row.Add(cell);
// cell = new GridCell(memberName);
// cell = new GridCell(memberName);
// row.Add(cell);
// grid.AddRow(row);
@@ -812,9 +778,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
while (enumerator.MoveNext())
{
DictionaryEntry entry = enumerator.Entry;
string memberName = entry.Key.ToString();
RoleMembership membership = (RoleMembership) entry.Value;
DictionaryEntry entry = enumerator.Entry;
string memberName = entry.Key.ToString();
RoleMembership membership = (RoleMembership)entry.Value;
if (!membership.initiallyAMember && membership.currentlyAMember)
{
@@ -832,94 +798,94 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
// EnableDisableControls();
// }
// private void buttonAdd_Click(object sender, System.EventArgs e)
// {
// private void buttonAdd_Click(object sender, System.EventArgs e)
// {
// using (SqlObjectSearch dlg = new SqlObjectSearch(
// this.Font,
// iconSearchRolesAndUsers,
// this.HelpProvider,
// DatabaseRoleSR.Add_DialogTitle,
// this.DataContainer.ConnectionInfo,
// this.databaseName,
// new SearchableObjectTypeCollection(SearchableObjectType.User, SearchableObjectType.DatabaseRole),
// new SearchableObjectTypeCollection(SearchableObjectType.User, SearchableObjectType.DatabaseRole),
// false))
// {
// if (DialogResult.OK == dlg.ShowDialog(this.FindForm()))
// {
// bool memberAdded = false;
// using (SqlObjectSearch dlg = new SqlObjectSearch(
// this.Font,
// iconSearchRolesAndUsers,
// this.HelpProvider,
// DatabaseRoleSR.Add_DialogTitle,
// this.DataContainer.ConnectionInfo,
// this.databaseName,
// new SearchableObjectTypeCollection(SearchableObjectType.User, SearchableObjectType.DatabaseRole),
// new SearchableObjectTypeCollection(SearchableObjectType.User, SearchableObjectType.DatabaseRole),
// false))
// {
// if (DialogResult.OK == dlg.ShowDialog(this.FindForm()))
// {
// bool memberAdded = false;
// this.gridRoleMembership.BeginInit();
// this.gridRoleMembership.BeginInit();
// foreach (SearchableObject principal in dlg.SearchResults)
// {
// if (!this.roleMembers.Contains(principal.Name))
// {
// this.roleMembers[principal.Name] = new RoleMembership(false, true);
// memberAdded = true;
// }
// else
// {
// RoleMembership membership = (RoleMembership) this.roleMembers[principal.Name];
// foreach (SearchableObject principal in dlg.SearchResults)
// {
// if (!this.roleMembers.Contains(principal.Name))
// {
// this.roleMembers[principal.Name] = new RoleMembership(false, true);
// memberAdded = true;
// }
// else
// {
// RoleMembership membership = (RoleMembership) this.roleMembers[principal.Name];
// if (!membership.currentlyAMember)
// {
// membership.currentlyAMember = true;
// memberAdded = true;
// }
// }
// if (!membership.currentlyAMember)
// {
// membership.currentlyAMember = true;
// memberAdded = true;
// }
// }
// if (memberAdded)
// {
// GridCellCollection row = new GridCellCollection();
// GridCell cell = null;
// if (memberAdded)
// {
// GridCellCollection row = new GridCellCollection();
// GridCell cell = null;
// cell = new GridCell(bitmapMember);
// row.Add(cell);
// cell = new GridCell(bitmapMember);
// row.Add(cell);
// cell = new GridCell(principal.Name);
// row.Add(cell);
// cell = new GridCell(principal.Name);
// row.Add(cell);
// this.gridRoleMembership.AddRow(row);
// }
// }
// this.gridRoleMembership.AddRow(row);
// }
// }
// this.gridRoleMembership.EndInit();
// this.gridRoleMembership.EndInit();
// if (memberAdded)
// {
// this.gridRoleMembership.SelectedRow = this.gridRoleMembership.RowsNumber - 1;
// }
// }
// }
// }
// if (memberAdded)
// {
// this.gridRoleMembership.SelectedRow = this.gridRoleMembership.RowsNumber - 1;
// }
// }
// }
// }
// private void buttonRemove_Click(object sender, System.EventArgs e)
// {
// DlgGridControl grid = this.gridRoleMembership;
// private void buttonRemove_Click(object sender, System.EventArgs e)
// {
// DlgGridControl grid = this.gridRoleMembership;
// int row = this.gridRoleMembership.SelectedRow;
// STrace.Assert(0 <= row, "unexpected row number");
// int row = this.gridRoleMembership.SelectedRow;
// STrace.Assert(0 <= row, "unexpected row number");
// if (0 <= row)
// {
// string memberName = this.gridRoleMembership.GetCellInfo(row, colMembershipRoleMembers).CellData.ToString();
// RoleMembership membership = (RoleMembership) this.roleMembers[memberName];
// if (0 <= row)
// {
// string memberName = this.gridRoleMembership.GetCellInfo(row, colMembershipRoleMembers).CellData.ToString();
// RoleMembership membership = (RoleMembership) this.roleMembers[memberName];
// if (membership.initiallyAMember)
// {
// membership.currentlyAMember = false;
// }
// else
// {
// this.roleMembers.Remove(memberName);
// }
// if (membership.initiallyAMember)
// {
// membership.currentlyAMember = false;
// }
// else
// {
// this.roleMembers.Remove(memberName);
// }
// this.gridRoleMembership.DeleteRow(row);
// }
// }
#endregion
// this.gridRoleMembership.DeleteRow(row);
// }
// }
#endregion
}
}