private void deliverynote_Click(object sender, RoutedEventArgs e)
        {
            DeliveryNoteWindow dn = new DeliveryNoteWindow();

            dn.Show();
            this.Hide();
        }
        public void SaveDeliveryNoteToDatabase()
        {
            string connectionstring = null;

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

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

            command.Parameters.AddWithValue("@userid", LoginWindow.id);
            command.Parameters.AddWithValue("@invoiceid", invoiceid.Text);
            command.Parameters.AddWithValue("@clientname", nameField.Text);
            command.Parameters.AddWithValue("@totalqu", float.Parse(sumField.Text));
            command.Parameters.AddWithValue("@date", string.Join("", DateTime.Now.ToString("dd/MM/yyyy HH:mm")));

            command.CommandText = "INSERT INTO SavedDeliveryNotes (userid,DeliveryNoteId,Client_Name,Total_Quantity,Date) VALUES (@userid, @invoiceid, @clientname, @totalqu, @date)";
            if (command.ExecuteNonQuery() > 0)
            {
                MessageBox.Show("Delivery Note was successfuly saved!");
                this.Hide();
                DeliveryNoteWindow dn = new DeliveryNoteWindow();
                dn.Show();
            }
            else
            {
                MessageBox.Show("WARNING!!! [Error: Delivery Note wasn't saved in database.]");
            }



            cnn.Close();
        }