internal ServiceBrokerQueue(SqlCommander db, string queueName) {
			this.db = db;
			this.Name = queueName;
			this.receiveAny = 
$@"waitfor(receive top(1) 
	conversation_handle,
	message_type_name,
	message_body
from [{queueName}]), timeout @timeout ";
			this.receive = 
$@"waitfor(receive top(1) 
	conversation_handle,
	message_type_name,
	message_body
from [{queueName}]
where conversation_handle = @conversation), timeout @timeout ";
		}
예제 #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            if (valid && isFileSelected && isNewsSelected && isDateSelected ||
                (!valid && isFileSelected && isNewsSelected && isDateSelected))
            {
                LoadingProcessForm processForm = new LoadingProcessForm();
                processForm.Show();
                Task.Factory.StartNew(() =>
                {
                    List <string> mails    = FileWorker.ReadFromFile(pathFile);
                    SqlCommander commander = new SqlCommander(processForm);
                    int amountCoincidences = commander.AddMails(new NpgsqlConnection(connectionString), mails, valid, SelectedDate, selectedNews);
                    conn.Close();
                    commander.DeleteAll();
                    MessageBox.Show("Импортировано " + mails.Count + " строк\n\n" + amountCoincidences.ToString() + " совпадений найдено.");
                });
            }

            else if (!valid && isFileSelected && (!isNewsSelected && !isDateSelected))
            {
                LoadingProcessForm processForm = new LoadingProcessForm();
                processForm.Show();
                Task.Factory.StartNew(() =>
                {
                    NpgsqlConnection conn  = new NpgsqlConnection(connectionString);
                    List <string> mails    = FileWorker.ReadFromFile(pathFile);
                    SqlCommander commander = new SqlCommander(processForm);
                    int amountCoincidences = commander.AddMails(conn, mails, valid);
                    conn.Close();
                    commander.DeleteAll();
                    MessageBox.Show("Импортировано " + mails.Count + " строк\n\n" + amountCoincidences.ToString() + " совпадений найдено.");
                });
            }
            else
            {
                MessageBox.Show("НЕ ВСЕ ПОЛЯ ЗАПОЛНЕНЫ!\nПОЖАЛУЙСТА, ПРОВЕРЬТЕ ПРАВИЛЬНОСТЬ ВВЕДЕННЫХ ДАННЫХ",
                                "Ошибка при вводе данных",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
            }
        }
예제 #3
0
        public void GetAllCommand_Checking_Count()
        {
            //Arrange
            Mock <ICommanderRepository> _commanderRepositoryMock = new Mock <ICommanderRepository>();
            List <Command> commandActual = new List <Command>
            {
                new Command {
                    Id = 1, HowTo = "Unit test", Line = "Hello world", Platform = ".net core"
                },
                new Command {
                    Id = 2, HowTo = "Integration testing", Line = "testing", Platform = ".net framework"
                },
            };

            _commanderRepositoryMock.Setup(x => x.GetAllCommandRepo()).Returns(commandActual);
            var sqlCommander = new SqlCommander(_commanderRepositoryMock.Object);

            //Act
            var commandExpected = sqlCommander.GetAllCommand().ToList();

            //Assert
            Assert.True(commandExpected.Count == commandActual.Count);
        }
		public void enable_broker() {
			Db = new SqlCommander(BrokerConnectionString);
			Broker = new SqlServerServiceBroker(Db);
			Broker.EnableBroker();
		}
		public void drop_test_database() {
			SqlConnection.ClearAllPools();
			var db = new SqlCommander(ConnectionString);
			db.ExecuteNonQuery($"drop database [{DbName}]");
		}
		public void create_empty_database() {
			var db = new SqlCommander(ConnectionString);
			db.ExecuteNonQuery($"create database [{DbName}]");
		}
예제 #7
0
        internal static void ReadCollection <T>(string storedProcedure, IDataParameter[] dataParameters, Initializer <T> initializer, out IEnumerable <T> values)
        {
            IDbCommand command = SqlCommander.BuildCommand(storedProcedure, dataParameters);

            _ReadCollection(command, initializer, out values);
        }
예제 #8
0
        internal static void Read <T>(string storedProcedure, IDataParameter[] dataParameters, Initializer <T> initializer, out T value)
        {
            IDbCommand command = SqlCommander.BuildCommand(storedProcedure, dataParameters);

            _Read(command, initializer, out value);
        }