Beispiel #1
0
        public static void Validate(HeaderNames names)
        {
            var properties = names.GetType().GetProperties();

            foreach (var property in properties)
            {
                var value = property.GetValue(names, new object[] { });
                if (value == null || string.IsNullOrEmpty(value.ToString().Trim()) == true)
                {
                    throw new JsonHeaderNameEmptyException(property.Name);
                }
            }
        }
Beispiel #2
0
        private void ValidateHeaders(DataTable dataTable, HeaderNames names)
        {
            var properties = names.GetType().GetProperties();

            foreach (var property in properties)
            {
                var name     = property.GetValue(names, new object[] { }).ToString();
                var findName = dataTable.Rows[0].ItemArray.FirstOrDefault(i => i.Equals(name) == true);
                if (findName == null)
                {
                    throw new ColumnMissingException(name);
                }
            }
        }