Esempio n. 1
0
        public static void Initialize(EBolnicaDbContext context)
        {
            if (!context.Pacijenti.Any())
            {
                context.Pacijenti.AddRange(
                    new Pacijent("Test", "Test", new DateTime(1999, 2, 2), "1111111111111", "bb", "-", "", 23, "Test", "Test"));
                context.SaveChanges();
            }

            if (!context.Doktori.Any())
            {
                context.Doktori.AddRange(
                    new Doktor("Testo", "Test", new DateTime(1999, 2, 2), "2222222222222", "bb", "-", "", 23, "Test1", "Test1"));
                context.SaveChanges();
            }
        }
Esempio n. 2
0
        //public INavigationService NavigationService { get;  set;}

        public LogInViewModel()
        {
            using (var db = new EBolnicaDbContext())
            {
                Osobe = db.Doktori.ToList <Osoba>();

                List <Osoba> pom = db.Pacijenti.ToList <Osoba>();
                for (int i = 0; i < pom.Count; i++)
                {
                    Osobe.Add(pom[i]);
                }
            }


            txtUser = "";
            txtPass = "";

            btnClick          = new RelayCommand <object>(logInFun);
            NavigationService = new NavigationService();
        }
Esempio n. 3
0
        public async void zavrsiRegistraciju(object parametar)
        {
            if (rIme.Length < 3 || rPrezime.Length < 3 || rKorisnickoIme.Length < 3 || rLozinka.Length < 3)
            {
                Poruka = new MessageDialog("Unesite sve tražene podatke.(Nepravilan unos nekih polja)");
                await Poruka.ShowAsync();

                return;
            }



            if (rLozinka != rLozinkaPotvrda)
            {
                Poruka = new MessageDialog("Lozinke se ne podudaraju.");
                await Poruka.ShowAsync();

                return;
            }
            if (rJmbg.Length != 13)
            {
                Poruka = new MessageDialog("Neispravan jmbg");
                await Poruka.ShowAsync();

                return;
            }
            rDatumRodjenja = rDatumRodjenjaOffset.Date;

            using (var DB = new EBolnicaDbContext())
            {
                if (!registracijaDoktora)
                {
                    Pacijent korisnik = new Pacijent(rIme, rPrezime, rDatumRodjenja, rJmbg, rAdresa, tBroj, rEmail, 0, rKorisnickoIme, rLozinka);
                    DB.Pacijenti.Add(korisnik);
                    try
                    {
                        DB.SaveChanges();



                        Poruka = new MessageDialog("Uspješno kreiran račun.");
                        await Poruka.ShowAsync();
                    }
                    catch (Exception e)
                    {
                        Poruka = new MessageDialog(e.Message);
                        await Poruka.ShowAsync();
                    }
                }
                else
                {
                    Doktor korisnik = new Doktor(rIme, rPrezime, rDatumRodjenja, rJmbg, rAdresa, tBroj, rEmail, 0, rKorisnickoIme, rLozinka);
                    DB.Doktori.Add(korisnik);
                    try
                    {
                        DB.SaveChanges();



                        Poruka = new MessageDialog("Uspješno kreiran račun.");
                        await Poruka.ShowAsync();
                    }
                    catch (Exception e)
                    {
                        Poruka = new MessageDialog(e.Message);
                        await Poruka.ShowAsync();
                    }
                }
            }
        }
Esempio n. 4
0
 public async void registracijaKorisnika(object parametar)
 {
     using (var DB = new EBolnicaDbContext())
     {
     }
 }