Esempio n. 1
0
        private void buttonObrisiZaposlenog_Click(object sender, RoutedEventArgs e)
        {
            if (SelektovaniZaposleni == null || string.IsNullOrWhiteSpace(SelektovaniZaposleni.Jmbg))
            {
                return;
            }
            foreach (Zaposleni z in TempZaposlenici)
            {
                if (z.Jmbg == SelektovaniZaposleni.Jmbg)
                {
                    DoctorController    doctorController    = new DoctorController();
                    SecretaryController secretaryController = new SecretaryController();
                    UserController      userController1     = new UserController(doctorController);
                    UserController      userController2     = new UserController(secretaryController);
                    if (!userController2.DeleteProfile(z.Jmbg))
                    {
                        userController1.DeleteProfile(z.Jmbg);
                        ExaminationController ec = new ExaminationController();
                        ec.DeleteDoctorExaminations(z.Jmbg);
                        WorkingTimeController wtc = new WorkingTimeController();
                        wtc.DeleteWorkingTime(z.Jmbg);
                    }

                    TempZaposlenici.Remove(z);
                    Zaposlenici.Remove(z);
                    SelektovaniZaposleni = null;

                    break;
                }
            }
        }
Esempio n. 2
0
        private void buttonTraziZaposlene_Click(object sender, RoutedEventArgs e)
        {
            TempZaposlenici.Clear();
            foreach (var z in Zaposlenici)
            {
                switch (SelectedKriterijum)
                {
                case "Ime":
                    if (z.Ime.IndexOf(Pretraga, StringComparison.CurrentCultureIgnoreCase) != -1)
                    {
                        TempZaposlenici.Add(z);
                    }
                    break;

                case "Prezime":
                    if (z.Prezime.IndexOf(Pretraga, StringComparison.CurrentCultureIgnoreCase) != -1)
                    {
                        TempZaposlenici.Add(z);
                    }
                    break;

                case "JMBG":
                    if (z.Jmbg.IndexOf(Pretraga, StringComparison.CurrentCultureIgnoreCase) != -1)
                    {
                        TempZaposlenici.Add(z);
                    }
                    break;

                case "Zaposlenje":
                    if (z.Zaposlenje.IndexOf(Pretraga, StringComparison.CurrentCultureIgnoreCase) != -1)
                    {
                        TempZaposlenici.Add(z);
                    }
                    break;

                default:
                    TempZaposlenici.Add(z);
                    break;
                }
            }
        }