Esempio n. 1
0
 public Login()
 {
     InitializeComponent();
     JMBG.Focus();
     this.DataContext = new LoginViewModel(this);
     this.Language    = XmlLanguage.GetLanguage("sr-SR");
 }
        private bool FormNotValid()
        {
            bool errorsFound = false;

            if (string.IsNullOrEmpty(Username) || Username.Length < 4)
            {
                errorsFound = true;
                ErrorKorisnickoIme_IsVisible = true;
            }
            else
            {
                ErrorKorisnickoIme_IsVisible = false;
            }
            if (string.IsNullOrEmpty(Ime))
            {
                errorsFound        = true;
                ErrorIme_IsVisible = true;
            }
            else
            {
                ErrorIme_IsVisible = false;
            }
            if (string.IsNullOrEmpty(Prezime))
            {
                errorsFound            = true;
                ErrorPrezime_IsVisible = true;
            }
            else
            {
                ErrorPrezime_IsVisible = false;
            }
            if (string.IsNullOrEmpty(Email) || !IsValidEmail(Email))
            {
                errorsFound          = true;
                ErrorEmail_IsVisible = true;
            }
            else
            {
                ErrorEmail_IsVisible = false;
            }
            if (DatumRodjenja.Date >= DateTime.Now.Date)
            {
                errorsFound          = true;
                ErrorDatum_IsVisible = true;
            }
            else
            {
                ErrorDatum_IsVisible = false;
            }
            if (string.IsNullOrEmpty(JMBG) || JMBG.Length > 13 || JMBG.Length < 13 || !JMBG.All(Char.IsDigit))
            {
                errorsFound         = true;
                ErrorJMBG_IsVisible = true;
            }
            else
            {
                ErrorJMBG_IsVisible = false;
            }
            if (string.IsNullOrEmpty(Password) || Password.Length < 4)
            {
                errorsFound            = true;
                ErrorLozinka_IsVisible = true;
            }
            else
            {
                ErrorLozinka_IsVisible = false;
            }
            if (string.IsNullOrEmpty(PasswordConfirm) || PasswordConfirm != Password)
            {
                errorsFound = true;
                ErrorLozinkaPotvrda_IsVisible = true;
            }
            else
            {
                ErrorLozinkaPotvrda_IsVisible = false;
            }
            if (Opcina == null)
            {
                errorsFound           = true;
                ErrorOpcina_IsVisible = true;
            }
            else
            {
                ErrorOpcina_IsVisible = false;
            }
            if (Spol == null)
            {
                errorsFound         = true;
                ErrorSpol_IsVisible = true;
            }
            else
            {
                ErrorSpol_IsVisible = false;
            }

            return(errorsFound);
        }