Beispiel #1
0
        public ExcelImportWizard(XPObjectSpace objectSpace, ITypeInfo typeInfo, CollectionSourceBase collectionSourceBase)
        {
            //set local variable values
            if (objectSpace == null)
            {
                throw new ArgumentNullException("objectSpace", Resources.ExcelImportWizard_ExcelImportWizard_ObjectSpace_cannot_be_NULL);
            }

            ObjectSpace             = objectSpace;
            CurrentCollectionSource = collectionSourceBase;

            Type = typeInfo.Type;

            InitializeComponent();

            ImportMapLookUp.Properties.DataSource = ImportMapsCollection.ToList();

            //disable next, until file and other info is selected
            welcomeWizardPage1.AllowNext = false;
            wizardPage1.AllowNext        = false;



            gridLookUpEdit1.Properties.View.OptionsBehavior.AutoPopulateColumns = true;
            gridLookUpEdit1.Properties.DataSource = MappableColumns;

            //var col = gridLookUpEdit2View.Columns.ColumnByFieldName("Mapped");
            //if (col != null) {
            //    col.Visible = false;
            //    col.FilterInfo =
            //        new ColumnFilterInfo(new BinaryOperator("Mapped", false));

            //}

            var mappablePropertyClassInfo
                = objectSpace.Session.GetClassInfo(typeof(MappableProperty));


            foreach (GridColumn column in gridLookUpEdit2View.Columns)
            {
                column.Caption = mappablePropertyClassInfo
                                 .GetMember(column.FieldName).DisplayName;
                if (column.FieldName == "Mapped")
                {
                    column.Visible = false;
                }
            }

            //col = gridLookUpEdit2View.Columns.ColumnByFieldName("Oid");
            //if (col != null)
            //    col.Visible = false;
        }
Beispiel #2
0
        public ExcelImportWizard(XPObjectSpace objectSpace, ITypeInfo typeInfo, CollectionSourceBase collectionSourceBase, XafApplication application,
                                 ExcelImportWizardStringToPropertyMap propertyValueMapper = null)
        {
            _application         = application;
            _propertyValueMapper = propertyValueMapper ?? new StringValueMapper().MapValueToObjectProperty;
            //set local variable values
            if (objectSpace == null)
            {
                throw new ArgumentNullException("objectSpace", Resources.ExcelImportWizard_ExcelImportWizard_ObjectSpace_cannot_be_NULL);
            }

            ObjectSpace             = objectSpace;
            CurrentCollectionSource = collectionSourceBase;

            Type = typeInfo.Type;

            InitializeComponent();

            ImportMapLookUp.Properties.DataSource = ImportMapsCollection.ToList();

            //disable next, until file and other info is selected
            welcomeWizardPage1.AllowNext = false;
            wizardPage1.AllowNext        = false;



            gridLookUpEdit1.Properties.View.OptionsBehavior.AutoPopulateColumns = true;
            gridLookUpEdit1.Properties.DataSource = MappableColumns;


            var mappablePropertyClassInfo
                = objectSpace.Session.GetClassInfo(typeof(MappableProperty));


            foreach (GridColumn column in gridLookUpEdit2View.Columns)
            {
                column.Caption = mappablePropertyClassInfo
                                 .GetMember(column.FieldName).DisplayName;
                if (column.FieldName == @"Mapped")
                {
                    column.Visible = false;
                }
            }
        }