Rename Abstract PriceList inheritors

This commit is contained in:
Sergey Chebotar 2022-02-02 18:05:49 +03:00
parent bf2e187e66
commit 1dfbfaa461
8 changed files with 19 additions and 19 deletions

View File

@ -40,7 +40,7 @@ namespace RehauSku.Interface
if (files.Length != 0) if (files.Length != 0)
{ {
mergeTool.SourceFiles = Source.GetSourceLists(files); mergeTool.SourceFiles = SourcePriceList.GetSourceLists(files);
mergeTool.OpenNewPrice(); mergeTool.OpenNewPrice();
mergeTool.FillTarget(); mergeTool.FillTarget();
} }
@ -53,7 +53,7 @@ namespace RehauSku.Interface
if (files.Length != 0) if (files.Length != 0)
{ {
combineTool.SourceFiles = Source.GetSourceLists(files); combineTool.SourceFiles = SourcePriceList.GetSourceLists(files);
combineTool.OpenNewPrice(); combineTool.OpenNewPrice();
combineTool.FillTarget(); combineTool.FillTarget();
} }

View File

@ -10,7 +10,7 @@ namespace RehauSku.PriceListTools
internal abstract class AbstractTool internal abstract class AbstractTool
{ {
protected private Application ExcelApp = (Application)ExcelDnaUtil.Application; protected private Application ExcelApp = (Application)ExcelDnaUtil.Application;
protected private Target TargetFile; protected private TargetPriceList TargetFile;
public void OpenNewPrice() public void OpenNewPrice()
{ {
@ -18,7 +18,7 @@ namespace RehauSku.PriceListTools
try try
{ {
TargetFile = new Target(wb); TargetFile = new TargetPriceList(wb);
} }
catch (Exception ex) catch (Exception ex)

View File

@ -7,13 +7,13 @@ namespace RehauSku.PriceListTools
{ {
internal class CombineTool : AbstractTool internal class CombineTool : AbstractTool
{ {
public List<Source> SourceFiles; public List<SourcePriceList> SourceFiles;
public void FillTarget() public void FillTarget()
{ {
ProgressBar bar = new ProgressBar(SourceFiles.Sum(file => file.PositionAmount.Count)); ProgressBar bar = new ProgressBar(SourceFiles.Sum(file => file.PositionAmount.Count));
foreach (Source source in SourceFiles) foreach (SourcePriceList source in SourceFiles)
{ {
TargetFile.Sheet.Columns[TargetFile.amountCell.Column] TargetFile.Sheet.Columns[TargetFile.amountCell.Column]
.EntireColumn .EntireColumn

View File

@ -5,13 +5,13 @@ namespace RehauSku.PriceListTools
{ {
internal class ConvertTool : AbstractTool internal class ConvertTool : AbstractTool
{ {
private Source Current; private SourcePriceList Current;
public void GetCurrent() public void GetCurrent()
{ {
try try
{ {
Current = new Source(ExcelApp.ActiveWorkbook); Current = new SourcePriceList(ExcelApp.ActiveWorkbook);
} }
catch (Exception exception) catch (Exception exception)

View File

@ -6,13 +6,13 @@ namespace RehauSku.PriceListTools
{ {
internal class MergeTool : AbstractTool internal class MergeTool : AbstractTool
{ {
public List<Source> SourceFiles; public List<SourcePriceList> SourceFiles;
public void FillTarget() public void FillTarget()
{ {
ProgressBar bar = new ProgressBar(SourceFiles.Sum(x => x.PositionAmount.Count)); ProgressBar bar = new ProgressBar(SourceFiles.Sum(x => x.PositionAmount.Count));
foreach (Source source in SourceFiles) foreach (SourcePriceList source in SourceFiles)
{ {
foreach (var kvp in source.PositionAmount) foreach (var kvp in source.PositionAmount)
{ {

View File

@ -7,11 +7,11 @@ using RehauSku.Interface;
namespace RehauSku.PriceListTools namespace RehauSku.PriceListTools
{ {
internal class Source : AbstractPriceList internal class SourcePriceList : AbstractPriceList
{ {
public Dictionary<Position, double> PositionAmount { get; private set; } public Dictionary<Position, double> PositionAmount { get; private set; }
public Source(Workbook workbook) public SourcePriceList(Workbook workbook)
{ {
if (workbook == null) if (workbook == null)
{ {
@ -37,12 +37,12 @@ namespace RehauSku.PriceListTools
CreatePositionsDict(); CreatePositionsDict();
} }
public static List<Source> GetSourceLists(string[] files) public static List<SourcePriceList> GetSourceLists(string[] files)
{ {
var ExcelApp = (Application)ExcelDnaUtil.Application; var ExcelApp = (Application)ExcelDnaUtil.Application;
ProgressBar bar = new ProgressBar(files.Length); ProgressBar bar = new ProgressBar(files.Length);
List<Source> sourceFiles = new List<Source>(); List<SourcePriceList> sourceFiles = new List<SourcePriceList>();
foreach (string file in files) foreach (string file in files)
{ {
@ -50,7 +50,7 @@ namespace RehauSku.PriceListTools
Workbook wb = ExcelApp.Workbooks.Open(file); Workbook wb = ExcelApp.Workbooks.Open(file);
try try
{ {
Source priceList = new Source(wb); SourcePriceList priceList = new SourcePriceList(wb);
sourceFiles.Add(priceList); sourceFiles.Add(priceList);
wb.Close(); wb.Close();
bar.DoProgress(); bar.DoProgress();

View File

@ -4,12 +4,12 @@ using System.Linq;
namespace RehauSku.PriceListTools namespace RehauSku.PriceListTools
{ {
internal class Target : AbstractPriceList internal class TargetPriceList : AbstractPriceList
{ {
private const string oldSkuHeader = "Прежний материал"; private const string oldSkuHeader = "Прежний материал";
public Range oldSkuCell { get; private set; } public Range oldSkuCell { get; private set; }
public Target(Workbook workbook) public TargetPriceList(Workbook workbook)
{ {
Sheet = workbook.ActiveSheet; Sheet = workbook.ActiveSheet;
Name = workbook.FullName; Name = workbook.FullName;

View File

@ -128,8 +128,8 @@
<Compile Include="PriceListTools\AbstractTool.cs" /> <Compile Include="PriceListTools\AbstractTool.cs" />
<Compile Include="PriceListTools\MergeTool.cs" /> <Compile Include="PriceListTools\MergeTool.cs" />
<Compile Include="PriceListTools\AbstractPriceList.cs" /> <Compile Include="PriceListTools\AbstractPriceList.cs" />
<Compile Include="PriceListTools\Source.cs" /> <Compile Include="PriceListTools\SourcePriceList.cs" />
<Compile Include="PriceListTools\Target.cs" /> <Compile Include="PriceListTools\TargetPriceList.cs" />
<Compile Include="Interface\RibbonController.cs" /> <Compile Include="Interface\RibbonController.cs" />
<Compile Include="Assistant\HttpClientUtil.cs" /> <Compile Include="Assistant\HttpClientUtil.cs" />
<Compile Include="Assistant\StoreResponse.cs" /> <Compile Include="Assistant\StoreResponse.cs" />