public FillDB(DbToXml dbToXml, string login, string password)
 {
     Login      = login;
     Password   = password;
     connection = new OracleConnection
     {
         ConnectionString = "User Id=" + login.ToLower() + ";Password="******"; Data Source = (DESCRIPTION = " +
                            " (ADDRESS = (PROTOCOL = TCP)(HOST = 217.173.198.135)(PORT = 1522    ))" +
                            " (CONNECT_DATA =" +
                            " (SERVER = DEDICATED)" +
                            " (SERVICE_NAME = orcltp.iaii.local)" +
                            ")" +
                            ");"
     };
     sequence = SequenceValidator.setOrder(dbToXml.tables, dbToXml.foreignKeys);
     try
     {
         connection.Open();
         DeleteDb(dbToXml.tables);
         CreateTables(dbToXml.tables);
         CreatePrimaryKeys(dbToXml.primaryKeys);
         CreateForeignKeys(dbToXml.foreignKeys);
         InsertData(dbToXml.tables, dbToXml.dataFromTables);
         connection.Close();
     }
     catch
     {
         throw new System.ArgumentException("Bad loginor password");
     }
 }
        private async void ExportXmlToDB_Click(object sender, RoutedEventArgs e)
        {
            string filename = "";

            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();


            dlg.DefaultExt = ".xml";
            dlg.Filter     = "Xml Files (*.xml)|*.xml|JSON Files (*.json)|*.json";
            bool correctFile = true;

            Nullable <bool> result = dlg.ShowDialog();

            if (result == true)
            {
                var extension = System.IO.Path.GetExtension(dlg.FileName);
                switch (extension.ToLower())
                {
                case ".xml":
                    filename = dlg.FileName;
                    try
                    {
                        t = DeserializeObject(filename);
                    }
                    catch
                    {
                        correctFile = false;
                    }

                    break;

                case ".json":
                    using (FileStream fs = File.OpenRead(dlg.FileName))
                    {
                        t = await JsonSerializer.DeserializeAsync <DbToXml>(fs);
                    }
                    break;
                }
                if (correctFile && t.dataFromTables != null && t.foreignKeys != null && t.primaryKeys != null && t.tables != null)
                {
                    login                   = Login.Text;
                    password                = Passowrd.Password;
                    Login.IsEnabled         = false;
                    Passowrd.IsEnabled      = false;
                    CreateXml.IsEnabled     = false;
                    ExportXmlToDB.IsEnabled = false;
                    Comunicate.Content      = "Trwa odtwarzenie bazy z pliku xml...";
                    try
                    {
                        await Task.Run(() => Upload());

                        MessageBox.Show("Pomyślnie dodano", "Succes");
                    }
                    catch
                    {
                        MessageBox.Show("zły login lub hasło", "Error");
                    }

                    Comunicate.Content      = "";
                    Login.IsEnabled         = true;
                    Passowrd.IsEnabled      = true;
                    CreateXml.IsEnabled     = true;
                    ExportXmlToDB.IsEnabled = true;
                }

                else
                {
                    MessageBox.Show("Niewłaściwy plik", "error");
                }
            }
        }