예제 #1
0
        // Cancel an import from the user interface

        // This function will return an Import Settings object based upon the current import settings showing in the UI
        private ImportSettings ImportSettingsFromUI()
        {
            // Create a settings object
            ImportSettings importsettings = new ImportSettings();

            // Get the basic settings
            importsettings.SourceFolder = textBoxSourceFolder.Text;
            importsettings.Destination.DestinationFolderUrl   = textBoxDestinationFolderURL.Text;
            importsettings.Destination.DestinationServerUrl   = textBoxDestinationServerURL.Text;
            importsettings.Destination.DestinationWebUrl      = textBoxDestinationWebURL.Text;
            importsettings.Destination.DestinationLibraryName = textBoxDestinationLibraryName.Text;
            importsettings.LoggingToFile = checkBoxLoggingToFile.Checked;

            // Get the import type
            if (radioButtonFileSystemFolder.Checked)
            {
                importsettings.ImportType = ImportSettings.ImportTypes.FileSystemFolder;
            }

            if (radioButtonXMLDataSet.Checked)
            {
                importsettings.ImportType = ImportSettings.ImportTypes.XMLDataSet;
                importsettings.SourceFile = textBoxSourceFile.Text;
            }

            if (radioButtonCSVFile.Checked)
            {
                importsettings.ImportType = ImportSettings.ImportTypes.CSVFile;
                importsettings.SourceFile = textBoxSourceFile.Text;
            }

            // Get the authentication details
            importsettings.authenticationsettings = AuthenticationSettingsFromUI();


            // Get the mappings

            importsettings.ImportMappings = new ImportMapping[2];

            // First the file system mappings which have a dedicated UI experience for simplicity
            if (radioButtonCreatedFromFileSystem.Checked)
            {
                ImportMapping importmapping = new ImportMapping();
                importmapping.InternalName       = "Created";
                importmapping.DataColumn         = importsettings.fieldFileSystemCreated;
                importmapping.FormatType         = ImportMapping.FormatTypes.None;
                importsettings.ImportMappings[0] = importmapping;
            }
            if (radioButtonModifiedFromFileSystem.Checked)
            {
                ImportMapping importmapping = new ImportMapping();
                importmapping.InternalName       = "Modified";
                importmapping.DataColumn         = importsettings.fieldFileSystemModified;
                importmapping.FormatType         = ImportMapping.FormatTypes.None;
                importsettings.ImportMappings[1] = importmapping;
            }


            return(importsettings);
        }
