Exemplo n.º 1
0
        private void CreateDatabaseButton_Click(object sender, RoutedEventArgs e)
        {
            SaveSettings();
            bool geography;

            if (geographyMode.IsChecked != null)
            {
                geography = (bool)geographyMode.IsChecked;
            }
            else
            {
                geography = false;
            }
            int srid = ParseSRID(geography);

            if (srid != 0)
            {
                try
                {
                    myUploader = new MapUploader(BuildConnectionString());
                    Binding b = new Binding();
                    b.Source = myUploader;
                    b.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
                    b.Path = new PropertyPath("Progress");
                    resultTextBox.SetBinding(TextBlock.TextProperty, b);
                    myUploader.Upload(columnNameBox.Text, KMLFileLocationBox.Text, tableBox.Text, srid, geography);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("The process failed with the following error. See the log for details: \r\n\r\n "
                                    + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
Exemplo n.º 2
0
        private void CreateDatabaseButton_Click(object sender, RoutedEventArgs e)
        {
            MapUploader myUploader;
            bool        geography;

            if (geographyMode.IsChecked != null)
            {
                geography = (bool)geographyMode.IsChecked;
            }
            else
            {
                geography = false;
            }
            int srid = parseSRID();

            if (srid != 0)
            {
                try
                {
                    myUploader      = new MapUploader(serverNameBox.Text, databaseNameBox.Text, userNameBox.Text, passwordBox.Password, columnNameBox.Text, KMLFileLocationBox.Text, tableBox.Text, int.Parse(sridBox.Text), geography, resultText);
                    resultText.Text = "Working...";
                    myUploader.Upload();
                }
                catch (Exception ex)
                {
                    resultText.Text = "Error: " + ex.ToString();
                }
            }
        }
Exemplo n.º 3
0
 public void InitializeTests()
 {
     _userInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInfo>(_settingsText);
     connectionString = "Data Source=" + _userInfo.Server + ";Initial Catalog=" + _userInfo.Database +
                        ";Persist Security Info=True;User ID="
                        + _userInfo.Username + ";Password=" + _userInfo.Password;
     myUploader = new MapUploader(connectionString);
 }
Exemplo n.º 4
0
        private void CreateDatabaseButton_Click(object sender, RoutedEventArgs e)
        {
            log = new StringBuilder();
            SaveSettings();
            logFile = String.Format("{0}\\KML2SQL_Log_{1:yyyy-MM-dd-hhmmss-fff}.txt", logFolder, DateTime.Now);
            bool geography;

            if (geographyMode.IsChecked != null)
            {
                geography = (bool)geographyMode.IsChecked;
            }
            else
            {
                geography = false;
            }
            int srid = ParseSRID(geography);

            if (srid != 0)
            {
                try
                {
                    myUploader = new MapUploader(BuildConnectionString(), columnNameBox.Text, KMLFileLocationBox.Text,
                                                 tableBox.Text, srid, geography, log, logFile);
                    Binding b = new Binding();
                    b.Source = myUploader;
                    b.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
                    b.Path = new PropertyPath("Progress");
                    resultTextBox.SetBinding(TextBlock.TextProperty, b);
                    myUploader.Upload();
                }
                catch (Exception ex)
                {
                    resultTextBox.Text = "Error: " + ex.ToString();
                    log.Append(ex.ToString() + Environment.NewLine);
                }
                finally
                {
                    using (var writer = new StreamWriter(logFile, true))
                    {
                        if (log != null)
                        {
                            writer.Write(log);
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
 private void CreateDatabaseButton_Click(object sender, RoutedEventArgs e)
 {
     MapUploader myUploader;
     bool geography;
     if (geographyMode.IsChecked != null)
         geography = (bool)geographyMode.IsChecked;
     else
         geography = false;
     int srid = parseSRID();
     if (srid != 0)
     {
         try
         {
             myUploader = new MapUploader(serverNameBox.Text, databaseNameBox.Text, userNameBox.Text, passwordBox.Password, columnNameBox.Text, KMLFileLocationBox.Text, tableBox.Text, int.Parse(sridBox.Text), geography, resultText);
             resultText.Text = "Working...";
             myUploader.Upload();
         }
         catch (Exception ex)
         {
             resultText.Text = "Error: " + ex.ToString();
         }
     }
 }
Exemplo n.º 6
0
 private void CreateDatabaseButton_Click(object sender, RoutedEventArgs e)
 {
     SaveSettings();
     bool geography;
     if (geographyMode.IsChecked != null)
         geography = (bool)geographyMode.IsChecked;
     else
         geography = false;
     int srid = ParseSRID(geography);
     if (srid != 0)
     {
         try
         {
             myUploader = new MapUploader(BuildConnectionString());
             Binding b = new Binding();
             b.Source = myUploader;
             b.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
             b.Path = new PropertyPath("Progress");
             resultTextBox.SetBinding(TextBlock.TextProperty, b);
             myUploader.Upload(columnNameBox.Text, KMLFileLocationBox.Text, tableBox.Text, srid, geography);
         }
         catch (Exception ex)
         {
             MessageBox.Show("The process failed with the following error. See the log for details: \r\n\r\n "
                 + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
 }