Beispiel #1
0
        protected void GetCheckBoxSelectedItems(List <string> selecteditems)
        {
            lblGrid.Visible = true;
            lblGrid.Text    = "<b>Field Mappings </b>" + "  "
                              + "<i>(Please select the mappings for the mandatory fields marked in bold)</i>";

            var allFields = new List <Tuple <string, string> >();

            foreach (var selectedText in selecteditems)
            {
                switch (selectedText)
                {
                case "Taxonomy":
                    var taxIW             = new TaxonomyImportWorker();
                    var requiredTaxFields =
                        (from p in taxIW.GetRequiredFields() select Tuple.Create(p, "Required")).ToList();
                    RequiredFields.AddRange(requiredTaxFields);
                    var optionalTaxFields =
                        (from p in taxIW.GetOptionalFields() select Tuple.Create(p, "Optional")).ToList();
                    var taxImports = (requiredTaxFields).Union(optionalTaxFields).ToList();
                    allFields.AddRange(taxImports);
                    break;

                case "Taxonomy Meta Data":
                    var taxMdIW = new TaxonomyMetaDataImportWorker();
                    var requiredTaxMetaFields =
                        (from p in taxMdIW.GetRequiredFields() select Tuple.Create(p, "Required")).ToList();
                    RequiredFields.AddRange(requiredTaxMetaFields);

                    var optionalTaxMetaFields =
                        (from p in taxMdIW.GetOptionalFields() select Tuple.Create(p, "Optional")).ToList();

                    var taxMdImports = (requiredTaxMetaFields).Union(optionalTaxMetaFields).ToList();
                    allFields.AddRange(taxMdImports);
                    break;

                case "SKUTaxonomy":
                    var skutaxIW             = new SKUTaxonomyImportWorker();
                    var requiredSkuTaxFields =
                        (from p in skutaxIW.GetRequiredFields() select Tuple.Create(p, "Required")).ToList();
                    RequiredFields.AddRange(requiredSkuTaxFields);
                    var optionalskuTaxFields =
                        (from p in skutaxIW.GetOptionalFields() select Tuple.Create(p, "Optional")).ToList();
                    var skutaxImports = (requiredSkuTaxFields).Union(optionalskuTaxFields).ToList();
                    allFields.AddRange(skutaxImports);
                    break;

                case "Attribute":
                    var attrIW             = new AttributeImportWorker();
                    var requiredAttrFields =
                        (from p in attrIW.GetRequiredFields() select Tuple.Create(p, "Required")).ToList();
                    RequiredFields.AddRange(requiredAttrFields);
                    var optionalAttrFields =
                        (from p in attrIW.GetOptionalFields() select Tuple.Create(p, "Optional")).ToList();
                    var attrImports = (requiredAttrFields).Union(optionalAttrFields).ToList();
                    allFields.AddRange(attrImports);
                    break;

                case "Schema":
                    var schemaIW             = new SchemaImportWorker();
                    var requiredSchemaValues = new List <string>();
                    var requiredSchemaFields =
                        (from p in schemaIW.GetRequiredFields() select Tuple.Create(p, "Required")).ToList();
                    RequiredFields.AddRange(requiredSchemaFields);
                    var optionalschemaFields =
                        (from p in schemaIW.GetOptionalFields() select Tuple.Create(p, "Optional")).ToList();
                    var schemaImports = (requiredSchemaFields).Union(optionalschemaFields).ToList();
                    allFields.AddRange(schemaImports);
                    break;

                case "Schema Meta Data":
                    var schemametaIW             = new SchemaMetaDataImportWorker();
                    var requiredSchemaMetaFields =
                        (from p in schemametaIW.GetRequiredFields() select Tuple.Create(p, "Required")).ToList();
                    RequiredFields.AddRange(requiredSchemaMetaFields);
                    var optionalschemaMetaFields =
                        (from p in schemametaIW.GetOptionalFields() select Tuple.Create(p, "Optional")).ToList();
                    var schemaMetaImports = (requiredSchemaMetaFields).Union(optionalschemaMetaFields).ToList();
                    allFields.AddRange(schemaMetaImports);
                    break;

                case "Sku Attribute Value":
                    var skuattrIW             = new SkuAttributeValueImportWorker();
                    var requiredSkuAttrFields =
                        (from p in skuattrIW.GetRequiredFields() select Tuple.Create(p, "Required")).ToList();
                    RequiredFields.AddRange(requiredSkuAttrFields);
                    var optionalskuAttrFields =
                        (from p in skuattrIW.GetOptionalFields() select Tuple.Create(p, "Optional")).ToList();
                    var SkuattrImports = (requiredSkuAttrFields).Union(optionalskuAttrFields).ToList();
                    allFields.AddRange(SkuattrImports);
                    break;

                case "Derived Attribute":
                    var derattrIW             = new DerivedAttributeImportWorker();
                    var requiredDerAttrFields =
                        (from p in derattrIW.GetRequiredFields() select Tuple.Create(p, "Required")).ToList();
                    RequiredFields.AddRange(requiredDerAttrFields);
                    var optionalderAttrFields =
                        (from p in derattrIW.GetOptionalFields() select Tuple.Create(p, "Optional")).ToList();
                    var derattrImports = (requiredDerAttrFields).Union(optionalderAttrFields).ToList();
                    allFields.AddRange(derattrImports);
                    break;

                case "List Of Values":
                    var lovIW             = new ListOfValuesImportWorker();
                    var requiredLovFields =
                        (from p in lovIW.GetRequiredFields() select Tuple.Create(p, "Required")).ToList();
                    RequiredFields.AddRange(requiredLovFields);
                    var optionalLovFields =
                        (from p in lovIW.GetOptionalFields() select Tuple.Create(p, "Optional")).ToList();
                    ;
                    var lovImports = (requiredLovFields).Union(optionalLovFields).ToList();
                    allFields.AddRange(lovImports);
                    break;
                }

                gv_Fields.DataSource =
                    (from p in allFields.OrderByDescending(item => item.Item2) select new { MappingFields = p.Item1 })
                    .ToList().Distinct();
                gv_Fields.DataBind();
            }
            PopulateImportOptions();
        }