2023-04-01 15:24:04 +03:00
|
|
|
|
using System.Configuration;
|
2023-03-28 07:25:10 +03:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
2023-04-01 15:24:04 +03:00
|
|
|
|
namespace RhSolutions.Services;
|
|
|
|
|
|
2023-04-06 08:29:39 +03:00
|
|
|
|
public class RhAddInConfiguration : ApplicationSettingsBase, IAddInConfiguration
|
2023-03-28 07:25:10 +03:00
|
|
|
|
{
|
2023-04-06 08:29:39 +03:00
|
|
|
|
private readonly Dictionary<string, string> _priceListHeaders;
|
2023-04-01 15:24:04 +03:00
|
|
|
|
|
2023-04-06 08:29:39 +03:00
|
|
|
|
public RhAddInConfiguration()
|
2023-04-01 15:24:04 +03:00
|
|
|
|
{
|
2023-04-06 08:29:39 +03:00
|
|
|
|
_priceListHeaders = new Dictionary<string, string>()
|
2023-04-01 15:24:04 +03:00
|
|
|
|
{
|
|
|
|
|
["Amount"] = AmountHeader,
|
|
|
|
|
["OldSku"] = OldSkuHeader,
|
|
|
|
|
["Sku"] = SkuHeader,
|
2023-04-06 08:29:39 +03:00
|
|
|
|
["ProductLine"] = ProductLineHeader,
|
2023-04-01 15:24:04 +03:00
|
|
|
|
["Name"] = NameHeader
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[UserScopedSetting]
|
|
|
|
|
[DefaultSettingValue("Кол-во")]
|
|
|
|
|
public string AmountHeader
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (string)this[nameof(AmountHeader)];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[UserScopedSetting]
|
|
|
|
|
[DefaultSettingValue("Прежний материал")]
|
|
|
|
|
public string OldSkuHeader
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (string)this[nameof(OldSkuHeader)];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[UserScopedSetting]
|
|
|
|
|
[DefaultSettingValue("Актуальный материал")]
|
|
|
|
|
public string SkuHeader
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (string)this[nameof(SkuHeader)];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[UserScopedSetting]
|
|
|
|
|
[DefaultSettingValue("Программа")]
|
2023-04-06 08:29:39 +03:00
|
|
|
|
public string ProductLineHeader
|
2023-03-28 07:25:10 +03:00
|
|
|
|
{
|
2023-04-01 15:24:04 +03:00
|
|
|
|
get
|
2023-03-28 07:25:10 +03:00
|
|
|
|
{
|
2023-04-06 08:29:39 +03:00
|
|
|
|
return (string)this[nameof(ProductLineHeader)];
|
2023-03-28 07:25:10 +03:00
|
|
|
|
}
|
2023-04-01 15:24:04 +03:00
|
|
|
|
}
|
2023-03-28 07:25:10 +03:00
|
|
|
|
|
2023-04-01 15:24:04 +03:00
|
|
|
|
[UserScopedSetting]
|
|
|
|
|
[DefaultSettingValue("Наименование")]
|
|
|
|
|
public string NameHeader
|
|
|
|
|
{
|
|
|
|
|
get
|
2023-03-28 07:25:10 +03:00
|
|
|
|
{
|
2023-04-01 15:24:04 +03:00
|
|
|
|
return (string)this[nameof(NameHeader)];
|
2023-03-28 07:25:10 +03:00
|
|
|
|
}
|
2023-04-01 15:24:04 +03:00
|
|
|
|
}
|
2023-03-28 07:25:10 +03:00
|
|
|
|
|
2023-04-01 15:24:04 +03:00
|
|
|
|
[UserScopedSetting]
|
|
|
|
|
public string PriceListPath
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (string)this[nameof(PriceListPath)];
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this[nameof(PriceListPath)] = value;
|
|
|
|
|
}
|
2023-03-28 07:25:10 +03:00
|
|
|
|
}
|
2023-04-01 15:24:04 +03:00
|
|
|
|
|
|
|
|
|
public event SettingChangingEventHandler OnSettingsChange
|
|
|
|
|
{
|
|
|
|
|
add
|
|
|
|
|
{
|
|
|
|
|
base.SettingChanging += value;
|
|
|
|
|
}
|
|
|
|
|
remove
|
|
|
|
|
{
|
|
|
|
|
base.SettingChanging -= value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string GetPriceListFileName() => Path.GetFileName(PriceListPath);
|
|
|
|
|
public string GetPriceListPath() => PriceListPath;
|
|
|
|
|
public void SetPriceListPath(string value) => PriceListPath = value;
|
|
|
|
|
public void SaveSettings() => base.Save();
|
2023-04-06 08:29:39 +03:00
|
|
|
|
public Dictionary<string, string> GetPriceListHeaders() => _priceListHeaders;
|
2023-03-28 07:25:10 +03:00
|
|
|
|
}
|