Ejemplo n.º 1
0
        private void OnTestConnectionClick(object sender, EventArgs e)
        {
            //Проверка данных на пустоту
            if (model.StringIsEmpty(view.TxtServer.Text,
                                    view.TxtDatabase.Text))
            {
                Class.Messages.DataIsEmpty();
                return;
            }

            string connectionString
                = model.GetConnectionString(view.TxtServer.Text,
                                            view.TxtDatabase.Text,
                                            5);

            //Если не указана строка подключение или устарела
            if (String.IsNullOrEmpty(connection.ConnectionString) ||
                connection.ConnectionString != connectionString)
            {
                connection.ConnectionString = connectionString;
            }

            if (connection.TestConnection())
            {
                Class.Messages.TestConnection();
            }
        }