Exemplo n.º 1
0
        public List <ProfileAttributeCell> GetColumnCells(List <ProfileAttributeType> attributes)
        {
            List <ProfileAttributeCell> items = new List <ProfileAttributeCell>();

            if (ColumHeader.Where(c => attributes.Contains(c.Attribute)).Any())
            {
                List <ProfileAttributeColumn> cols = ColumHeader.Where(c => attributes.Contains(c.Attribute)).ToList();
                cols.ForEach(c => items.AddRange((from r in Rows select r.GetCell(c)).ToList()));
            }
            return(items);
        }
Exemplo n.º 2
0
 public List <ExternalColumn> VerifyDuplicationValues()
 {
     if (ColumHeader == null && ColumHeader.Count == 0)
     {
         return(new List <ExternalColumn>());
     }
     else
     {
         return(ColumHeader.Where(c => c.AllowDuplicate == false).ToList());
     }
 }
Exemplo n.º 3
0
        public List <ExternalCell> GetColumnCells(InputType inputType, Int32 index)
        {
            List <ExternalCell> items = new List <ExternalCell>();

            if (ColumHeader.Where(c => c.InputType == inputType && c.Number == index).Any())
            {
                ExternalColumn col = ColumHeader.Where(c => c.InputType == inputType && c.Number == index).FirstOrDefault();

                items = (from r in Rows select r.GetCell(col.Number)).ToList();
                // Rows.ForEach(r => items.AddRange(r.Select((value, i) => new { Value = value, Index = i }).Where(item => item.Index == index).Select(item => item.Value).ToList()));
            }
            return(items);
        }
Exemplo n.º 4
0
        //private ProfileExternalTextRow CreateExternalRow(TextRow row, List<int> colIndexes, ref int index)
        //{
        //    ProfileExternalTextRow result = new ProfileExternalTextRow();
        //    result.Number = index;
        //    result.AddRange(row.Select((value, i) => new { Value = value, Index = i }).Where(c => colIndexes.Contains(c.Index)).Select(c => c.Value).ToList());
        //    index += 1;
        //    return result;
        //}

        public List <ProfileAttributeCell> GetColumnCells(ProfileAttributeType attribute)
        {
            List <ProfileAttributeCell> items = new List <ProfileAttributeCell>();

            if (ColumHeader.Where(c => c.Attribute == attribute).Any())
            {
                ProfileAttributeColumn col = ColumHeader.Where(c => c.Attribute == attribute).FirstOrDefault();

                items = (from r in Rows select r.GetCell(col)).ToList();
                // Rows.ForEach(r => items.AddRange(r.Select((value, i) => new { Value = value, Index = i }).Where(item => item.Index == index).Select(item => item.Value).ToList()));
            }
            return(items);
        }
Exemplo n.º 5
0
        private void ValidateSourceData()
        {
            // Find all columns to validate at startup !
            List <ExternalColumn> cols = ColumHeader.Where(c => c.AllowDuplicate == false).ToList();

            foreach (ExternalColumn col in cols)
            {
                List <ExternalCell> cells = GetDuplicatedCells(col.InputType, col.Number);
                if (cells != null && cells.Count > 0)
                {
                    cells.ForEach(c => c.SetDuplicatedRows(cells.Where(cc => cc != c).Select(cr => cr.Row.Number).ToList()));
                }
            }
            foreach (ExternalRow row in Rows)
            {
                row.AllowImport = row.isValid();
            }
        }
Exemplo n.º 6
0
        private void ValidateStartData()
        {
            // Find all columns to validate at startup !
            List <ProfileAttributeColumn> cols = ColumHeader.Where(c => c.AllowDuplicate == false).ToList();

            foreach (ProfileAttributeColumn col in cols)
            {
                List <ProfileAttributeCell> cells = GetDuplicatedCells(col.Attribute);
                if (cells != null && cells.Count > 0)
                {
                    cells.ForEach(c => c.SetDuplicatedRows(cells.Where(cc => cc != c).Select(cr => cr.Row.Number).ToList()));
                }
            }
            foreach (ProfileAttributesRow row in Rows)
            {
                row.AllowImport = row.isValid();
            }
        }
Exemplo n.º 7
0
 public void ValidateSourceData(List <Int32> notEmptyColumns, List <Int32> notDuplicatedColumns)
 {
     ColumHeader.Where(c => notEmptyColumns.Contains(c.Number)).ToList().ForEach(c => c.AllowEmpty          = false);
     ColumHeader.Where(c => notDuplicatedColumns.Contains(c.Number)).ToList().ForEach(c => c.AllowDuplicate = false);
     ValidateSourceData();
 }