void Connect() { try { this.Cursor = Cursors.WaitCursor; frmAdmin.Provider = System.Web.Security.Membership.Providers[cmbProviders.Text]; RoleProvider wRoleProvider = FwkMembership.GetRoleProvider(cmbProviders.Text); string cnnString = FwkMembership.GetProvider_ConnectionString(frmAdmin.Provider.Name); Fwk.DataBase.CnnString cnn = new DataBase.CnnString("", cnnString); lblServer.Text = cnn.DataSource; lblDatabase.Text = cnn.InitialCatalog; lblCnnString.Text = cnn.ToString(); if (!onInit) { DataBase.Metadata m = new DataBase.Metadata(cnn); if (m.TestConnection()) { CurrentProviderConnectedOk = true; lblConnectionStatus.Text = "Connected"; this.btnRefreshConnection.Image = global::Fwk.Security.Admin.Properties.Resources.Connection_Check; this.btnRefreshConnection.Text = "Refresh"; } else { CurrentProviderConnectedOk = false; lblConnectionStatus.Text = "Disconected"; this.btnRefreshConnection.Image = global::Fwk.Security.Admin.Properties.Resources.Connection_Warning; this.btnRefreshConnection.Text = "Try reconnect"; } } } catch (Exception ex) { CurrentProviderConnectedOk = false; lblConnectionStatus.Text = "Disconected"; this.btnRefreshConnection.Image = global::Fwk.Security.Admin.Properties.Resources.Connection_Warning; this.btnRefreshConnection.Text = "Try reconnect"; base.MessageViewInfo.Show(Fwk.Exceptions.ExceptionHelper.GetAllMessageException(ex)); } if (currontSecurityControlBase == null) { this.Cursor = Cursors.Arrow; return; } try { currontSecurityControlBase.Initialize(); } catch (Exception ex) { CurrentProviderConnectedOk = false; lblConnectionStatus.Text = "Disconected"; base.MessageViewInfo.Show(Fwk.Exceptions.ExceptionHelper.GetAllMessageException(ex)); } this.Cursor = Cursors.Arrow; }
void Connect() { try { this.Cursor = Cursors.WaitCursor; frmAdmin.Provider = Membership.Providers[cmbProviders.Text]; RoleProvider wRoleProvider = FwkMembership.GetRoleProvider(cmbProviders.Text); string cnnString = FwkMembership.GetProvider_ConnectionString(frmAdmin.Provider.Name); Fwk.DataBase.CnnString cnn = new DataBase.CnnString("", cnnString); lblServer.Text = cnn.DataSource; lblDatabase.Text = cnn.InitialCatalog; lblCnnString.Text = cnn.ToString(); if (!onInit) { DataBase.Metadata m = new DataBase.Metadata(cnn); if (m.TestConnection()) { CurrentProviderConnectedOk = true; lblConnectionStatus.Text = "Connected"; this.btnRefreshConnection.Image = global::Fwk.Security.Admin.Properties.Resources.Connection_Check; this.btnRefreshConnection.Text = "Refresh"; } else { CurrentProviderConnectedOk = false; lblConnectionStatus.Text = "Disconected"; this.btnRefreshConnection.Image = global::Fwk.Security.Admin.Properties.Resources.Connection_Warning; this.btnRefreshConnection.Text = "Try reconnect"; } } } catch (Exception ex) { CurrentProviderConnectedOk = false; lblConnectionStatus.Text = "Disconected"; this.btnRefreshConnection.Image = global::Fwk.Security.Admin.Properties.Resources.Connection_Warning; this.btnRefreshConnection.Text = "Try reconnect"; base.MessageViewInfo.Show(Fwk.Exceptions.ExceptionHelper.GetAllMessageException(ex)); } if (currontSecurityControlBase == null) { this.Cursor = Cursors.Arrow; return; } try { currontSecurityControlBase.Initialize(); } catch (Exception ex) { CurrentProviderConnectedOk = false; lblConnectionStatus.Text = "Disconected"; base.MessageViewInfo.Show(Fwk.Exceptions.ExceptionHelper.GetAllMessageException(ex)); } this.Cursor = Cursors.Arrow; }