Move GetSourceFiles to Source class
This commit is contained in:
parent
2b3937ac2f
commit
42c06d00e3
@ -54,6 +54,7 @@ namespace RehauSku.PriceListTools
|
||||
protected private void FillPosition(KeyValuePair<Position, double> kvp, int[] columns)
|
||||
{
|
||||
Range foundCell = TargetFile.skuCell.EntireColumn.Find(kvp.Key.Sku);
|
||||
|
||||
if (foundCell == null)
|
||||
{
|
||||
Missing.Add(kvp);
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.Office.Interop.Excel;
|
||||
using ExcelDna.Integration;
|
||||
using Microsoft.Office.Interop.Excel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@ -31,6 +32,37 @@ namespace RehauSku.PriceListTools
|
||||
CreatePositionsDict();
|
||||
}
|
||||
|
||||
public static List<Source> GetSourceLists(string[] files)
|
||||
{
|
||||
var ExcelApp = (Application)ExcelDnaUtil.Application;
|
||||
|
||||
List<Source> sourceFiles = new List<Source>();
|
||||
|
||||
ExcelApp.ScreenUpdating = false;
|
||||
foreach (string file in files)
|
||||
{
|
||||
Workbook wb = ExcelApp.Workbooks.Open(file);
|
||||
try
|
||||
{
|
||||
Source priceList = new Source(wb);
|
||||
sourceFiles.Add(priceList);
|
||||
wb.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show
|
||||
(ex.Message,
|
||||
"Ошибка открытия исходного прайс-листа",
|
||||
System.Windows.Forms.MessageBoxButtons.OK,
|
||||
System.Windows.Forms.MessageBoxIcon.Information);
|
||||
wb.Close();
|
||||
}
|
||||
}
|
||||
ExcelApp.ScreenUpdating = true;
|
||||
|
||||
return sourceFiles;
|
||||
}
|
||||
|
||||
private void CreatePositionsDict()
|
||||
{
|
||||
PositionAmount = new Dictionary<Position, double>();
|
||||
|
@ -1,41 +0,0 @@
|
||||
using ExcelDna.Integration;
|
||||
using Microsoft.Office.Interop.Excel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace RehauSku.PriceListTools
|
||||
{
|
||||
internal static class SourceUtil
|
||||
{
|
||||
public static List<Source> GetSourceLists(string[] files)
|
||||
{
|
||||
var ExcelApp = (Application)ExcelDnaUtil.Application;
|
||||
|
||||
List<Source> sourceFiles = new List<Source>();
|
||||
|
||||
ExcelApp.ScreenUpdating = false;
|
||||
foreach (string file in files)
|
||||
{
|
||||
Workbook wb = ExcelApp.Workbooks.Open(file);
|
||||
try
|
||||
{
|
||||
Source priceList = new Source(wb);
|
||||
sourceFiles.Add(priceList);
|
||||
wb.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show
|
||||
(ex.Message,
|
||||
"Ошибка открытия исходного прайс-листа",
|
||||
System.Windows.Forms.MessageBoxButtons.OK,
|
||||
System.Windows.Forms.MessageBoxIcon.Information);
|
||||
wb.Close();
|
||||
}
|
||||
}
|
||||
ExcelApp.ScreenUpdating = true;
|
||||
|
||||
return sourceFiles;
|
||||
}
|
||||
}
|
||||
}
|
@ -42,7 +42,7 @@ namespace RehauSku.Ribbon
|
||||
|
||||
if (files.Length != 0)
|
||||
{
|
||||
mergeTool.SourceFiles = SourceUtil.GetSourceLists(files);
|
||||
mergeTool.SourceFiles = Source.GetSourceLists(files);
|
||||
mergeTool.OpenNewPrice();
|
||||
mergeTool.FillTarget();
|
||||
}
|
||||
@ -55,7 +55,7 @@ namespace RehauSku.Ribbon
|
||||
|
||||
if (files.Length != 0)
|
||||
{
|
||||
combineTool.SourceFiles = SourceUtil.GetSourceLists(files);
|
||||
combineTool.SourceFiles = Source.GetSourceLists(files);
|
||||
combineTool.OpenNewPrice();
|
||||
combineTool.FillTarget();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user