Ejemplo n.º 1
0
        public static IServiceCollection UseADO(this IServiceCollection serviceCollection, Func <ADOConnection, ADOConnection> function)
        {
            ADOConnection adoConnection = null;
            ADOManager    baseManager   = new ADOManager(function(adoConnection));

            serviceCollection.AddSingleton <ADOManager>(baseManager);
            return(serviceCollection);
        }
Ejemplo n.º 2
0
 public void LogToMSSQL(ExecutionArgs args, ADOConnection connection, string TableName = "")
 {
     _logModel           = new LogModel(args);
     _logModel.TableName = GetNameOfLog(TableName);
     Process(() =>
     {
         _logger = new SQLManager(connection);
         _logger.Log(_logModel);
     });
 }
Ejemplo n.º 3
0
 public ADOManager()
 {
     _adoConnection = new TContext();
     if (string.IsNullOrEmpty(_adoConnection.ConnectionString))
     {
         throw new ArgumentNullException();
     }
     if (_sqlConnection == null)
     {
         _sqlConnection = new SqlConnection(_adoConnection.ConnectionString);
     }
 }
Ejemplo n.º 4
0
 public ADOBaseManager(ADOConnection connection)
 {
     if (string.IsNullOrEmpty(connection.ConnectionString))
     {
         throw new ArgumentNullException(nameof(connection));
     }
     if (_sqlConnection == null)
     {
         _sqlConnection = new SqlConnection(connection.ConnectionString);
         Open(_sqlConnection);
     }
 }
Ejemplo n.º 5
0
        public void ConnectionIsCreated()
        {
            string        PAT           = Environment.GetEnvironmentVariable("ADOConnection_PAT");
            string        collectionUrl = Environment.GetEnvironmentVariable("ADOConnection_URL");
            ADOConnection aDOConnection = new ADOConnection(collectionUrl, PAT);

            using (GraphHttpClient graphClient = aDOConnection.Connection.GetClient <GraphHttpClient>())
            {
                PagedGraphGroups groups = graphClient.ListGroupsAsync().Result;
                Assert.IsNotNull(groups.GraphGroups);
            }
        }
Ejemplo n.º 6
0
        private IADOConnection DefaultConnection()
        {
            string connString = string.Format(@"Data Source =.; Initial Catalog = {0}; Integrated Security = True; ", _databaseName);

            return(ADOConnection.Create(connString));
        }
Ejemplo n.º 7
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            if (rb_Sql.Checked)
            {
                // if the address field is blank, dont do anything and alert the user
                if (tb_address.Text == "")
                {
                    MessageBox.Show("No Address Specified. Specify an address.");
                    this.DialogResult = DialogResult.None;
                    return;
                }

                // if the database field is blank, dont do anything and alert the user
                if (tb_database.Text == "")
                {
                    MessageBox.Show("No Database Specified. Specify a Database.");
                    this.DialogResult = DialogResult.None;
                    return;
                }

                // if the timeout field is blank, dont do anything and alert the user
                if (tb_timeout.Text == "")
                {
                    MessageBox.Show("No Timeout Specified. Specify a Timeout value.");
                    this.DialogResult = DialogResult.None;
                    return;
                }
            }
            else
            {
                if (tb_ConnectionString.Text == "")
                {
                    MessageBox.Show("No Connection String Specified. Specify a connection string.");
                    this.DialogResult = DialogResult.None;
                    return;
                }
            }

            try
            {
                String error;
                bool   bSuccess = false;

                if (rb_Sql.Checked)
                {
                    using (ADOConnection Conn = new ADOConnection(null, tb_address.Text, tb_database.Text, tb_username.Text, tb_password.Text))
                    {
                        bSuccess = Conn.TestConnection(out error);
                        if (bSuccess)
                        {
                            m_ConnectionString = Conn.ConnectionString;
                        }
                    }
                }
                else
                {
                    using (ADOConnection Conn = new ADOConnection(tb_ConnectionString.Text))
                    {
                        bSuccess = Conn.TestConnection(out error);
                        if (bSuccess)
                        {
                            m_ConnectionString = tb_ConnectionString.Text;
                        }
                    }
                }

                if (!bSuccess)
                {
                    this.DialogResult = DialogResult.None;
                    MessageBox.Show(error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                this.DialogResult = DialogResult.None;
                return;
            }
        }
Ejemplo n.º 8
0
        private void btn_testconn_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.None;

            if (rb_Sql.Checked)
            {
                if (tb_address.Text == "")
                {
                    MessageBox.Show("No Address Specified. Specify an address.");
                    return;
                }

                if (tb_database.Text == "")
                {
                    MessageBox.Show("No Database Specified. Specify a Database.");
                    return;
                }

                if (tb_timeout.Text == "")
                {
                    MessageBox.Show("No Timeout Specified. Specify a Timeout value.");
                    return;
                }
            }
            else
            {
                if (tb_ConnectionString.Text == "")
                {
                    MessageBox.Show("No Connection String Specified. Specify a connection string.");
                    return;
                }
            }

            try
            {
                string error;

                if (rb_Sql.Checked)
                {
                    using (ADOConnection Conn = new ADOConnection(null, tb_address.Text, tb_database.Text, tb_username.Text, tb_password.Text))
                    {
                        if (Conn.TestConnection(out error))
                        {
                            MessageBox.Show("Connection to " + tb_address.Text + "\\" + tb_database.Text + " was successful.");
                        }
                        else
                        {
                            MessageBox.Show("Connection to " + tb_address.Text + "\\" + tb_database.Text + " failed. " + error);
                        }
                    }
                }
                else
                {
                    using (ADOConnection Conn = new ADOConnection(tb_ConnectionString.Text))
                    {
                        if (Conn.TestConnection(out error))
                        {
                            MessageBox.Show("Connection to " + tb_ConnectionString.Text + " was successful.");
                        }
                        else
                        {
                            MessageBox.Show("Connection to " + tb_ConnectionString.Text + " failed. " + error);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in ConnectionDialog.TestConnection." + ex.Message);
                return;
            }
        }
Ejemplo n.º 9
0
 public SQLManager(ADOConnection connection) : base(connection)
 {
 }