private void UpadateItemBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Int32.Parse(AmountUpdate.Text) > 0)
                {
                    DBUpdateInvoice db_update = new DBUpdateInvoice();
                    DBGetItems      db_items  = new DBGetItems();


                    db_update.UpdateItemAmount(invoice, Items.SelectedItem.ToString(), Int32.Parse(AmountUpdate.Text));

                    SetComboboxItem();
                    AmountUpdate.Text = "" + 0;
                }
                else
                {
                    MessageBox.Show("Wypełnij wszystkie pola", "Błąd");
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                MessageBox.Show("Błędne wypełnienie pól", "Błąd");
            }
        }
        private void AddItemBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Int32.Parse(Amount.Text) > 0)
                {
                    DBUpdateInvoice db_update = new DBUpdateInvoice();
                    DBGetItems      db_items  = new DBGetItems();

                    ExtendedItem chosen_item         = null;
                    List <Entity.ExtendedItem> items = db_items.GetItems();

                    foreach (ExtendedItem i in items)
                    {
                        if (i.name.Equals(AvaiableItems.SelectedItem))
                        {
                            chosen_item        = i;
                            chosen_item.amount = Int32.Parse(Amount.Text);
                        }
                    }

                    if (chosen_item != null)
                    {
                        chosen_item.UpdateValues();
                        invoice.items.Add(chosen_item);
                    }
                    db_update.UpdateItemList(invoice, chosen_item);
                    SetComboboxItem();
                    Amount.Text = "" + 0;
                }
            }catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DBUpdateInvoice db_update  = new DBUpdateInvoice();
                DBGetSubjects   db_subject = new DBGetSubjects();

                invoice.FA_Number      = FA_number.Text;
                invoice.issue_date     = DateTime.Parse(Issue_date.Text);
                invoice.due_date       = DateTime.Parse(Due_date.Text);
                invoice.Payment_Method = Payment_methode.Text;

                invoice.subject_for  = db_subject.GetSubjectByName(SubjectForComboBox.SelectedItem.ToString());
                invoice.subject_from = db_subject.GetSubjectByName(SubjectFromComboBox.SelectedItem.ToString());

                db_update.UpdateInvoice(invoice);
            }catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

            this.owner.ChangePanelShowInvoice(invoice);
        }