Usings simplify

This commit is contained in:
Sergey Chebotar 2023-03-28 10:36:36 +03:00
parent 2280b49ae1
commit cdb153c988
10 changed files with 390 additions and 437 deletions

View File

@ -1,14 +1,7 @@
using ExcelDna.Integration;
using Microsoft.Extensions.DependencyInjection;
using RhSolutions.Models;
using RhSolutions.Services;
using System.Collections.Generic;
using System.Linq;
namespace RhSolutions.AddIn;
namespace RhSolutions.AddIn
public class RhSolutionsFunction
{
public class RhSolutionsFunction
{
[ExcelFunction(Description = "Распознать артикул и попробовать найти его в прайс-листе")]
public static object RHSOLUTIONS([ExcelArgument(Name = "\"Строка с названием материала\"")] string line)
{
@ -53,5 +46,4 @@ namespace RhSolutions.AddIn
}
}
}
}
}

View File

@ -1,15 +1,9 @@
using Microsoft.Office.Interop.Excel;
using RhSolutions.AddIn;
using RhSolutions.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using Range = Microsoft.Office.Interop.Excel.Range;
using RhSolutions.AddIn;
namespace RhSolutions.Controllers
namespace RhSolutions.Controllers;
internal class CombineTool : ToolBase
{
internal class CombineTool : ToolBase
{
private List<SourcePriceList> SourceFiles { get; set; }
public CombineTool()
@ -62,5 +56,4 @@ namespace RhSolutions.Controllers
ResultBar.Update();
}
}
}
}

View File

@ -1,9 +1,7 @@
using RhSolutions.Models;
namespace RhSolutions.Controllers;
namespace RhSolutions.Controllers
internal class ConvertTool : ToolBase
{
internal class ConvertTool : ToolBase
{
private SourcePriceList Current { get; set; }
public ConvertTool()
@ -26,5 +24,4 @@ namespace RhSolutions.Controllers
ResultBar.Update();
}
}
}
}

View File

@ -1,14 +1,11 @@
using Microsoft.Office.Interop.Excel;
using System;
using RhSolutions.Models;
using System.Collections.Generic;
using RhSolutions.Models;
using System.Linq;
using Range = Microsoft.Office.Interop.Excel.Range;
namespace RhSolutions.Controllers
namespace RhSolutions.Controllers;
internal class ExportTool : ToolBase
{
internal class ExportTool : ToolBase
{
private Dictionary<Product, double> PositionAmount;
private readonly Range Selection;
@ -96,6 +93,5 @@ namespace RhSolutions.Controllers
}
}
}
}
}

View File

@ -1,18 +1,14 @@
using ExcelDna.Integration.CustomUI;
using Microsoft.Office.Interop.Excel;
using RhSolutions.AddIn;
using RhSolutions.Services;
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Range = Microsoft.Office.Interop.Excel.Range;
namespace RhSolutions.Controllers
namespace RhSolutions.Controllers;
[ComVisible(true)]
public class RibbonController : ExcelRibbon
{
[ComVisible(true)]
public class RibbonController : ExcelRibbon
{
private static IRibbonUI ribbonUi;
public override string GetCustomUI(string RibbonID)
@ -128,5 +124,4 @@ namespace RhSolutions.Controllers
string name = RhSolutionsAddIn.Configuration.GetPriceListFileName();
return string.IsNullOrEmpty(name) ? "Нет файла шаблона!" : name;
}
}
}

View File

@ -1,11 +1,4 @@
using Microsoft.Office.Interop.Excel;
using RhSolutions.AddIn;
using RhSolutions.Models;
using RhSolutions.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using Range = Microsoft.Office.Interop.Excel.Range;
using RhSolutions.AddIn;
namespace RhSolutions.Controllers
{

View File

@ -1,15 +1,9 @@
using ExcelDna.Integration;
using Microsoft.Office.Interop.Excel;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Range = Microsoft.Office.Interop.Excel.Range;
using System.IO;
namespace RhSolutions.Models
namespace RhSolutions.Models;
internal class SourcePriceList : PriceListBase
{
internal class SourcePriceList : PriceListBase
{
public Dictionary<Product, double> PositionAmount { get; private set; }
public SourcePriceList(Workbook workbook)
@ -111,6 +105,5 @@ namespace RhSolutions.Models
}
}
}
}
}

View File

@ -1,13 +1,9 @@
using Microsoft.Office.Interop.Excel;
using System;
using System.IO;
using System.Linq;
using Range = Microsoft.Office.Interop.Excel.Range;
using System.IO;
namespace RhSolutions.Models
namespace RhSolutions.Models;
internal class TargetPriceList : PriceListBase
{
internal class TargetPriceList : PriceListBase
{
public Range OldSkuCell { get; private set; }
public TargetPriceList(Workbook workbook)
@ -36,6 +32,5 @@ namespace RhSolutions.Models
throw new ArgumentException($"Шаблон {Name} не является прайс-листом");
}
}
}
}

View File

@ -1,11 +1,7 @@
using Microsoft.Office.Interop.Excel;
using RhSolutions.Models;
using System.Linq;
namespace RhSolutions.Services;
namespace RhSolutions.Services
public static class WorksheetExtensions
{
public static class WorksheetExtensions
{
public static bool IsRehauSource(this Worksheet worksheet)
{
Range amountCell;
@ -36,6 +32,5 @@ namespace RhSolutions.Services
range.Value2 += value;
}
}
}
}

View File

@ -1,5 +1,9 @@
global using ExcelDna.Integration;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Office.Interop.Excel;
global using RhSolutions.Models;
global using RhSolutions.Services;
global using System;
global using System.Collections.Generic;
global using System.Linq;
global using Range = Microsoft.Office.Interop.Excel.Range;