Exemple #1
0
        private bool jeLiDuplikat(string varijabla, string izbor)
        {
            bool postojiKupac = false, postojiFirma = false;

            for (int i = 0; i < EtfKupon.getInstance().dajListuFirmi().Count; i++)
            {
                if ((EtfKupon.getInstance().dajNtuFirmu(i).Email == varijabla && izbor.Equals("Email")) || (EtfKupon.getInstance().dajNtuFirmu(i).Username == varijabla && izbor.Equals("Username")))
                {
                    postojiFirma = true;
                    break;
                }
            }
            if (postojiFirma == false)
            {
                for (int i = 0; i < EtfKupon.getInstance().dajListuKupaca().Count; i++)
                {
                    if ((EtfKupon.getInstance().dajNtogKupca(i).Email == varijabla && izbor.Equals("Email")) || (EtfKupon.getInstance().dajNtogKupca(i).Username == varijabla && izbor.Equals("Username")))
                    {
                        postojiKupac = true;
                        break;
                    }
                }
            }
            return(postojiFirma || postojiKupac);
        }
Exemple #2
0
        public void odbaci(object parametar)
        {
            Artikal pomocniArtikal = new Artikal();

            EtfKupon.getInstance().dajListuFirmi().Find(x => x.Username == MainPage.TrenutnaFirma.Username).ListaArtikala.Remove(pomocniArtikal);

            //CloseAction();
        }
Exemple #3
0
        // Forma za funkciju OdbaciKupon jos nije implementirana
        public void odbaci(object parametar)
        {
            Kupon k = new Kupon();

            EtfKupon.getInstance().dajListuFirmi().Find(x => x.Username == MainPage.TrenutnaFirma.Username).ListaKupona.Remove(k);

            //CloseAction();
        }
Exemple #4
0
        public void dodaj(object parametar)
        {
            IMobileServiceTable <FirmaBaza> userTableObj = App.MobileService.GetTable <FirmaBaza>();
            Validacija vKupac = new Validacija();


            Tuple <int, string> vUsername;
            Tuple <int, string> vPassword;
            Tuple <int, string> vEmail;
            Tuple <int, string> vNaziv;
            Tuple <int, string> vPasswordPotvrda;


            vUsername        = vKupac.ValidirajUsernameKorisnika(firma.Username);
            vPassword        = vKupac.ValidirajPasswordKorisnika(firma.Password);
            vEmail           = vKupac.ValidirajEmailKorisnika(firma.Email);
            vNaziv           = vKupac.ValidirajImeKorisnika(firma.Naziv);
            vPasswordPotvrda = vKupac.ValidirajPasswordPotvrduKorisnika(firma.Password, firma.PasswordPotvrda);

            int brojGreski = vUsername.Item1 + vPassword.Item1 + vEmail.Item1 + vEmail.Item1 + vPasswordPotvrda.Item1;

            if (brojGreski == 0)
            {
                FirmaBaza firmicaHehe = new FirmaBaza(firma.Naziv, firma.Username, firma.Password, firma.Email, firma.StanjeRacuna);
                userTableObj.InsertAsync(firmicaHehe);
                EtfKupon.getInstance().dajListuFirmi().Add(firma);
                NavigationService.Navigate(typeof(MainPage), new MainPage(this));
                return;
            }
            string poruka = "";

            if (vNaziv.Item1 != 0)
            {
                poruka += vNaziv.Item2 + '\n';
            }
            if (vUsername.Item1 != 0)
            {
                poruka += vUsername.Item2 + '\n';
            }
            if (vPassword.Item1 != 0)
            {
                poruka += vPassword.Item2 + '\n';
            }
            if (vEmail.Item1 != 0)
            {
                poruka += vEmail.Item2 + '\n';
            }
            if (vPasswordPotvrda.Item1 != 0)
            {
                poruka += vPasswordPotvrda.Item2 + '\n';
            }

            if (poruka != null)
            {
                new MessageDialog(poruka).ShowAsync();
            }
        }
Exemple #5
0
 public KorpaModelView()
 {
     korpa = new Korpa();
     EtfKupon.getInstance().dajListuKupaca().Find(x => x.Username == MainPage.TrenutniKupac.Username).MojaKorpa = korpa;
     artikal           = new Artikal();
     NavigationService = new NavigationService();
     Dodaj             = new RelayCommand(dodaj);
     Odbaci            = new RelayCommand(odbaci);
 }
        public void azuriraj(object parametar)
        {
            int i = EtfKupon.getInstance().dajListuKupaca().FindIndex(x => x.Username == MainPage.TrenutniKupac.Username);
            if (novi.Ime != null)
                EtfKupon.getInstance().dajNtogKupca(i).Ime = novi.Ime;
            if(novi.Prezime != null)
                EtfKupon.getInstance().dajNtogKupca(i).Prezime = novi.Prezime;
            if (novi.Username != null)
                EtfKupon.getInstance().dajNtogKupca(i).Username = novi.Username;
            //TODO kako password zamijeniti 
            /*if (novi.Password != null)
                MainPage.etfKupon.ListaKupaca.ElementAt(i).Password = novi.Password*/
            if (novi.Email != null)
                EtfKupon.getInstance().dajNtogKupca(i).Email = novi.Email;
            if (novi.BrojKartice != null)
                EtfKupon.getInstance().dajNtogKupca(i).BrojKartice = novi.BrojKartice;
            //TODO slika

            NavigationService.Navigate(typeof(PocetnaKupca), new PocetnaKupca(this));
        }
