|
@@ -76,12 +76,21 @@ namespace qdr.app.studiou.orders2printpack
|
|
|
_storage.AppendCategoriesFromString(AppSettings.Default.PredefinedCategories);
|
|
_storage.AppendCategoriesFromString(AppSettings.Default.PredefinedCategories);
|
|
|
_currentDetailProduct = null;
|
|
_currentDetailProduct = null;
|
|
|
if (dlgSaveFile.ShowDialog() == DialogResult.OK)
|
|
if (dlgSaveFile.ShowDialog() == DialogResult.OK)
|
|
|
- SaveProductFile(dlgSaveFile.FileName);
|
|
|
|
|
|
|
+ SaveProductFile(dlgSaveFile.FileName);
|
|
|
|
|
|
|
|
ClearDetail();
|
|
ClearDetail();
|
|
|
RefreshViews();
|
|
RefreshViews();
|
|
|
RefreshTools();
|
|
RefreshTools();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private void tbbutGenerateRepo_Click(object sender, EventArgs e)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (dlgDirSelect.ShowDialog() == DialogResult.OK)
|
|
|
|
|
+ {
|
|
|
|
|
+ GenerateRepository(dlgDirSelect.SelectedPath);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private void tbbutOpen_Click(object sender, EventArgs e)
|
|
private void tbbutOpen_Click(object sender, EventArgs e)
|
|
|
{
|
|
{
|
|
|
if (dlgOpenFile.ShowDialog() == DialogResult.OK)
|
|
if (dlgOpenFile.ShowDialog() == DialogResult.OK)
|
|
@@ -289,7 +298,7 @@ namespace qdr.app.studiou.orders2printpack
|
|
|
{
|
|
{
|
|
|
if (!data.IsValid)
|
|
if (!data.IsValid)
|
|
|
lvItem.BackColor = Color.IndianRed;
|
|
lvItem.BackColor = Color.IndianRed;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
});
|
|
});
|
|
|
lvProducts.RestoreSelection();
|
|
lvProducts.RestoreSelection();
|
|
|
});
|
|
});
|
|
@@ -343,6 +352,9 @@ namespace qdr.app.studiou.orders2printpack
|
|
|
_currentDetailCategory = category;
|
|
_currentDetailCategory = category;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
#region *** Operations ***
|
|
#region *** Operations ***
|
|
@@ -537,12 +549,13 @@ namespace qdr.app.studiou.orders2printpack
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
data.ProductName = tbdetName.Text;
|
|
data.ProductName = tbdetName.Text;
|
|
|
- if (!string.Equals(data.Sku,tbdetSku.Text,StringComparison.CurrentCultureIgnoreCase)){
|
|
|
|
|
|
|
+ if (!string.Equals(data.Sku, tbdetSku.Text, StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
+ {
|
|
|
if (_storage.Products.Any(x => string.Equals(x.Sku, tbdetSku.Text, StringComparison.CurrentCultureIgnoreCase)))
|
|
if (_storage.Products.Any(x => string.Equals(x.Sku, tbdetSku.Text, StringComparison.CurrentCultureIgnoreCase)))
|
|
|
throw new Exception($"Produkt se zadaným SKU '{tbdetSku.Text}' již existuje!");
|
|
throw new Exception($"Produkt se zadaným SKU '{tbdetSku.Text}' již existuje!");
|
|
|
if (!data.IsVariant)
|
|
if (!data.IsVariant)
|
|
|
{
|
|
{
|
|
|
- foreach(ProductDto item in _storage.Products.Where(x=>x.IsVariant && string.Equals(x.ParentName, data.Sku, StringComparison.CurrentCultureIgnoreCase)))
|
|
|
|
|
|
|
+ foreach (ProductDto item in _storage.Products.Where(x => x.IsVariant && string.Equals(x.ParentName, data.Sku, StringComparison.CurrentCultureIgnoreCase)))
|
|
|
{
|
|
{
|
|
|
item.ParentName = tbdetSku.Text;
|
|
item.ParentName = tbdetSku.Text;
|
|
|
}
|
|
}
|
|
@@ -600,6 +613,49 @@ namespace qdr.app.studiou.orders2printpack
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private void GenerateRepository(string selectedPath)
|
|
|
|
|
+ {
|
|
|
|
|
+ int skipedCnt = 0;
|
|
|
|
|
+ int createdCnt = 0;
|
|
|
|
|
+ BlockErrorHandled(() =>
|
|
|
|
|
+ {
|
|
|
|
|
+ if (!Directory.Exists(selectedPath))
|
|
|
|
|
+ throw new Exception($"Složka '{selectedPath}' neexistuje.");
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ foreach (var category in _storage.Categories)
|
|
|
|
|
+ {
|
|
|
|
|
+ var fullPath = Path.Combine(selectedPath, category.Name);
|
|
|
|
|
+ if (!Directory.Exists(fullPath))
|
|
|
|
|
+ {
|
|
|
|
|
+ Directory.CreateDirectory(fullPath);
|
|
|
|
|
+ createdCnt++;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ skipedCnt++;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ foreach (var variant in _storage.Variants)
|
|
|
|
|
+ {
|
|
|
|
|
+ var variantPath = Path.Combine(fullPath, variant.Name);
|
|
|
|
|
+ if (!Directory.Exists(variantPath))
|
|
|
|
|
+ {
|
|
|
|
|
+ Directory.CreateDirectory(variantPath);
|
|
|
|
|
+ createdCnt++;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ skipedCnt++;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ MessageBox.Show($"Bylo vytvořeno {createdCnt} složek, {skipedCnt} již existovalo.", "Hotovo", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
+ }
|
|
|
private void AddNewVariant()
|
|
private void AddNewVariant()
|
|
|
{
|
|
{
|
|
|
BlockErrorHandled(() =>
|
|
BlockErrorHandled(() =>
|
|
@@ -733,7 +789,7 @@ namespace qdr.app.studiou.orders2printpack
|
|
|
var fsrch = new FileSearch(selectedPath, true);
|
|
var fsrch = new FileSearch(selectedPath, true);
|
|
|
var filesCache = new List<string>();
|
|
var filesCache = new List<string>();
|
|
|
|
|
|
|
|
- var files = fsrch.Search(new[] {AppSettings.Default.SourceSearchPattern , "*" });
|
|
|
|
|
|
|
+ var files = fsrch.Search(new[] { AppSettings.Default.SourceSearchPattern, "*" });
|
|
|
if (files.Length == 0)
|
|
if (files.Length == 0)
|
|
|
throw new Exception($"Nenalezeny žádné soubory pro zpracování ve složce '{selectedPath}'.");
|
|
throw new Exception($"Nenalezeny žádné soubory pro zpracování ve složce '{selectedPath}'.");
|
|
|
// construct list of files
|
|
// construct list of files
|
|
@@ -815,6 +871,7 @@ namespace qdr.app.studiou.orders2printpack
|
|
|
}
|
|
}
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|