private void FillColumnValueMappings(ExcelImportColumn column, XElement columnElement)
        {
            var mappingElements = columnElement.Descendants("mapping");

            foreach (var mappingElement in mappingElements)
            {
                var key   = mappingElement.Attribute("key").Value;
                var value = mappingElement.Attribute("value").Value;
                column.AddMappingValue(Convert.ChangeType(key, column.DataType), Convert.ChangeType(value, column.ValueType));
            }
        }
        private List <ExcelImportColumn> GetDataColumns(XElement dataElement, Type entityType)
        {
            var columns        = new List <ExcelImportColumn>();
            var columnElements = dataElement.Elements("column");
            ExcelImportColumn column;

            foreach (var e in columnElements)
            {
                column              = new ExcelImportColumn();
                column.Name         = e.Attribute("name").Value;
                column.PropertyInfo = entityType.GetProperty(e.Attribute("property").Value);
                column.Col          = int.Parse(e.Attribute("col").Value);
                column.DataType     = Type.GetType(e.Attribute("type").Value);

                if (e.Attribute("required") != null)
                {
                    column.Required = bool.Parse(e.Attribute("required").Value);
                }
                if (e.Attribute("maxlength") != null)
                {
                    column.MaxLength = int.Parse(e.Attribute("maxlength").Value);
                }
                if (e.Attribute("regexp") != null)
                {
                    column.Regexp = e.Attribute("regexp").Value;
                }
                if (e.Attribute("valuemapping") != null)
                {
                    column.ValueMapping = bool.Parse(e.Attribute("valuemapping").Value);
                    if (column.ValueMapping)
                    {
                        column.ValueType = Type.GetType(e.Attribute("valuetype").Value);
                        column.InitValueMapping();
                        FillColumnValueMappings(column, e);
                    }
                }

                columns.Add(column);
            }

            return(columns);
        }