Exemplo n.º 1
0
 private void FrmServerConnection_Load(object sender, EventArgs e)
 {
     // System.Diagnostics.Debug.WriteLine(KeyData);
     _ServerName            = Properties.Settings.Default.ServerName;
     TxtServerName.Text     = Properties.Settings.Default.ServerName;
     TxtServerUserName.Text = Properties.Settings.Default.ServeUserName;
     TxtPassword.Text       = Properties.Settings.Default.ServerPassword;
     if (!string.IsNullOrEmpty(TxtServerName.Text))
     {
         BtnConnect.PerformClick();
     }
     TxtServerName.Focus();
 }
Exemplo n.º 2
0
        void ReleaseDesignerOutlets()
        {
            if (HttpTransportTableView != null)
            {
                HttpTransportTableView.Dispose();
                HttpTransportTableView = null;
            }

            if (TxtContentLength != null)
            {
                TxtContentLength.Dispose();
                TxtContentLength = null;
            }

            if (TxtContentType != null)
            {
                TxtContentType.Dispose();
                TxtContentType = null;
            }

            if (TxtError != null)
            {
                TxtError.Dispose();
                TxtError = null;
            }

            if (TxtHttpMethod != null)
            {
                TxtHttpMethod.Dispose();
                TxtHttpMethod = null;
            }

            if (TxtReponseContentType != null)
            {
                TxtReponseContentType.Dispose();
                TxtReponseContentType = null;
            }

            if (TxtRequestData != null)
            {
                TxtRequestData.Dispose();
                TxtRequestData = null;
            }

            if (TxtRequestUri != null)
            {
                TxtRequestUri.Dispose();
                TxtRequestUri = null;
            }

            if (TxtResponseContentLength != null)
            {
                TxtResponseContentLength.Dispose();
                TxtResponseContentLength = null;
            }

            if (TxtResponseData != null)
            {
                TxtResponseData.Dispose();
                TxtResponseData = null;
            }

            if (TxtServerName != null)
            {
                TxtServerName.Dispose();
                TxtServerName = null;
            }

            if (TxtTimeTaken != null)
            {
                TxtTimeTaken.Dispose();
                TxtTimeTaken = null;
            }

            if (TxtUserAgent != null)
            {
                TxtUserAgent.Dispose();
                TxtUserAgent = null;
            }

            if (TxtTimestamp != null)
            {
                TxtTimestamp.Dispose();
                TxtTimestamp = null;
            }
        }
        private void Reset()
        {
            try
            {
                TxtDatabasename.Text = string.Empty;
                TxtServerName.Text   = string.Empty;
                TxtUsername.Text     = string.Empty;
                TxtPassword.Text     = string.Empty;

                TxtDatabasenameExternal.Text = string.Empty;
                TxtServerNameExternal.Text   = string.Empty;
                TxtUsernameExternal.Text     = string.Empty;
                TxtPasswordExternal.Text     = string.Empty;

                TxtServerName.Focus();

                // loading WCF Service URL from web.config
                Configuration config =
                    WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
                TxtServiceURL.Text = config.AppSettings.Settings["ServiceURL"].Value;

                // Getting export paths and display in boxes
                var endpoint            = new EndpointAddress(new Uri(TxtServiceURL.Text.Trim()));
                var formHandlerServices = new ConsentFormSvcClient(new BasicHttpBinding(), endpoint);

                // setting Database fields value from connection string
                try
                {
                    var sqlConnectionStringBuilder = new SqlConnectionStringBuilder(ConfigurationManager.AppSettings["ConnectionString"]);
                    TxtServerName.Text   = sqlConnectionStringBuilder.DataSource;
                    TxtDatabasename.Text = sqlConnectionStringBuilder.InitialCatalog;
                    if (!string.IsNullOrEmpty(sqlConnectionStringBuilder.UserID))
                    {
                        RdoSqlServerAuthentication.Checked = true;
                        TxtUsername.Text = sqlConnectionStringBuilder.UserID;
                        TxtPassword.Text = sqlConnectionStringBuilder.Password;
                    }
                    else
                    {
                        RdoWindowsAuthentication.Checked = true;
                    }
                }
                catch (Exception)
                {
                }

                // setting Database fields value from connection string
                try
                {
                    var sqlConnectionStringBuilder = new SqlConnectionStringBuilder(ConfigurationManager.AppSettings["BethesdaConnectionString"]);
                    TxtServerNameExternal.Text   = sqlConnectionStringBuilder.DataSource;
                    TxtDatabasenameExternal.Text = sqlConnectionStringBuilder.InitialCatalog;
                    if (!string.IsNullOrEmpty(sqlConnectionStringBuilder.UserID))
                    {
                        RdoSqlServerAuthenticationExternal.Checked = true;
                        TxtUsernameExternal.Text = sqlConnectionStringBuilder.UserID;
                        TxtPasswordExternal.Text = sqlConnectionStringBuilder.Password;
                    }
                    else
                    {
                        RdoWindowsAuthentication.Checked = true;
                    }
                }
                catch (Exception)
                {
                }

                SetCredentialPanel();
            }
            catch (Exception ex)
            {
                var client = Utilities.GetConsentFormSvcClient();
                client.CreateLog(Utilities.GetUsername(Session), LogType.E, GetType().Name + "-" + new StackTrace().GetFrame(0).GetMethod().ToString(),
                                 ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }