Example #1
0
        private IEnumerable <string> GetHeadersFor(MappingInfo item)
        {
            var result = new List <string>();

            if (item.IsDynamicRange == false)
            {
                result.Add(item.ColumnName);
            }
            else
            {
                result.AddRange(item.DynamicColumnNames);
            }
            return(result);
        }
Example #2
0
        private IEnumerable <object> GetDynamicValues(MappingInfo mappingInfo, T dataObject)
        {
            List <object> result = new List <object>();
            IEnumerable   values = dataObject.GetType().GetProperty(mappingInfo.PropertyName).GetValue(dataObject, null) as IEnumerable;

            if (values != null)
            {
                foreach (object element in values)
                {
                    result.Add(element);
                }
            }
            return(result);
        }
Example #3
0
 private object GetValue(MappingInfo mappingInfo, T dataObject)
 {
     if (mappingInfo.Type == typeof(Guid) || mappingInfo.Type == typeof(Guid?))
     {
         var value = dataObject.GetType().GetProperty(mappingInfo.PropertyName).GetValue(dataObject, null);
         if (value == null)
         {
             return(string.Empty);
         }
         else
         {
             return(value.ToString());
         }
     }
     else
     {
         return(dataObject.GetType().GetProperty(mappingInfo.PropertyName).GetValue(dataObject, null));
     }
 }