Exemple #7
0
 private void buttonPrijava_Click(object sender, RoutedEventArgs e)
 {
     TrenutniKupac = EtfKupon.getInstance().dajListuKupaca().Find(x => x.Username == textBoxUsername.Text);
     if (TrenutniKupac == null)
     {
         TrenutnaFirma = EtfKupon.getInstance().dajListuFirmi().Find(x => x.Username == textBoxUsername.Text);
         if (TrenutnaFirma != null)
         {
             if (TrenutnaFirma.Password == textBoxPassword.Text)
             {
                 this.Frame.Navigate(typeof(PocetnaFirme));
             }
         }
     }
     else
     {
         if (TrenutniKupac.Password == textBoxPassword.Text)
         {
             this.Frame.Navigate(typeof(PocetnaKupca));
         }
     }
 }
 public void odbaci(object parametar)
 {
     EtfKupon.getInstance().izbrisiKupca(Novi);
     MainPage.TrenutniKupac = null;
     NavigationService.Navigate(typeof(MainPage), new MainPage(this));
 }
 public void odbaci(object parametar)
 {
     EtfKupon.getInstance().dajListuKupaca().Find(x => x.Username == MainPage.TrenutniKupac.Username).ListaInteresa.Remove(interes);
     NavigationService.Navigate(typeof(PocetnaKupca), new PocetnaKupca(this));
 }
Exemple #10
0
        public void dodaj(object parametar)
        {
            IMobileServiceTable <KupacBaza> userTableObj = App.MobileService.GetTable <KupacBaza>();
            //IMobileServiceTable<proba> blabla = App.MobileService.GetTable<proba>();
            Validacija          vKupac = new Validacija();
            Tuple <int, string> vAdresa;
            Tuple <int, string> vIme;
            Tuple <int, string> vPrezime;
            Tuple <int, string> vUsername;
            Tuple <int, string> vPassword;
            Tuple <int, string> vEmail;
            Tuple <int, string> vPasswordPotvrda;

            vAdresa          = vKupac.ValidirajAdresuKorisnika(Kupac.Adresa);
            vIme             = vKupac.ValidirajImeKorisnika(Kupac.Ime);
            vPrezime         = vKupac.ValidirajPrezimeKorisnika(Kupac.Prezime);
            vUsername        = vKupac.ValidirajUsernameKorisnika(Kupac.Username);
            vPassword        = vKupac.ValidirajPasswordKorisnika(Kupac.Password);
            vEmail           = vKupac.ValidirajEmailKorisnika(Kupac.Email);
            vPasswordPotvrda = vKupac.ValidirajPasswordPotvrduKorisnika(Kupac.Password, Kupac.PasswordPotvrda);
            int suma = vAdresa.Item1 + vIme.Item1 + vPrezime.Item1 + vPassword.Item1 + vEmail.Item1 + vUsername.Item1 + vPasswordPotvrda.Item1;

            if (suma == 0)
            {
                KupacBaza x = new KupacBaza(Kupac.Ime, Kupac.Prezime, Kupac.Username, Kupac.Password, Kupac.Email, Kupac.Adresa, Kupac.BrojKartice, Kupac.StanjeRacuna);
                EtfKupon.getInstance().dodajKupca(Kupac);
                userTableObj.InsertAsync(x);
                NavigationService.Navigate(typeof(MainPage), new MainPage(this));
                return;
            }
            string poruka = "";

            if (vAdresa.Item1 != 0)
            {
                poruka += vAdresa.Item2 + '\n';
            }
            if (vIme.Item1 != 0)
            {
                poruka += vIme.Item2 + '\n';
            }
            if (vPrezime.Item1 != 0)
            {
                poruka += vPrezime.Item2 + '\n';
            }
            if (vUsername.Item1 != 0)
            {
                poruka += vUsername.Item2 + '\n';
            }
            if (vPassword.Item1 != 0)
            {
                poruka += vPassword.Item2 + '\n';
            }
            if (vEmail.Item1 != 0)
            {
                poruka += vEmail.Item2 + '\n';
            }
            if (vPasswordPotvrda.Item1 != 0)
            {
                poruka += vPasswordPotvrda.Item2 + '\n';
            }

            if (poruka != null)
            {
                new MessageDialog(poruka).ShowAsync();
            }

            //CloseAction();
        }
Exemple #11
0
 public void odbaci(object parametar)
 {
     EtfKupon.getInstance().dajListuKupaca().Find(x => x.Username == MainPage.TrenutniKupac.Username).MojaKorpa.ListaArtikala.Remove(artikal);
     //NavigationService.Navigate(typeof(PocetnaKupca), new PocetnaKupca(this));
 }
Exemple #12
0
 public void dodaj(object parametar)
 {
     EtfKupon.getInstance().dajListuKupaca().Find(x => x.Username == MainPage.TrenutniKupac.Username).MojaKorpa.ListaArtikala.Add(Artikal);
 }