private bool Validacija()
        {
            if (string.IsNullOrWhiteSpace(TextBoxIme.Text))
            {
                MessageBox.Show("Unesite ime");
                TextBoxIme.Focus();
                return(false);
            }

            if (string.IsNullOrWhiteSpace(TextBoxPrezime.Text))
            {
                MessageBox.Show("Unesite prezime");
                TextBoxPrezime.Focus();
                return(false);
            }

            string lk = TextBoxLicnaKarta.Text.Trim();

            if (lk.Length != 9)
            {
                MessageBox.Show("Unesite 9 karaktera");
                TextBoxLicnaKarta.Focus();
                return(false);
            }

            foreach (char c in lk)
            {
                if (!char.IsDigit(c))
                {
                    MessageBox.Show("Unesite 9 cifara");
                    TextBoxLicnaKarta.Focus();
                    return(false);
                }
            }

            if (string.IsNullOrWhiteSpace(TextBoxUlicaBroj.Text))
            {
                MessageBox.Show("Unesite ulicu i broj");
                TextBoxUlicaBroj.Focus();
                return(false);
            }

            if (string.IsNullOrWhiteSpace(TextBoxMesto.Text))
            {
                MessageBox.Show("Unesite mjesto");
                TextBoxMesto.Focus();
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        private bool Validacija()
        {
            if (string.IsNullOrWhiteSpace(TextBoxIme.Text))
            {
                MessageBox.Show("Unesite ime");
                TextBoxIme.Focus();
                return(false);
            }

            if (string.IsNullOrWhiteSpace(TextBoxPrezime.Text))
            {
                MessageBox.Show("Unesite prezime");
                TextBoxPrezime.Focus();
                return(false);
            }
            return(true);
        }
Exemplo n.º 3
0
        private async Task <bool> Validacija()
        {
            if (string.IsNullOrWhiteSpace(TextBoxIme.Text))
            {
                await new MessageDialog("Unesite ime").ShowAsync();
                TextBoxIme.Focus(FocusState.Pointer);
                return(false);
            }
            if (string.IsNullOrWhiteSpace(TextBoxPrezime.Text))
            {
                await new MessageDialog("Unesite prezime").ShowAsync();
                TextBoxPrezime.Focus(FocusState.Pointer);
                return(false);
            }

            return(true);
        }
Exemplo n.º 4
0
        private bool Validacija()
        {
            if (string.IsNullOrWhiteSpace(TextBoxIme.Text))
            {
                MessageBox.Show("Niste uneli ime");
                TextBoxIme.Focus();
                return(false);
            }

            if (string.IsNullOrWhiteSpace(TextBoxPrezime.Text))
            {
                MessageBox.Show("Niste uneli prezime");
                TextBoxPrezime.Focus();
                return(false);
            }
            if (string.IsNullOrWhiteSpace(TextBoxBrDozvole.Text))
            {
                MessageBox.Show("Niste uneli broj vozacke dozvole");
                TextBoxBrDozvole.Focus();
                return(false);
            }
            if (string.IsNullOrWhiteSpace(TextBoxKontakt.Text))
            {
                MessageBox.Show("Niste uneli kontakt telefon");
                return(false);
            }

            if (DatumVracanja.SelectedDate.Value < DatumPreuzimanja.SelectedDate.Value)
            {
                MessageBox.Show("Neispravan unos datuma vracanja");
                DatumVracanja.SelectedDate =
                    DatumPreuzimanja.SelectedDate.Value.AddDays(1);
                return(false);
            }

            if (comboAutomobili.SelectedIndex < 0)
            {
                MessageBox.Show("Izaberite automobil");
                return(false);
            }
            if (comboVrstarezervoara.SelectedIndex < 0)
            {
                MessageBox.Show("Izaberite opciju rezervoara");
                return(false);
            }
            if (valAuto)
            {
                if (radioZauzet.IsChecked == true)
                {
                    MessageBox.Show("Automobil je zauzet");
                    return(false);
                }
            }

            if (!DatePickerDatumRodjenja.SelectedDate.HasValue)
            {
                MessageBox.Show("Selektujte datum rodjenja");
                return(false);
            }
            if (DatePickerDatumRodjenja.SelectedDate.Value >
                DateTime.Today.AddYears(-18))
            {
                MessageBox.Show("Klijent mora biti punoletan");
                return(false);
            }
            return(true);
        }