예제 #1
0
        protected virtual object GetFieldOrPropertyValue(object rowObject, string name)
        {
            var rowValue = FormatterUtils.GetFieldOrPropertyValue(rowObject, name);

            if (rowValue is DateTimeOffset)
            {
                return(FormatterUtils.ConvertFromDateTimeOffset((DateTimeOffset)rowValue));
            }

            else if (rowObject is Dictionary <string, object> )
            {
                return((rowObject as Dictionary <string, object>)[name]);
            }

            else if (FormatterUtils.IsExcelSupportedType(rowValue))
            {
                return(rowValue);
            }

            else if ((rowValue is IEnumerable <object>))
            {
                return(rowValue);
            }
            // return string.Join(",", rowValue as IEnumerable<object>);

            return(rowValue == null || DBNull.Value.Equals(rowValue)
                ? string.Empty
                : rowValue.ToString());
        }