예제 #2
0
        private void ImportSettingsToUI(ImportSettings importsettings)
        {
            // Basic import settings
            textBoxSourceFolder.Text           = importsettings.SourceFolder;
            textBoxDestinationFolderURL.Text   = importsettings.Destination.DestinationFolderUrl;
            textBoxDestinationServerURL.Text   = importsettings.Destination.DestinationServerUrl;
            textBoxDestinationWebURL.Text      = importsettings.Destination.DestinationWebUrl;
            textBoxDestinationLibraryName.Text = importsettings.Destination.DestinationLibraryName;
            checkBoxLoggingToFile.Checked      = importsettings.LoggingToFile;

            // Render the import type to the User Interface
            if (importsettings.ImportType == ImportSettings.ImportTypes.FileSystemFolder)
            {
                radioButtonFileSystemFolder.Checked = true;
            }

            if (importsettings.ImportType == ImportSettings.ImportTypes.XMLDataSet)
            {
                radioButtonXMLDataSet.Checked = true;
                textBoxSourceFile.Text        = importsettings.SourceFile;
            }

            if (importsettings.ImportType == ImportSettings.ImportTypes.CSVFile)
            {
                radioButtonCSVFile.Checked = true;
                textBoxSourceFile.Text     = importsettings.SourceFile;
            }

            // Render the authentication details to the UI
            if (importsettings.authenticationsettings.AuthenticationType == AuthenticationSettings.AuthenticationTypes.Current)
            {
                radioButtonAuthenticationModeCurrent.Checked = true;
                panelAuthenticationCredentials.Enabled       = false;
            }
            if (importsettings.authenticationsettings.AuthenticationType == AuthenticationSettings.AuthenticationTypes.Specified)
            {
                radioButtonAuthenticationModeSpecified.Checked = true;
                panelAuthenticationCredentials.Enabled         = true;
                textBoxAuthenticationDomain.Enabled            = true;
                textBoxAuthenticationDomain.Text   = importsettings.authenticationsettings.domain;
                textBoxAuthenticationUsername.Text = importsettings.authenticationsettings.username;
                textBoxAuthenticationPassword.Text = importsettings.authenticationsettings.password;
            }
            if (importsettings.authenticationsettings.AuthenticationType == AuthenticationSettings.AuthenticationTypes.Forms)
            {
                radioButtonAuthenticationModeForms.Checked = true;
                panelAuthenticationCredentials.Enabled     = true;
                textBoxAuthenticationDomain.Enabled        = false;
                textBoxAuthenticationUsername.Text         = importsettings.authenticationsettings.username;
                textBoxAuthenticationPassword.Text         = importsettings.authenticationsettings.password;
            }
            if (importsettings.authenticationsettings.AuthenticationType == AuthenticationSettings.AuthenticationTypes.Office365)
            {
                radioButtonAuthenticationModeOffice365.Checked = true;
                panelAuthenticationCredentials.Enabled         = true;
                textBoxAuthenticationDomain.Enabled            = false;
                textBoxAuthenticationUsername.Text             = importsettings.authenticationsettings.username;
                textBoxAuthenticationPassword.Text             = importsettings.authenticationsettings.password;
            }


            // Render the import mappings
            // First the file date and time which have a custom UI

            ImportMapping importmapping = new ImportMapping();

            importmapping.InternalName = "Created";
            importmapping.DataColumn   = importsettings.fieldFileSystemCreated;
            importmapping.FormatType   = ImportMapping.FormatTypes.None;

            if (importsettings.ImportMappings.Contains(importmapping))
            {
                radioButtonCreatedFromFileSystem.Checked = true;
            }

            importmapping.InternalName = "Modified";
            importmapping.DataColumn   = importsettings.fieldFileSystemModified;
            importmapping.FormatType   = ImportMapping.FormatTypes.None;

            if (importsettings.ImportMappings.Contains(importmapping))
            {
                radioButtonModifiedFromFileSystem.Checked = true;
            }
        }
예제 #3
0
        private void ImportSettingsToUI(ImportSettings importsettings)
        {
            // Basic import settings
            textBoxSourceFolder.Text = importsettings.SourceFolder;
            textBoxDestinationFolderURL.Text = importsettings.Destination.DestinationFolderUrl;
            textBoxDestinationServerURL.Text = importsettings.Destination.DestinationServerUrl;
            textBoxDestinationWebURL.Text = importsettings.Destination.DestinationWebUrl;
            textBoxDestinationLibraryName.Text = importsettings.Destination.DestinationLibraryName;
            checkBoxLoggingToFile.Checked = importsettings.LoggingToFile;
            
            // Render the import type to the User Interface
            if (importsettings.ImportType == ImportSettings.ImportTypes.FileSystemFolder)
            {
                radioButtonFileSystemFolder.Checked = true;
            }

            if (importsettings.ImportType == ImportSettings.ImportTypes.XMLDataSet)
            {
                radioButtonXMLDataSet.Checked = true;
                textBoxSourceFile.Text = importsettings.SourceFile;
            }

            if (importsettings.ImportType == ImportSettings.ImportTypes.CSVFile)
            {
                radioButtonCSVFile.Checked = true;
                textBoxSourceFile.Text = importsettings.SourceFile;
            }

            // Render the authentication details to the UI
            if (importsettings.authenticationsettings.AuthenticationType == AuthenticationSettings.AuthenticationTypes.Current)
            {
                radioButtonAuthenticationModeCurrent.Checked = true;
                panelAuthenticationCredentials.Enabled = false;
            }
            if (importsettings.authenticationsettings.AuthenticationType == AuthenticationSettings.AuthenticationTypes.Specified)
            {
                radioButtonAuthenticationModeSpecified.Checked = true;
                panelAuthenticationCredentials.Enabled = true;
                textBoxAuthenticationDomain.Enabled = true;
                textBoxAuthenticationDomain.Text = importsettings.authenticationsettings.domain;
                textBoxAuthenticationUsername.Text = importsettings.authenticationsettings.username;
                textBoxAuthenticationPassword.Text = importsettings.authenticationsettings.password;
            }
            if (importsettings.authenticationsettings.AuthenticationType == AuthenticationSettings.AuthenticationTypes.Forms)
            {
                radioButtonAuthenticationModeForms.Checked = true;
                panelAuthenticationCredentials.Enabled = true;
                textBoxAuthenticationDomain.Enabled = false;
                textBoxAuthenticationUsername.Text = importsettings.authenticationsettings.username;
                textBoxAuthenticationPassword.Text = importsettings.authenticationsettings.password;
            }
            if (importsettings.authenticationsettings.AuthenticationType == AuthenticationSettings.AuthenticationTypes.Office365)
            {
                radioButtonAuthenticationModeOffice365.Checked = true;
                panelAuthenticationCredentials.Enabled = true;
                textBoxAuthenticationDomain.Enabled = false;
                textBoxAuthenticationUsername.Text = importsettings.authenticationsettings.username;
                textBoxAuthenticationPassword.Text = importsettings.authenticationsettings.password;
            }
            

            // Render the import mappings
            // First the file date and time which have a custom UI

            ImportMapping importmapping = new ImportMapping();
            importmapping.InternalName = "Created";
            importmapping.DataColumn = importsettings.fieldFileSystemCreated;
            importmapping.FormatType = ImportMapping.FormatTypes.None;

            if (importsettings.ImportMappings.Contains(importmapping))
            {
                radioButtonCreatedFromFileSystem.Checked = true;
            }

            importmapping.InternalName = "Modified";
            importmapping.DataColumn = importsettings.fieldFileSystemModified;
            importmapping.FormatType = ImportMapping.FormatTypes.None;

            if (importsettings.ImportMappings.Contains(importmapping))
            {
                radioButtonModifiedFromFileSystem.Checked = true;
            }

           
        }
