private void BackToWindow(object sender, RoutedEventArgs e)
        {
            ChangeCurrencySellCourse changeCurrencySellCourse = new ChangeCurrencySellCourse();

            changeCurrencySellCourse.Show();
            this.Close();
        }
        private void ChangeCurrencySellData_Click(object sender, RoutedEventArgs e)
        {
            ChangeCurrencySellCourse changeCurrencySellCourse = new ChangeCurrencySellCourse();

            changeCurrencySellCourse.Show();
            this.Close();
        }
        private void SaveChanges(object sender, RoutedEventArgs e)
        {
            SqlConnection connection = new SqlConnection(connectionString);

            connection.Open();
            if (criterion.Text != string.Empty && searchCriterion.Text != string.Empty)
            {
                int currencyCode = Convert.ToInt32(searchCriterion.Text);
                if (criterion.Text == "Название валюты")
                {
                    if (changingCriterion.Text != CheckCurrency.CheckCurrencyName(changingCriterion.Text))
                    {
                        System.Windows.MessageBox.Show(CheckCurrency.CheckCurrencyName(changingCriterion.Text));
                        return;
                    }
                    string mySelectQuery = "SELECT * FROM CurrencySell WHERE CurrencySellName = '" + changingCriterion.Text + "'";
                    using (SqlDataAdapter dataAdapter = new SqlDataAdapter(mySelectQuery, connection))
                    {
                        DataTable table = new DataTable();
                        dataAdapter.Fill(table);
                        if (table.Rows.Count > 0)
                        {
                            System.Windows.MessageBox.Show("Вы не можете изменить данные, так как эта валюта уже есть в базе.");
                            return;
                        }
                        else if (table.Rows.Count == 0)
                        {
                            using (SqlCommand lastCommnd = connection.CreateCommand())
                            {
                                lastCommnd.CommandText = "UPDATE CurrencySell SET CurrencySellName = @name WHERE CurrencySellCode = @code";
                                lastCommnd.Parameters.AddWithValue("@name", changingCriterion.Text);
                                lastCommnd.Parameters.AddWithValue("@code", currencyCode);

                                lastCommnd.ExecuteNonQuery();
                            }
                        }
                    }
                }
                else if (criterion.Text == "Курс валюты")
                {
                    if (changingCriterion.Text != CheckCurrency.CheckCurrencyCourse(changingCriterion.Text))
                    {
                        System.Windows.MessageBox.Show(CheckCurrency.CheckCurrencyCourse(changingCriterion.Text));
                        return;
                    }
                    using (SqlCommand lastCommnd = connection.CreateCommand())
                    {
                        lastCommnd.CommandText = "UPDATE CurrencySell SET CurrencySellCourse = @course WHERE CurrencySellCode = @code";
                        lastCommnd.Parameters.AddWithValue("@course", Convert.ToDouble(changingCriterion.Text));
                        lastCommnd.Parameters.AddWithValue("@code", currencyCode);

                        lastCommnd.ExecuteNonQuery();
                    }
                }
            }
            else
            {
                System.Windows.MessageBox.Show("Вы не выбрали данные для изменения.");
                return;
            }
            MessageBoxResult mboxResult = System.Windows.MessageBox.Show("Данные обновлены. Желаете изменить что-нибудь еще?", "Предупреждение", MessageBoxButton.YesNo);

            if (mboxResult == MessageBoxResult.No)
            {
                ChangeCurrencySellCourse changeCurrencySellCourse = new ChangeCurrencySellCourse();
                changeCurrencySellCourse.Show();
                this.Close();
            }
            connection.Close();
        }