public AddNewPrzedmiotVM() { ExecuteAddPrzedmiotCommand = new Commanding(AddPrzedmiotCommand, CanAddPrzedmiotCommand); ExecuteAddPrzedmiotNameCommand = new Commanding(AddPrzedmiotNameCommand, CanAddPrzedmiotNameCommand); ExecuteAddTypCommand = new Commanding(AddTypNameCommand, CanAddTypNameCommand); ExecuteAddWykladowca = new Commanding(AddWykladowcaCommand, CanAddWykladowcaCommand); TypName = Typ_Zajec.GetZajecias(); PrzedmiotName = Przedmiot.GetPrzedmiotsNames(); WykladowcaName = Wykladowca.GetWykladowcas(); }
public RegistrationLyricsVM(Guid idGrupa, Guid idSemestr) { _idGrupa = idGrupa; _idSemestr = idSemestr; ExecuteAddPrzedmiotCommand = new Commanding(AddPrzedmiotCommand, CanAddPrzedmiotCommand); ExecuteAddPrzedmiotContinueCommand = new Commanding(AddPrzedmiotAndContinueCommand, CanAddPrzedmiotAndContinueCommand); ExecuteAddPrzedmiotNameCommand = new Commanding(AddPrzedmiotNameCommand, CanAddPrzedmiotNameCommand); ExecuteAddTypCommand = new Commanding(AddTypNameCommand, CanAddTypNameCommand); ExecuteAddWykladowcaCommand = new Commanding(AddWykladowcaCommand, CanAddWykladowcaCommand); TypName = Typ_Zajec.GetZajecias(); PrzedmiotName = Przedmiot.GetPrzedmiotsNames(); WykladowcaName = Wykladowca.GetWykladowcas(); }
private void AddTypNameCommand(object parameter) { DataClasses1DataContext context = new DataClasses1DataContext(); var typname = new Typ_Zajec { Typ_Zajec_Nazwa = _typNazwa }; context.Typ_Zajecs.InsertOnSubmit(typname); context.SubmitChanges(); 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); } }
private void AddPrzedmiotCommand(object parameter) { DataClasses1DataContext context = new DataClasses1DataContext(); Guid idTyp = Typ_Zajec.FindZajeciasIdByName(_selectedTyp); Guid idPrzedmiotNazwa = Przedmiot.FindPrzedmiotNazwaIdByNazwa(_selectedPrzedmiot); Guid idWykladowca = Wykladowca.FindWykladowcaIdByName(_selectedWykladowca); var przedmiot = new Przedmiot { Id_PrzedmiotNazwa = idPrzedmiotNazwa, Id_Typ_Zajec = idTyp, Godziny = Convert.ToInt32(_liczbaGodzin), PunktyETCS = Convert.ToInt32(_punktyETCS), Id_Wykladowcy = idWykladowca }; context.Przedmiots.InsertOnSubmit(przedmiot); context.SubmitChanges(); Window frm = (Window)parameter; frm.Close(); }