Example #1
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
                Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
                Microsoft.ApplicationInsights.WindowsCollectors.Session);
            this.InitializeComponent();
            this.Suspending += OnSuspending;



            using (var db3 = new RezervacijaDbContext())
            {
                db3.Database.ApplyMigrations();
                DefaultPodaciRezervacija.Initialize(db3);
            }

            using (var db1 = new LiceDbContext())
            {
                db1.Database.ApplyMigrations();
                DefaultPodaci.Initialize(db1);
            }

            /* using (var db2 = new FilmDbContext())
             * {
             *   db2.Database.ApplyMigrations();
             *   DefaultPodaciFilm.Initialize(db2);
             * }
             */
        }
Example #2
0
 //samo da mozemo brisati iz baze
 private async void Page_Loaded(object sender, RoutedEventArgs e)
 {
     using (var db = new LiceDbContext())
     {
         listViewKorisnici.ItemsSource = db.Lice.ToList();
     }
 }
Example #3
0
        private async void buttonName_Click(object sender, RoutedEventArgs e)
        {
            String ime, prez, tel, email, pmail;

            ime   = textBoxIme.Text;
            prez  = textBoxPrezime.Text;
            tel   = textBoxTelefon.Text;
            email = textBoxEmail.Text;
            pmail = textBoxPotvrdaEmail.Text;

            if (email != pmail && ime == null && prez == null && tel == null && email == null)
            {
                MessageDialog dialog = new MessageDialog("Niste popunili sva obavezna polja!", "Upozorenje");
                await dialog.ShowAsync();
            }
            else
            {
                Flica.Add(new Models.FizickoLice(textBoxIme.ToString(), textBoxPrezime.ToString(), textBoxTelefon.ToString(), textBoxEmail.ToString(), textBoxAdresa.ToString(), Models.StatusFizickogLica.dijete, Models.TipKorisnika.InternetKorisnik));
                using (var db = new LiceDbContext())
                {
                    var contact = new Lice
                    {
                        Ime     = textBoxIme.Text,
                        Prezime = textBoxPrezime.Text,
                        Email   = textBoxEmail.Text,
                        Telefon = textBoxTelefon.Text,
                    };
                    db.Lice.Add(contact);
                    //SaveChanges obavezno da se reflektuju izmjene u bazi, tek tada dolazi do komunikacije

                    db.SaveChanges();
                    //reset polja za unos
                    textBoxIme.Text          = string.Empty;
                    textBoxPrezime.Text      = string.Empty;
                    textBoxEmail.Text        = string.Empty;
                    textBoxTelefon.Text      = string.Empty;
                    textBoxPotvrdaEmail.Text = string.Empty;

                    string messageBody;
                    messageBody = "Kod je ";

                    string mail;
                    mail = textBoxEmail.Text;
                    SendEmailOverMailTo(mail, "", " ", "Rezervacija", messageBody);


                    this.Frame.Navigate(typeof(Sala));
                }
                // (string ime, string prezime, string telefon, string email, string adresa, StatusFizickogLica status, TipKorisnika tip)
            }
        }
Example #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DependencyObject dep = (DependencyObject)e.OriginalSource;

            while ((dep != null) && !(dep is ListViewItem))
            {
                dep = VisualTreeHelper.GetParent(dep);
            }

            if (dep == null)
            {
                return;
            }

            using (var db = new LiceDbContext())
            {
                db.Lice.Remove((Lice)listViewKorisnici.ItemFromContainer(dep));

                db.SaveChanges();

                listViewKorisnici.ItemsSource = db.Lice.OrderBy(c => c.Prezime).ToList();
            }
        }
        private void buttonName_Click(object sender, RoutedEventArgs e)
        {
            Models.Firma firma = new Models.Firma(textBoxNaziv.ToString(), textBoxAdresaPravnog.ToString(), textBoxRacun.ToString());
            //firme.Add(new Models.Firma(textBoxNaziv, textBoxAdresaPravnog, textBoxRacun);
            if (textBoxEmail.ToString() == textBoxPotvrdaEmail.ToString())
            {
                Plica.Add(new Models.PravnoLice(textBoxIme.ToString(), textBoxPrezime.ToString(), textBoxTelefon.ToString(), textBoxEmail.ToString(), firma, textBoxBrojLicne.ToString()));
                this.Frame.Navigate(typeof(Sala));
            }
            else
            {
                //Poruka za nepravilan unos email
                textBoxEmail.Text        = " ";
                textBoxPotvrdaEmail.Text = " ";
            }

            using (var db = new LiceDbContext())
            {
                var contact = new Lice
                {
                    Ime     = textBoxIme.Text,
                    Prezime = textBoxPrezime.Text,
                    Email   = textBoxEmail.Text,
                    Telefon = textBoxTelefon.Text,
                };
                db.Lice.Add(contact);
                //SaveChanges obavezno da se reflektuju izmjene u bazi, tek tada dolazi do komunikacije

                db.SaveChanges();
                //reset polja za unos
                textBoxIme.Text          = string.Empty;
                textBoxPrezime.Text      = string.Empty;
                textBoxEmail.Text        = string.Empty;
                textBoxTelefon.Text      = string.Empty;
                textBoxPotvrdaEmail.Text = string.Empty;
            }
        }