Example #1
0
        public override void Apply()
        {
            var providersIds = new List <string>();
            var query        = Database.FormatSql("SELECT \"Id\" FROM \"Providers\"");
            var reader       = Database.ExecuteReader(query);

            while (reader.Read())
            {
                providersIds.Add(reader[0].ToString());
            }

            reader.Close();

            foreach (var providerId in providersIds)
            {
                query =
                    Database.FormatSql($"SELECT \"Id\" FROM \"ShippingWarehouses\" " +
                                       $"WHERE \"ProviderId\" = '{providerId}' AND \"WarehouseName\" = 'Коледино'");
                reader = Database.ExecuteReader(query);
                if (!reader.Read())
                {
                    reader.Close();
                    AddShippingWarehouse(providerId);
                }
                else
                {
                    reader.Close();
                }
            }
        }