Example #1
0
        private static int GetRecordIndex <T>(XlsxRecordIndexes indexes, string key, T value)
        {
            var ids = GetRecordIndexes(indexes, key, value);

            if (ids == null)
            {
                return(-1);
            }

            return(ids.Count > 0 ? ids[0] : -1);
        }
Example #2
0
        private static int GetRecordIndex <T1, T2>(XlsxRecordIndexes indexes, string key1, T1 value1, string key2, T2 value2)
        {
            var ids = GetRecordIndexes(indexes, key1, value1, key2, value2);

            if (ids == null)
            {
                return(-1);
            }

            return(ids.Count > 0 ? ids[0] : -1);
        }
Example #3
0
        private static IList <int> GetRecordIndexes <T>(XlsxRecordIndexes indexes, string key, T value)
        {
            if (!indexes.Values.TryGetValue(key, out var values))
            {
                throw new KeyNotFoundException("No key defined in sheet: " + key);
            }

            if (values.Values.TryGetValue(value.ToString(), out var ids))
            {
                return(ids.Values);
            }

            return(null);
        }
Example #4
0
        private static IList <int> GetRecordIndexes <T1, T2>(XlsxRecordIndexes indexes, string key1, T1 value1, string key2, T2 value2)
        {
            var keyHash = $"{key1}-{key2}";

            if (!indexes.Values.TryGetValue(keyHash, out var values))
            {
                throw new KeyNotFoundException("No key defined in sheet: " + keyHash);
            }

            var valueHash = $"{value1.ToString()}-{value2.ToString()}";

            if (values.Values.TryGetValue(valueHash, out var ids))
            {
                return(ids.Values);
            }

            return(null);
        }