Exemplo n.º 1
0
        private void SetupDefinitionList()
        {
            if (DefinitionFileList.SelectedIndex > 0)
            {
                DefinitionFileNameTextBox.Text = ((ListBoxPair)DefinitionFileList.SelectedItem).Value;
                //  load from file
                DefinitionFields = new ObservableCollection <MiddlewareField>(CSVConvertorFileManagement.ReadDefinitionFile(DefinitionFileNameTextBox.Text, CSVAppFolderOptions, ".xml"));
            }
            else
            {
                DefinitionFileNameTextBox.Text = string.Empty;
                DefinitionFields = new ObservableCollection <MiddlewareField>();
            }

            definitionListBox.ItemsSource       = DefinitionFields;
            definitionListBox.DisplayMemberPath = "Description";
            definitionListBox.SelectedValuePath = "MiddlewareFieldID";


            //  if clicked then either new or already loaded
            //  so enable edit panels
            FieldListPanel.IsEnabled        = true;
            FieldListButtonsPanel.IsEnabled = true;
            SetEditButtonsToDefaultState();
        }
Exemplo n.º 2
0
        private void LoadMiddlewareDefinition(string definitionFile)
        {
            List <MiddlewareField> middlewareFields = CSVConvertorFileManagement.ReadDefinitionFile(definitionFile, CSVAppFolderMapping, ".xml");

            DefinitionFields = new ObservableCollection <ListBoxPair>(middlewareFields.Select(x => new ListBoxPair {
                Key = x.MiddlewareFieldIdentifier, Value = x.Description
            }));
        }
        private int ConvertCSVFile(string csvFileName, bool firstRowHasHeaders)
        {
            // initialise
            DefinitionFields = CSVConvertorFileManagement.ReadDefinitionFile(CurrentMappingDefinition.DefinitionFile, CSVAppFolder, ".xml");
            MappingFilters   = CurrentMappingDefinition.MappingFilters;

            // load CSV file
            if (!LoadCSVPayrollFile(csvFileName, firstRowHasHeaders))
            {
                return(-1);
            }

            CSVDataOut = new List <List <string> >();

            MakeHeaderRow();
            string excludeField = Properties.Settings.Default.Level2ExcludeField;

            MakeCSVBody(excludeField);

            return(WriteCSVFile());
        }