Exemplo n.º 1
0
        public Dictionary <string, Dictionary <string, ICell> > GetRows(params string[] colNameValues)
        // TODO method name conflict
        {
            var result = new Dictionary <string, Dictionary <string, ICell> >();

            foreach (var row in Rows.Get())
            {
                var matches = true;
                foreach (var colNameValue in colNameValues)
                {
                    if (!colNameValue.Matches("[^=]+=[^=]*"))
                    {
                        throw Exception($"Wrong searchCriteria for Cells: {colNameValue}");
                    }
                    var splitted = colNameValue.Split(Convert.ToChar("="));
                    var colName  = splitted[0];
                    var colValue = splitted[1];
                    var cell     = row.Value[colName];
                    if (cell == null || !cell.Value.Equals(colValue))
                    {
                        matches = false;
                        break;
                    }
                }
                if (matches)
                {
                    result.Add(row.Key, row.Value);
                }
            }
            return(result);
        }
Exemplo n.º 2
0
 public ICell Cell(string value)
 {
     return
         (Rows.Get()
          .Select(row => row.Value.FirstOrDefault(pair => pair.Value.Text.Equals(value)).Value)
          .FirstOrDefault(result => result != null));
 }
Exemplo n.º 3
0
        public Dictionary <String, Dictionary <string, ICell> > RowsTemp(params string[] colNameValues) //TODO
        {
            var result = new Dictionary <String, Dictionary <String, ICell> >();

            foreach (var row in Rows.Get())
            {
                bool matches = true;
                foreach (var colNameValue in colNameValues)
                {
                    if (!colNameValue.Matches("[^=]+=[^=]*"))
                    {
                        throw new Exception("Wrong searchCriteria for Cells: " + colNameValue);
                    }
                    String[] splitted = colNameValue.Split(Convert.ToChar("="));
                    String   colName  = splitted[0];
                    String   colValue = splitted[1];
                    ICell    cell     = row.Value[colName];
                    if (cell == null || !cell.GetValue().Equals(colValue))
                    {
                        matches = false;
                        break;
                    }
                }
                if (matches)
                {
                    result.Add(row.Key, row.Value);
                }
            }
            return(result);
        }
Exemplo n.º 4
0
        public IList <ICell> GetCells()
        {
            var rows   = Rows.Get();
            var result =
                (from columnName in Columns.Headers from rowName in Rows.Headers select rows[rowName][columnName])
                .ToList();

            if (Cache)
            {
                AllCells = result;
            }
            return(result);
        }
Exemplo n.º 5
0
 public ICell CellMatch(string regex)
 {
     return(Rows.Get().Select(row => row.Value.FirstOrDefault(pair => pair.Value.Text.Matches(regex)).Value).FirstOrDefault(result => result != null));
 }