private void AddNewProduct_Click(object sender, RoutedEventArgs e)
        {
            AddProduct ap = new AddProduct();

            ap.Show();
            this.Hide();
        }
        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            AddProduct ap = new AddProduct();

            ap.Show();
            this.Hide();
        }
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            string connectionstring = null;

            connectionstring = myConnection.connectionString();
            MySqlConnection cnn = new MySqlConnection(connectionstring);

            cnn.Open();
            MySqlCommand command = cnn.CreateCommand();

            command.Parameters.AddWithValue("@id", LoginWindow.id);
            command.CommandText = "SELECT name,MM,price FROM products WHERE userid=@id";
            MySqlDataReader reader = command.ExecuteReader();

            if (reader.HasRows)
            {
                cnn.Close();
                cnn.Open();
                MySqlCommand command2 = cnn.CreateCommand();
                command2.Parameters.AddWithValue("@userid", LoginWindow.id);
                command2.Parameters.AddWithValue("@name", nameField.Text);
                command2.Parameters.AddWithValue("@dimX", float.Parse(dimXField.Text));
                command2.Parameters.AddWithValue("@dimY", float.Parse(dimYField.Text));
                command2.Parameters.AddWithValue("@MM", MMField.Text);
                command2.Parameters.AddWithValue("@price", float.Parse(priceField.Text));
                command2.CommandText = "INSERT INTO products (userid, name, dimX, dimY, MM, price) VALUES (@userid, @name, @dimX, @dimY, @MM, @price)";
                if (command2.ExecuteNonQuery() > 0)
                {
                    MessageBox.Show("Product was added successfuly.");
                    this.Hide();
                    AddProduct ap = new AddProduct();
                    ap.Show();
                }
                else
                {
                    MessageBox.Show("Record was not added!");
                }
            }


            cnn.Close();
        }
        private void Add_Product(object sender, RoutedEventArgs e)
        {
            AddProduct s = new AddProduct();

            s.Show();
        }