Exemplo n.º 1
0
        private IEnumerable <ExcelImportRuleCellPoco> BuildProperties()
        {
            if (!IsNew)
            {
                var ex = new Exception(@"Попытка создания пустых полей для записанного правила импорта");
                Log.Exception(ex);
#if DEBUG
                throw ex;
#endif
            }

            return((
                       from property in CatalogItemSchema.Properties
                       select new ExcelImportRuleCellPoco()
            {
                RowIndex = 0,
                Property = property,
                FormatterGuid = FormattersLocator.Search(CatalogItemSchema.GetPropertyConcreteType(property)).First().Guid
            }).ToArray());
        }
Exemplo n.º 2
0
        public void UpdateCompatableFormatters()
        {
            if (CompatableFormatters == null)
            {
                CompatableFormatters = new ObservableCollection <IFormatter>();
            }

            var formatters = FormattersLocator.Search(GeneralizedTypes.GetConcreteType(GeneralizedType)).ToArray();

            if (CompatableFormatters.Count == 0)
            {
                foreach (var formatter in formatters)
                {
                    CompatableFormatters.Add(formatter);
                }

                return;
            }

            CollectionUtils.UpdateObservableCollection(CompatableFormatters, formatters);
        }
Exemplo n.º 3
0
 public static ExcelImportRule BuildMasumaRules()
 {
     return(new ExcelImportRule()
     {
         ColumnOffset = 0,
         RowOffset = 7,
         WorksheetIndex = 1,
         CsvMode = true,
         Identificator = "masumaexcel",
         Name = "Masuma Excel",
         Description = @"Файл прайс-листов Excel поставщика Masuma",
         Columns = new[]
         {
             new ExcelImportRule.Column()
             {
                 Name = @"Brand",
                 Formatter = FormattersLocator.Search <string>().First(),
                 Index = 1,
                 Active = true,
                 Required = true
             },
             new ExcelImportRule.Column()
             {
                 Name = @"PartNumber",
                 Formatter = FormattersLocator.Search <string>().First(),
                 Index = 3,
                 Active = true,
                 Required = true
             },
             new ExcelImportRule.Column()
             {
                 Name = @"Name",
                 Formatter = FormattersLocator.Search <string>().First(),
                 Index = 5,
                 Active = true,
                 Required = true
             },
             new ExcelImportRule.Column()
             {
                 Name = @"Analogs",
                 Formatter = FormattersLocator.Search <string[]>().First(),
                 Index = 4,
                 Active = true
             },
             new ExcelImportRule.Column()
             {
                 Name = @"Balance",
                 Formatter = FormattersLocator.Search <double>().First(),
                 Index = 8,
                 Active = true,
                 Required = true
             },
             new ExcelImportRule.Column()
             {
                 Name = @"Price",
                 Formatter = FormattersLocator.Search <double>().First(),
                 Index = 9,
                 Active = true,
                 Required = true
             }
         }
     });
 }
Exemplo n.º 4
0
        private void Defaults()
        {
            var fields = new List <RuleFieldViewModel>();

            NameField = new RuleFieldViewModel
            {
                Name            = "Name",
                GeneralizedType = GeneralizedType.String,
                Active          = true,
                Required        = true,
                BaseField       = true,
                //Index = 0,
                Formatter = FormattersLocator.Search <string>().First()
            };
            fields.Add(NameField);

            BrandField = new RuleFieldViewModel
            {
                Name            = "Brand",
                GeneralizedType = GeneralizedType.String,
                Active          = true,
                Required        = true,
                BaseField       = false,
                //Index = 0,
                Formatter = FormattersLocator.Search <string>().First()
            };
            fields.Add(BrandField);

            PartNumberField = new RuleFieldViewModel
            {
                Name            = "PartNumber",
                GeneralizedType = GeneralizedType.String,
                Active          = true,
                Required        = true,
                BaseField       = true,
                //Index = 0,
                Formatter = FormattersLocator.Search <string>().First()
            };
            fields.Add(PartNumberField);

            PriceField = new RuleFieldViewModel
            {
                Name            = "Price",
                GeneralizedType = GeneralizedType.Float,
                Active          = true,
                Required        = true,
                BaseField       = true,
                //Index = 0,
                Formatter = FormattersLocator.Search <double>().First()
            };
            fields.Add(PriceField);

            BalanceField = new RuleFieldViewModel
            {
                Name            = "Balance",
                GeneralizedType = GeneralizedType.Float,
                Active          = true,
                Required        = true,
                BaseField       = false,
                //Index = 0,
                Formatter = FormattersLocator.Search <double>().First()
            };
            fields.Add(BalanceField);

            AnalogsField = new RuleFieldViewModel
            {
                Name            = "Analogs",
                GeneralizedType = GeneralizedType.ArrayOfString,
                Active          = true,
                Required        = false,
                BaseField       = false,
                //Index = 0,
                Formatter = FormattersLocator.Search <string[]>().First()
            };
            fields.Add(AnalogsField);

            Fields = fields;

            SubscrubeFieldsChanges();
        }