예제 #1
0
 private void login(object parameter)
 {
     using (var db = new BankDbContext())
     {
         List <Person> list = db.Persons.ToList <Person>();
         User = (Person)list.Where(x => x.Username == Username && x.Password == Password).FirstOrDefault();
     }
     if (User != null)
     {
         if (User.Validated == false)
         {
             var message = new MessageDialog("Vas racun jos nije verifikovan!", "Greska!");
             message.ShowAsync();
             return;
         }
         if (User.Type == "Supervisor")
         {
             MyNavigationService.Navigate(typeof(SupervisorPanel), new SupervisorPanelViewModel(this));
         }
         else if (User.Type == "User")
         {
             MyNavigationService.Navigate(typeof(UserAccount), new UserAccountViewModel(this, ref User));
         }
         else if (User.Type == "Referent")
         {
             MyNavigationService.Navigate(typeof(ReferentAccountMain), new ReferentAccount(this, ref User));
         }
     }
 }
예제 #2
0
 private void pretvori(object parameter)
 {
     MyNavigationService.Navigate(typeof(BlankPage1), new KonverzijaViewModel(this));
 }
예제 #3
0
 private void login(object parameter)
 {
     MyNavigationService.Navigate(typeof(Login), new LoginViewModel(this));
 }
예제 #4
0
 private void registration(object parameter)
 {
     MyNavigationService.Navigate(typeof(Registration), new RegistrationViewModel(this));
 }
예제 #5
0
 private void panelNav(object parameter)
 {
     MyNavigationService.Navigate(typeof(ReferentAccountPanel), this);
 }
예제 #6
0
 private void myAccount(object parameter)
 {
     MyNavigationService.Navigate(typeof(UserAccount), new UserAccountViewModel(this, ref user));
 }
예제 #7
0
        private async void register(object parameter)
        {
            #region Person
            NewPerson.Name            = Name;
            NewPerson.SurName         = SurName;
            NewPerson.JMBG            = JMBG;
            NewPerson.NameOfFather    = NameOfFather;
            NewPerson.Adress          = Adress;
            NewPerson.City            = City;
            NewPerson.PostalNumber    = PostalNumber;
            NewPerson.TelephoneNumber = "(" + TelephoneNumber1 + ")" + TelephoneNumber2;
            NewPerson.Email           = Email;
            NewPerson.Username        = Email;
            NewPerson.Password        = Password;
            NewPerson.Type            = TypeAcc;
            #endregion Person

            #region Account
            NewBankAccount.Balance = 0;
            NewBankAccount.Owner   = NewPerson;
            #endregion Account

            using (var db = new BankDbContext())
            {
                if (Name.Length == 0 || SurName.Length == 0 || NameOfFather.Length == 0 || JMBG.Length == 0 ||
                    Adress.Length == 0 || City.Length == 0 || TelephoneNumber1.Length == 0 || TelephoneNumber2.Length == 0 ||
                    Email.Length == 0)

                {
                    var notValidated = new MessageDialog("Niste unijeli sve podatke");
                    await notValidated.ShowAsync();
                }
                else if (JMBG.Length != 13 || !IsDigitsOnly(JMBG))
                {
                    var notValidated = new MessageDialog("JMBG nije u ispravnom formau");
                    await notValidated.ShowAsync();
                }

                /* else if (TelephoneNumber1.Length != 4 || !TelephoneNumber1.StartsWith("+") || !IsDigitsOnly(TelephoneNumber1.Substring(1)))
                 * {
                 *   var notValidated = new MessageDialog("Telefon nije u ispravnom formatu");
                 *   await notValidated.ShowAsync();
                 * }
                 * else if(TelephoneNumber2.Length != 8 || !IsDigitsOnly(TelephoneNumber2))
                 * {
                 *   var notValidated = new MessageDialog("Telefon nije u ispravnom formatu");
                 *   await notValidated.ShowAsync();
                 * }*/
                else if (!Email.Contains("@"))
                {
                    var notValidated = new MessageDialog("Email nije u ispravnom formatu");
                    await notValidated.ShowAsync();
                }
                else if (TermsOfUse == false)
                {
                    var notValidated = new MessageDialog("Morate prihvatiti odredbe i uvjete koristenja");
                    await notValidated.ShowAsync();
                }
                else
                {
                    Person list = db.Persons.Where(per => per.Email == Email).FirstOrDefault();
                    if (list != null)
                    {
                        var mess = new MessageDialog("Korisnik sa tim e-mailom vec postoji!");
                        await mess.ShowAsync();

                        return;
                    }
                    db.Persons.Add(NewPerson);
                    db.BankAccounts.Add(NewBankAccount);
                    db.SaveChanges();
                    var message = new MessageDialog("Registracija uspješna!", "Uspjeh!");
                    await message.ShowAsync();

                    MyNavigationService.Navigate(typeof(MainPage), new MainPageViewModel());
                }
            }
        }
예제 #8
0
 private void goBack(object parameter)
 {
     MyNavigationService.Navigate(typeof(MainPage), new MainPageViewModel());
 }