Exemple #1
0
        private void registruj_Click(object sender, RoutedEventArgs e)
        {
            if (tip.Text.Length == 0 || plata.Text.Length == 0 || racun.Text.Length == 0 || ime.Text.Length == 0 || prezime.Text.Length == 0 || username.Text.Length == 0 || password.Password.Length == 0 || !jmbgValidate(jmbg.Text) || !racunValidate())
            {
                validacija.Opacity = 100;
                return;
            }
            validacija.Opacity = 0;
            String dan    = jmbg.Text.Substring(0, 2);
            String mjesec = jmbg.Text.Substring(2, 2);
            String godina = "1" + jmbg.Text.Substring(4, 3);
            char   p;

            if ((string)pol.SelectedItem == "Muški")
            {
                p = 'M';
            }
            else
            {
                p = 'Z';
            }
            try
            {
                Majstor obj = new Majstor();
                obj.Ime           = ime.Text;
                obj.Prezime       = prezime.Text;
                obj.DatumRodjenja = dan + "." + mjesec + "." + godina;
                obj.Username      = username.Text;
                obj.Password      = password.Password;
                obj.Pol           = p;
                obj.Plata         = Double.Parse(plata.Text);
                obj.BankovniRacun = racun.Text;
                obj.Tip           = tip.Text;
                obj.Jmbg          = jmbg.Text;
                obj.MajstorId     = RandomString(10);
                majstorTableObj.InsertAsync(obj);
                MessageDialog dialog = new MessageDialog("Uspješno ste unijeli majstora!");
                dialog.ShowAsync();
            }
            catch (Exception ex)
            {
                MessageDialog dialog = new MessageDialog("Error: " + ex.ToString());
                dialog.ShowAsync();
            }
            //sd.dodajMajstora(ime.Text, prezime.Text, dan + "." + mjesec + "." + godina, username.Text, password.Password, p, Int32.Parse(plata.Text), racun.Text, tip.Text);
            Page adminPage = new AdminPage(sd);

            this.Content = adminPage;
        }
        private void otkazi_Click(object sender, RoutedEventArgs e)
        {
            Page adminPage = new AdminPage(sd);

            this.Content = adminPage;
        }