Example #1
0
            public bool SetColumn(String columnName, String columnValue)
            {
                bool         result = false;
                IFilterValue fv     = DoMatchHeader(columnName);

                //CsvColumn column = ColumnValues.Where(cv => cv.Header.IndexOf(columnName)!=-1).FirstOrDefault();
                if (fv != null)
                {
                    fv.UpdateValue(columnValue);
                    result = true;
                }
                return(result);
            }
Example #2
0
            public void UpdateCollection(String newCollection)
            {
                IFilterValue column = GetColumn(CollectionName);

                if (column == null)
                {
                    InvalidRow = true;
                }
                else
                {
                    column.UpdateValue(newCollection);
                }
            }
Example #3
0
            public override string ToString()
            {
                StringBuilder row    = new StringBuilder();
                int           colIdx = 0;

                foreach (CsvColumn value in ColumnValues)
                {
                    if (value.Header == Tags)
                    {
                        IFilterValue collection = GetColumn(CollectionName);

                        IList <String> updatedCategories = CsvRow.UpdateCategories(collection.Value);
                        String         updatedCollection = CsvRow.GetUpdatedCollection(updatedCategories);
                        collection.UpdateValue(updatedCollection);
                        StringBuilder tags = new StringBuilder();
                        foreach (String tag in GetTags())
                        {
                            if (tags.Length == 0)
                            {
                                tags.Append(tag);
                            }
                            else
                            {
                                tags.Append(',').Append(tag);
                            }
                        }
                        value.UpdateValue($"\"{tags.ToString()}\"");
                    }

                    if (colIdx == 0)
                    {
                        row.Append(value.Value);
                    }
                    else
                    {
                        row.Append(',').Append(value.Value);
                    }

                    colIdx++;
                }
                return(row.ToString());
            }