| | | 1 | | using System; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using System.Text; |
| | | 4 | | using WinSolutions.Sveta.Server.Data.DataLoading.Records; |
| | | 5 | | using WinSolutions.Sveta.Server.Data.DataModel.Entities; |
| | | 6 | | |
| | | 7 | | namespace WinSolutions.Sveta.Server.Data.DataLoading.Records |
| | | 8 | | { |
| | | 9 | | public class ExternalRest : Rest, IExternalRecord |
| | | 10 | | { |
| | | 11 | | //DepartmentID,VENDORCODE,NAME,REST |
| | 0 | 12 | | public int LineNumber { get; set; } |
| | 0 | 13 | | public List<string> Line { get; set; } = new List<string>(); |
| | 0 | 14 | | public Exception Exception { get; set; } |
| | | 15 | | |
| | 0 | 16 | | public string GoodID { get; set; } |
| | | 17 | | |
| | 0 | 18 | | public string GoodName { get; set; } |
| | | 19 | | |
| | 0 | 20 | | public string UniqueCode { get; set; } |
| | | 21 | | |
| | 0 | 22 | | public string VendorCode { get; set; } |
| | | 23 | | |
| | | 24 | | public IEnumerable<FieldMap> GetMapping() |
| | 0 | 25 | | { |
| | 0 | 26 | | int x = 0; |
| | 0 | 27 | | var type = this.GetType(); |
| | 0 | 28 | | foreach (var p in new[] |
| | 0 | 29 | | { |
| | 0 | 30 | | new {Prop = nameof(UniqueCode), Sample = "ТП{0:D6}", NameRus = "**Уникальный код товара"}, |
| | 0 | 31 | | new {Prop = nameof(GoodID), Sample = "{0}", NameRus = "**ID товара"}, |
| | 0 | 32 | | new {Prop = nameof(GoodName), Sample = "Название товара {0}", NameRus = "**Название товара"}, |
| | 0 | 33 | | new {Prop = nameof(VendorCode), Sample = "{0}", NameRus = "**Артикул"}, |
| | 0 | 34 | | new {Prop = nameof(Quantity), Sample = "{0}", NameRus = "*Количество"}, |
| | 0 | 35 | | }) |
| | 0 | 36 | | { |
| | 0 | 37 | | yield return new FieldMap(x, type.GetProperty(p.Prop)) { SampleData = p.Sample, NameRus = p.NameRus }; |
| | | 38 | | |
| | 0 | 39 | | x++; |
| | 0 | 40 | | } |
| | 0 | 41 | | } |
| | | 42 | | } |
| | | 43 | | } |