public void AddNewMapping(List <FieldMappings.BCMField> bcmFields, List <FieldMappings.OCMField> ocmFields)
        {
            FieldMapping fieldMapping = new FieldMapping();

            FieldMapperWrapper.AddNewMapping(ref fieldMapping, bcmFields, ocmFields, NumberOfFieldMappingControls, this, flowLayoutPanel1);
            fieldMapping.DestinationFieldChanged += fieldMapping_DestinationFieldChanged;
            fieldMapping.SourceFieldChanged      += fieldMapping_SourceFieldChanged;
            fieldMapping.MappingRemoved          += fieldMapping_MappingRemoved;

            NumberOfFieldMappingControls += 1;
            OnFieldMappingAdded();
        }
        public void AddNewMapping(List <FieldMappings.BCMField> bcmFields, List <FieldMappings.OCMField> ocmFields)
        {
            FieldMapping fieldMapping = new FieldMapping();

            FieldMapperWrapper.AddNewMapping(ref fieldMapping, bcmFields, ocmFields, NumberOfFieldMappingControls, this, flowLayoutPanel1);
            //fieldMapping.Name = String.Format("fieldMappingControl{0}", NumberOfFieldMappingControls);
            //fieldMapping.SetSourceFields(bcmFields);
            //fieldMapping.SetDestinationFields(ocmFields);
            fieldMapping.DestinationFieldChanged += fieldMapping_DestinationFieldChanged;
            fieldMapping.SourceFieldChanged      += fieldMapping_SourceFieldChanged;
            fieldMapping.MappingRemoved          += fieldMapping_MappingRemoved;
            //fieldMapping.Size = new System.Drawing.Size(493, 31);
            //this.SuspendLayout();
            //flowLayoutPanel1.Controls.Add(fieldMapping);
            //this.ResumeLayout(false);
            //this.PerformLayout();
            //Invalidate();
            NumberOfFieldMappingControls += 1;
            OnFieldMappingAdded();
        }
        public bool ValidateFields()
        {
            foreach (Control c in flowLayoutPanel1.Controls)
            {
                if (c.GetType() == typeof(FieldMapping))
                {
                    FieldMapping fm = (FieldMapping)c;
                    //ignore default unmapped fields
                    if (fm.DestinationField == null && fm.SourceField == null)
                    {
                        continue;
                    }
                    if (fm.Invalid || fm.DestinationField == null || fm.SourceField == null || fm.SourceField?.OCMFieldMapping == null)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }