コード例 #1
0
        private void DisplayEmptyMappingList()
        {
            MappingSettingList = new ObservableCollection <ListBoxPair>();
            for (int idx = 0; idx < SampleHeaderRow.Count(); idx++)
            {
                ListBoxPair item = new ListBoxPair(((idx + 1) * -1).ToString(), "-");
                MappingSettingList.Add(item);
            }

            SetMappingList();
        }
コード例 #2
0
        private void MappingListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!InScroll)
            {
                InScroll = true;
                SampleContentList.SelectedIndex = MappingListBox.SelectedIndex;
                SelectedMappingItem             = (ListBoxPair)MappingListBox.SelectedItem;

                ScrollViewerSampleContentList.ScrollToVerticalOffset(ScrollViewerMapping.VerticalOffset);
                InScroll = false;
            }
        }
コード例 #3
0
        private void DisplaySampleFile()
        {
            List <ListBoxPair> itemSource = new List <ListBoxPair>();

            for (int idx = 0; idx < SampleHeaderRow.Count(); idx++)
            {
                ListBoxPair item = new ListBoxPair((idx + 1).ToString(), string.Format("{0} ({1})", SampleHeaderRow[idx], SampleDataRow[idx]));
                itemSource.Add(item);
            }

            SampleContentList.ItemsSource       = itemSource;
            SampleContentList.DisplayMemberPath = "Value";
            SampleContentList.SelectedValuePath = "Key";
        }
コード例 #4
0
        private void SetFilterFieldNames()
        {
            List <ListBoxPair> itemSource = new List <ListBoxPair>();

            foreach (string fieldName in SampleHeaderRow)
            {
                ListBoxPair item = new ListBoxPair(fieldName, fieldName);
                itemSource.Add(item);
            }

            filterFieldNames.ItemsSource       = itemSource;
            filterFieldNames.DisplayMemberPath = "Value";
            filterFieldNames.SelectedValuePath = "Key";
        }
コード例 #5
0
        private void ReturnMappingItemToDefinitionList()
        {
            // definiton item keys start with an identifier string, dummys are -ve numbers
            int  tempVal     = 0;
            bool isDummyItem = int.TryParse(SelectedMappingItem.Key, out tempVal);

            if (MappingListBox.SelectedIndex != -1 && !isDummyItem)
            {
                // mapping item selected and it is a definition item
                // create dummy mapping item
                ListBoxPair item = (ListBoxPair)SampleContentList.SelectedItem;
                item.Value = "-";
                item.Key   = (Convert.ToInt32(item.Key) * -1).ToString();
                DefinitionFields.Add(SelectedMappingItem);
                MappingSettingList[MappingListBox.SelectedIndex] = item;

                MappingListBox.Items.Refresh();
                DefinitionListBox.Items.Refresh();
            }
        }
コード例 #6
0
        private void DisplayCurrentFilterList()
        {
            List <ListBoxPair> itemSource = new List <ListBoxPair>();

            foreach (var item in MappingFilterList)
            {
                string tempItem = String.Format("{0}: {1} for field '{2}'; match is {3}",
                                                item.FilterName, item.FilterType.ToString(), item.FieldToMatch, item.FilterMatchType);
                if (item.MatchingValue != string.Empty)
                {
                    tempItem += " against '" + item.MatchingValue + "'";
                }

                ListBoxPair listItem = new ListBoxPair(item.FilterName, tempItem);
                itemSource.Add(listItem);
            }

            currentFiltersListbox.ItemsSource       = itemSource;
            currentFiltersListbox.DisplayMemberPath = "Value";
            currentFiltersListbox.SelectedValuePath = "Key";
        }
コード例 #7
0
        private void SetupExistingMapping()
        {
            //  load from file
            if (MappingFileList.SelectedIndex < 1)
            {
                MessageBox.Show("No mapping selected");
                return;
            }
            MappingDefinition mappingDefinition = CSVConvertorFileManagement.ReadMappingFile(((ListBoxPair)MappingFileList.SelectedItem).Value, CSVAppFolderMapping, ".xml");

            // file/combo settings
            MappingNameTextBox.Text          = ((ListBoxPair)MappingFileList.SelectedItem).Value;
            DefinitionFileList.SelectedValue = mappingDefinition.DefinitionFile;

            LoadMiddlewareDefinition(mappingDefinition.DefinitionFile);
            MappingSettingList = new ObservableCollection <ListBoxPair>();
            ListBoxPair listBoxPair               = new ListBoxPair();
            int         mappingFieldID            = 0;
            string      middlewareFieldIdentifier = string.Empty;

            SampleHeaderRow = new List <string>();
            SampleDataRow   = new List <string>();

            foreach (MappingField mappingField in mappingDefinition.MappingFields)
            {
                int idx = mappingField.SampleID;
                //  set sample value and restore Sample and Header arrays
                SampleHeaderRow.Add(mappingField.SampleField);
                SampleDataRow.Add(mappingField.SampleValue);


                middlewareFieldIdentifier = mappingField.MiddlewareFieldIdentifier;

                listBoxPair = new ListBoxPair();
                if (Int32.TryParse(mappingField.MiddlewareFieldIdentifier, out mappingFieldID))
                {
                    //  convention is that unset mapping has negative integer ID
                    // if mapping set then delete from DefintionFields and Add to MappingFields
                    listBoxPair = new ListBoxPair(((idx + 1) * -1).ToString(), "-");
                }
                else
                {
                    // or set actual mapping and remove from definition list
                    listBoxPair = DefinitionFields.FirstOrDefault(x => x.Key == middlewareFieldIdentifier);
                    DefinitionFields.Remove(listBoxPair);
                }
                MappingSettingList.Add(listBoxPair);
            }


            SetDefinitionListBox();
            SetMappingList();
            ClearFilterSettings();
            DisplaySampleFile();
            SetFilterFieldNames();

            CompanyNameTextBox.Text = mappingDefinition.CompanyName;
            MappingFilterList       = mappingDefinition.MappingFilters;

            checkBoxLevel2.IsChecked    = mappingDefinition.RequiresLevel2File;
            checkBoxOptOut.IsChecked    = mappingDefinition.RequiresOptOutFile;
            checkBoxErrorFile.IsChecked = mappingDefinition.CanHaveErrorFile;

            DisplayCurrentFilterList();

            SetScrollViewer();
        }
コード例 #8
0
 private void DefinitionListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     SelectedDefinitionItem = (ListBoxPair)DefinitionListBox.SelectedItem;
 }