Exemple #1
0
        private void AddCiagCommand(object parameter)
        {
            DataClasses1DataContext context = new DataClasses1DataContext();

            Guid idStopien = StopienStudiow.FindStupienStudiowIdByName(_selectedStopien);
            Guid idTyp     = TypStudiow.FindTypStudiowIdByName(_selectedTyp);

            string firstLetterOfStopien = _selectedStopien[0].ToString();
            string firstLetterOfTyp     = _selectedTyp[0].ToString();
            string ciagName             = firstLetterOfStopien.ToUpper() + firstLetterOfTyp.ToUpper();

            var ciag = new Ciag
            {
                Id_Stopien_Studiow = idStopien,
                Id_Typ_Studiow     = idTyp,
                Ciag_Nazwa         = ciagName,
            };

            context.Ciags.InsertOnSubmit(ciag);
            context.SubmitChanges();

            Window frm = (Window)parameter;

            frm.Close();
        }
        private void AddCiagCommand(object parameter)
        {
            AddCiag         frm          = new AddCiag();
            Nullable <bool> dialogResult = frm.ShowDialog();

            CiagName = Ciag.GetCiags();
        }
Exemple #3
0
    public static void Main()
    {
        Ciag a = new Ciag();

        Console.WriteLine(a.a);
        Console.WriteLine(a.a);
        Console.WriteLine(a.a);
        Console.ReadKey();
    }
        public RegistrationGroupVM(Guid studentId)
        {
            _studentId = studentId;
            ExecuteAddKierunekCommand = new Commanding(AddKierunekCiagGroupCommand, CanAddKierunekCiagGroupCommand);
            ExecuteAddKierunek        = new Commanding(AddKierunekCommand, CanAddKierunekCommand);
            ExecuteAddCiag            = new Commanding(AddCiagCommand, CanAddCiagCommand);
            ExecuteAddGroup           = new Commanding(AddGroupCommand, CanAddGroupCommand);

            SemesterName = Semestr.GetSemestersNames();
            KierunekName = Kierunek.GetKieruneks();
            CiagName     = Ciag.GetCiags();
            GroupName    = Grupa.GetGrupas();
        }
        private void AddKierunekCiagGroupCommand(object parameter)
        {
            DataClasses1DataContext context = new DataClasses1DataContext();

            string[] nameSeparator = _selectedCiag.Split('-');

            Guid  idCiag     = Ciag.FindCiagIdByName(nameSeparator[0]);
            Guid  idKierunek = Kierunek.FindKierunekIdByName(_selectedKierunek);
            Guid  idGrupa    = Grupa.FindGrupaIdByName(_selectedGroup);
            Grupa grupa      = Grupa.CheckGrupaExist(idKierunek, idCiag, idGrupa);

            if (grupa == null)
            {
                var nowaGrupa = new Grupa
                {
                    Id_Ciag        = idCiag,
                    Id_Kierunek    = idKierunek,
                    Id_Grupa_Nazwa = idGrupa
                };
                context.Grupas.InsertOnSubmit(nowaGrupa);
                context.SubmitChanges();
                grupa = nowaGrupa;
            }

            var studentGrupa = new StudentGrupa
            {
                Id_Grupa   = grupa.Id_Grupa,
                Id_Student = _studentId
            };

            context.StudentGrupas.InsertOnSubmit(studentGrupa);
            context.SubmitChanges();

            Window frm = (Window)parameter;

            frm.Close();
        }