private void RegisterSemester(object parameter)
        {
            DataClasses1DataContext context = new DataClasses1DataContext();
            Guid idSemestr = Semestr.FindSemestrIdByName(_selectedSemester);
            Guid idPrzedmiot = Przedmiot.FindPrzedmiotIdByFullName(_selectedPrzedmiot);
            if (!Semestr.CheckSemestrExistInGroup(CurrentGroupId, idSemestr))
            {
                var grupaSemestrPrzedmiot = new GrupaSemestrPrzedmiot
                {
                    Id_Grupa = CurrentGroupId,
                    Id_Przedmiot = idPrzedmiot,
                    Id_Semestr = idSemestr
                };

                context.GrupaSemestrPrzedmiots.InsertOnSubmit(grupaSemestrPrzedmiot);
                context.SubmitChanges();
            }
            else MessageBox.Show("Semestr jest już wpisany","Uwaga", MessageBoxButton.OK, MessageBoxImage.Error);

            Window frm = (Window)parameter;
            frm.Close();
        }
        private void dodaj_przedmiot()
        {
            DataClasses1DataContext context = new DataClasses1DataContext();

            Guid idWykladowcy = Wykladowca.FindWykladowcaIdByName(_selectedWykladowca);
            Guid idTyp = Typ_Zajec.FindZajeciasIdByName(_selectedTyp);
            Guid PrzedmiotNazwaId = Przedmiot.FindPrzedmiotNazwaIdByNazwa(_selectedPrzedmiot);
            Przedmiot przedmiotExist = Przedmiot.CheckPrzedmiotExist(idTyp, idWykladowcy, PrzedmiotNazwaId);
            if (przedmiotExist == null)
            {
                var newPrzedmiot = new Przedmiot
                {
                    Id_PrzedmiotNazwa = PrzedmiotNazwaId,
                    Id_Typ_Zajec = idTyp,
                    PunktyETCS = Convert.ToInt32(_punktyETCS),
                    Godziny = Convert.ToInt32(_liczbaGodzin),
                    Id_Wykladowcy = idWykladowcy
                };
                przedmiotExist = newPrzedmiot;
                context.Przedmiots.InsertOnSubmit(przedmiotExist);
                context.SubmitChanges();
            }

            if (!Semestr.CheckPrzedmiotExistInSemester(_idSemestr, _idGrupa, przedmiotExist.Id_Przedmiot))
            {
                var grupaPrzedmiotSemestr = new GrupaSemestrPrzedmiot
                {
                    Id_Grupa = _idGrupa,
                    Id_Semestr = _idSemestr,
                    Id_Przedmiot = przedmiotExist.Id_Przedmiot
                };
                context.GrupaSemestrPrzedmiots.InsertOnSubmit(grupaPrzedmiotSemestr);
                context.SubmitChanges();
            }
            else
            {
                MessageBox.Show("Przedmiot jest już na liście","Uwaga", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
 partial void DeleteGrupaSemestrPrzedmiot(GrupaSemestrPrzedmiot instance);
 partial void UpdateGrupaSemestrPrzedmiot(GrupaSemestrPrzedmiot instance);
 partial void InsertGrupaSemestrPrzedmiot(GrupaSemestrPrzedmiot instance);
		private void detach_GrupaSemestrPrzedmiots(GrupaSemestrPrzedmiot entity)
		{
			this.SendPropertyChanging();
			entity.Semestr = null;
		}
		private void attach_GrupaSemestrPrzedmiots(GrupaSemestrPrzedmiot entity)
		{
			this.SendPropertyChanging();
			entity.Przedmiot = this;
		}