예제 #4
0
        // Cancel an import from the user interface

        // This function will return an Import Settings object based upon the current import settings showing in the UI
        private ImportSettings ImportSettingsFromUI()
        {
            // Create a settings object
            ImportSettings importsettings = new ImportSettings();

            // Get the basic settings
            importsettings.SourceFolder = textBoxSourceFolder.Text;
            importsettings.Destination.DestinationFolderUrl = textBoxDestinationFolderURL.Text;
            importsettings.Destination.DestinationServerUrl = textBoxDestinationServerURL.Text;
            importsettings.Destination.DestinationWebUrl = textBoxDestinationWebURL.Text;
            importsettings.Destination.DestinationLibraryName = textBoxDestinationLibraryName.Text;
            importsettings.LoggingToFile = checkBoxLoggingToFile.Checked;
            
            // Get the import type
            if (radioButtonFileSystemFolder.Checked)
            {
                importsettings.ImportType = ImportSettings.ImportTypes.FileSystemFolder;
            }
            
            if (radioButtonXMLDataSet.Checked)
            {
                importsettings.ImportType = ImportSettings.ImportTypes.XMLDataSet;
                importsettings.SourceFile = textBoxSourceFile.Text;
            }

            if (radioButtonCSVFile.Checked)
            {
                importsettings.ImportType = ImportSettings.ImportTypes.CSVFile;
                importsettings.SourceFile = textBoxSourceFile.Text;
            }

            // Get the authentication details
            importsettings.authenticationsettings = AuthenticationSettingsFromUI();


            // Get the mappings

            importsettings.ImportMappings = new ImportMapping[2];

            // First the file system mappings which have a dedicated UI experience for simplicity
            if (radioButtonCreatedFromFileSystem.Checked)
            {
                ImportMapping importmapping = new ImportMapping();
                importmapping.InternalName = "Created";
                importmapping.DataColumn = importsettings.fieldFileSystemCreated;
                importmapping.FormatType = ImportMapping.FormatTypes.None;
                importsettings.ImportMappings[0] = importmapping;
            }
            if (radioButtonModifiedFromFileSystem.Checked)
            {
                ImportMapping importmapping = new ImportMapping();
                importmapping.InternalName = "Modified";
                importmapping.DataColumn = importsettings.fieldFileSystemModified;
                importmapping.FormatType = ImportMapping.FormatTypes.None;
                importsettings.ImportMappings[1] = importmapping;
            }


            return importsettings;
        }