Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollback new logic for GetSqlSourceSchema and bump version to 10.0.9 #16

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>10.0.8</Version>
<Version>10.0.9</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Title>Ecom Provider</Title>
<Description>Ecom Provider</Description>
Expand Down
27 changes: 16 additions & 11 deletions src/EcomProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
using Dynamicweb.DataIntegration.Integration;
using Dynamicweb.DataIntegration.Integration.Interfaces;
using Dynamicweb.DataIntegration.ProviderHelpers;
using Dynamicweb.Environment;
using Dynamicweb.Extensibility;
using Dynamicweb.Extensibility.AddIns;
using Dynamicweb.Extensibility.Editors;
using Dynamicweb.Indexing;
using Dynamicweb.Indexing.Repositories;
using Dynamicweb.Logging;
using Microsoft.CodeAnalysis;
using System;
Expand Down Expand Up @@ -97,9 +93,9 @@ public string RelatedProductGroupsBy
}

public bool GetRelatedProductGroupsByName { get; set; }

private string defaultLanguage = null;
[AddInParameter("Default Language"), AddInParameterEditor(typeof(DropDownParameterEditor), "none=true;Tooltip=Set the default language for the imported products"), AddInParameterGroup("Destination"), AddInParameterOrder(10)]
[AddInParameter("Default Language"), AddInParameterEditor(typeof(DropDownParameterEditor), "none=true;Tooltip=Set the default language for the imported products"), AddInParameterGroup("Destination"), AddInParameterOrder(10)]
public string DefaultLanguage
{
get
Expand Down Expand Up @@ -213,9 +209,9 @@ public override Schema GetOriginalSourceSchema()
return GetSchema(false);
}

private Schema GetDynamicwebSourceSchema(IEnumerable<string> tableNames)
private Schema GetDynamicwebSourceSchema()
{
Schema result = GetSqlSourceSchema(Connection, tableNames);
Schema result = GetSqlSourceSchema(Connection);
//set key for AccessUserTable
if (UserKeyField != null)
{
Expand Down Expand Up @@ -264,12 +260,21 @@ private Schema GetDynamicwebSourceSchema(IEnumerable<string> tableNames)
/// <returns></returns>
public Schema GetSchema(bool getForDestination)
{
Schema result = GetDynamicwebSourceSchema();
List<string> tablestToKeep = new()
{ "EcomProducts", "EcomManufacturers", "EcomGroups", "EcomVariantGroups", "EcomVariantsOptions",
"EcomProductsRelated", "EcomProductItems", "EcomStockUnit", "EcomDetails","EcomProductCategoryFieldValue", "EcomLanguages", "EcomPrices",
"EcomAssortmentGroupRelations", "EcomAssortmentPermissions", "EcomAssortmentProductRelations", "EcomAssortments", "EcomAssortmentShopRelations", "EcomVariantOptionsProductRelation"};
Schema result = GetDynamicwebSourceSchema(tablestToKeep);

List<Table> tablesToRemove = new();
foreach (Table table in result.GetTables())
{
if (!tablestToKeep.Contains(table.Name))
tablesToRemove.Add(table);
}
foreach (Table table in tablesToRemove)
{
result.RemoveTable(table);
}
foreach (Table table in result.GetTables())
{
switch (table.Name)
Expand Down Expand Up @@ -957,7 +962,7 @@ private IEnumerable<ParameterOption> GetDefaultLanguageOptions()
var sqlCommand = GetOpenConnection();
var languagesDataAdapter = new SqlDataAdapter("SELECT LanguageID, LanguageCode2, LanguageName FROM EcomLanguages", sqlCommand.Connection);
_ = new SqlCommandBuilder(languagesDataAdapter);
var languageDataSet = new DataSet();
var languageDataSet = new DataSet();
languagesDataAdapter.Fill(languageDataSet);
foreach (DataRow row in languageDataSet.Tables[0].Rows)
{
Expand Down
Loading