private void btn_AddLicence_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         LicenceEditPresenter licenceEditPresenter = new LicenceEditPresenter(new LicenceEditView(), new Licence());
         Licence licence = (Licence)(licenceEditPresenter.View.DataContext);
         licenceEditPresenter.View.Label_AddOrEditLicence.Content = "Dodawanie licencji";
         LicencePresenter licencePresenter = (LicencePresenter)this.DataContext;
         if (licence != null)
         {
             licenceEditPresenter.View.ShowDialog();
             if (licenceEditPresenter.View.DialogResult == true)
             {
                 licencePresenter.SaveLicence(licence, false);
                 licencePresenter.GetAllLicences();
             }
         }
         else
         {
             MessageBox.Show("Wystąpił błąd podczas dodawania licencji. Spróbuj ponownie");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void ChangeCurrentRow(LicencePresenter licencePresenter, LicenceEditPresenter licenceEdit,
   Licence obj)
 {
     Licence licence = ((Licence)licenceEdit.View.DataContext);
     obj.assign_fixed_asset = licence.assign_fixed_asset;
     obj.comment = licence.comment;
     obj.created_by = licence.created_by;
     obj.id_kind = licence.id_kind;
     obj.id_number = licence.id_number;
     obj.inventory_number = licence.inventory_number;
     obj.last_modified_date = licence.last_modified_date;
     obj.last_modified_login = licence.last_modified_login;
     obj.licence_number = licence.licence_number;
     obj.name = licence.name;
     licencePresenter.View.dataGridLicences.Items.Refresh();
 }
 private void btnUpdate_Click(object sender, RoutedEventArgs e)
 {
      try
     {
         LicencePresenter licencePresenter = (LicencePresenter)this.DataContext;
         Licence licence = new Licence();
         DeepClone.CopyTo((Licence)(licencePresenter.View.dataGridLicences.SelectedItem), licence);
         LicenceEditPresenter subgroupEditPresenter = new LicenceEditPresenter(new LicenceEditView(), licence);
         subgroupEditPresenter.View.Label_AddOrEditLicence.Content = "Edytowanie licencji";
         if (subgroupEditPresenter.View.ShowDialog() == true)
         {
             licencePresenter.SaveLicence(licence, true);
             Licence temp = (Licence)licencePresenter.View.dataGridLicences.SelectedItem;
             ChangeCurrentRow(licencePresenter, subgroupEditPresenter, temp);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }