Пример #1
0
        private Dictionary <string, IList <ExcelField> > CasosBordeFecha(ExcelField field)
        {
            Dictionary <string, IList <ExcelField> > list = new Dictionary <string, IList <ExcelField> >();

            list.Add(field.Name, new List <ExcelField>()
            {
                new ExcelField {
                    Name     = field.Name,
                    Type     = field.Type,
                    Value    = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss"),
                    IsTester = true,
                },
                new ExcelField {
                    Name     = field.Name,
                    Type     = field.Type,
                    Value    = DateTime.MinValue.ToString("yyyy-MM-ddTHH:mm:ss"),
                    IsTester = true,
                },
                new ExcelField {
                    Name     = field.Name,
                    Type     = field.Type,
                    Value    = DateTime.MaxValue.ToString("yyyy-MM-ddTHH:mm:ss"),
                    IsTester = true,
                },
                new ExcelField {
                    Name     = field.Name,
                    Type     = field.Type,
                    Value    = "${empty}",
                    IsTester = true,
                },
                new ExcelField {
                    Name     = field.Name,
                    Type     = field.Type,
                    Value    = "${null}",
                    IsTester = true,
                },
            });

            return(list);
        }
Пример #2
0
        private void ProcessFiels(string fileExcel, IList <string> fielsXml)
        {
            using (var excel = new ExcelQueryFactory(fileExcel)) {
                var header = (from c in excel.WorksheetNoHeader(0)
                              select c).FirstOrDefault();
                var data = (from c in excel.Worksheet(0)
                            select c).ToList();

                foreach (var item in data)
                {
                    if (fielsXml.Any(x => x == item[0]))
                    {
                        List <ExcelField> list = new List <ExcelField>();
                        for (int i = StartColumnData; i < item.Count; i++)
                        {
                            if (!string.IsNullOrWhiteSpace(header[i]))
                            {
                                var field = new ExcelField
                                {
                                    Name  = item[0],
                                    Value = item[i]
                                };

                                //Valida el tipo
                                ExcelFieldType tipo = ExcelFieldType.None;
                                Enum.TryParse(item[1]?.Value?.ToString()?.Replace(":", ""), true, out tipo);
                                field.Type = tipo;

                                list.Add(field);
                            }
                        }
                        Fields.Add(item[0], list);
                        CountFiles = list.Count;
                    }
                }
            }
        }
Пример #3
0
        private Dictionary <string, IList <ExcelField> > CasosBordeNumerico(ExcelField field)
        {
            Dictionary <string, IList <ExcelField> > list = new Dictionary <string, IList <ExcelField> >();

            list.Add(field.Name, new List <ExcelField>()
            {
                new ExcelField {
                    Name     = field.Name,
                    Type     = field.Type,
                    Value    = field.MinValue,
                    IsTester = true,
                },
                new ExcelField {
                    Name     = field.Name,
                    Type     = field.Type,
                    Value    = "A",
                    IsTester = true,
                },
                new ExcelField {
                    Name     = field.Name,
                    Type     = field.Type,
                    Value    = "-1",
                    IsTester = true,
                },
                new ExcelField {
                    Name     = field.Name,
                    Type     = field.Type,
                    Value    = "+1",
                    IsTester = true,
                },
                new ExcelField {
                    Name     = field.Name,
                    Type     = field.Type,
                    Value    = "1.1",
                    IsTester = true,
                },
                new ExcelField {
                    Name     = field.Name,
                    Type     = field.Type,
                    Value    = "1,1",
                    IsTester = true,
                },
                new ExcelField {
                    Name     = field.Name,
                    Type     = field.Type,
                    Value    = "1 1",
                    IsTester = true,
                },
                new ExcelField {
                    Name     = field.Name,
                    Type     = field.Type,
                    Value    = "01",
                    IsTester = true,
                },
                new ExcelField {
                    Name     = field.Name,
                    Type     = field.Type,
                    Value    = "${empty}",
                    IsTester = true,
                },
                new ExcelField {
                    Name     = field.Name,
                    Type     = field.Type,
                    Value    = "${null}",
                    IsTester = true,
                },
            });

            return(list);
        }