private void btnKupi_Click(object sender, RoutedEventArgs e)
        {
            SmartSoftwareServiceInterfaceClient service = new SmartSoftwareServiceInterfaceClient();
            DateTime datum           = DateTime.Now;
            DbItemIstorijaKupovine d = new DbItemIstorijaKupovine()
            {
                datum_prodaje = datum,
                Kupac         = new DbItemKorisnici()
                {
                    id_korisnici = tmpKorisnik.IdKorisnici
                },
                prodavac = new DbItemKorisnici()
                {
                    id_korisnici = 1
                },
                ukupna_cena_kupovine           = this.UkupnaCenaSaPopustom,
                broj_iskoriscenih_popust_poena = tmpKorisnik.IzabranBrojPoenaZaPopust
            };
            List <DbItemKupljenaOpremaSaParametrima> listaKupljenjeOpreme = new List <DbItemKupljenaOpremaSaParametrima>();

            foreach (var item in this.Korpa)
            {
                Oprema o = item as Oprema;

                listaKupljenjeOpreme.Add(new DbItemKupljenaOpremaSaParametrima()
                {
                    cena = o.Cena,
                    cena_opreme_kad_je_prodata = o.Cena,
                    id_oprema       = o.IdOprema,
                    prodataKolicina = o.IzabranaKolicina
                });
            }

            DbItemKupljenaOpremaSaParametrima [] kupljenaOprema = service.ProdajaArtikla(d, listaKupljenjeOpreme.ToArray());

            if (tmpKorisnik != null)
            {
                int brojPoenaDodatno = 0;
                if (this.koristeSePoeni)
                {
                    brojPoenaDodatno = -tmpKorisnik.IzabranBrojPoenaZaPopust;
                }
                else
                {
                    brojPoenaDodatno = Convert.ToInt32(Math.Floor(UkupnaCena / 100));
                }

                DbItemKorisnici korisnik = new DbItemKorisnici()
                {
                    id_korisnici        = tmpKorisnik.IdKorisnici,
                    brojOstvarenihPoena = brojPoenaDodatno
                };
                SmartSoftwareServiceReference.DbItemKorisnici[] rez = service.AzurirajBrojPoenaKorisnika(korisnik);
                Xceed.Wpf.Toolkit.MessageBox.Show("Uspesno ste zavrsili Prodaju za korisnika : !" + TmpKorisnik.ImeKorisnika + " !");
            }
            this.vratiSeUglavniProzor = true;
            this.Korpa = new ObservableCollection <SmartSoftwareGlavnaOblast>();
            this.Close();
        }
        public DbItemKorisnici[] PrikaziZaposleneKorisnike(DbItemKorisnici korisnik)
        {
            OpZaposleniKorisniciSelect op       = new OpZaposleniKorisniciSelect();
            OperationObject            rezultat = OperationManager.Singleton.executeOp(op);

            DbItemKorisnici[] niz = rezultat.Niz as DbItemKorisnici[];
            return(niz);
        }
        public DbItemKorisnici[] AzurirajBrojPoenaKorisnika(DbItemKorisnici korisnik)
        {
            OpKorisniciAzurirajBrojPoena op = new OpKorisniciAzurirajBrojPoena();

            op.KorisniciDataSelect = new DbItemKorisnici()
            {
                id_korisnici        = korisnik.id_korisnici,
                brojOstvarenihPoena = korisnik.brojOstvarenihPoena
            };
            OperationObject rezultat = OperationManager.Singleton.executeOp(op);

            return(rezultat.Niz as DbItemKorisnici[]);
        }
        public DbItemKorisnici[] OpKorisniciInsert(DbItemKorisnici korisnik)
        {
            OpKorisniciInsert op = new OpKorisniciInsert();

            op.KorisniciDataSelect = new DbItemKorisnici()
            {
                ime           = korisnik.ime,
                prezime       = korisnik.prezime,
                mejl          = korisnik.mejl,
                broj_telefona = korisnik.broj_telefona,
                id_uloge      = korisnik.id_uloge
            };
            OperationObject rezultat = OperationManager.Singleton.executeOp(op);

            return(rezultat.Niz as DbItemKorisnici[]);
        }
Esempio n. 5
0
        private void btnRegistracijaKorisnika_Click(object sender, RoutedEventArgs e)
        {
            SmartSoftwareServiceInterfaceClient service = new SmartSoftwareServiceInterfaceClient();
            DbItemKorisnici korisnik = new DbItemKorisnici()
            {
                ime           = tmpKorisnik.ImeKorisnika,
                prezime       = tmpKorisnik.PrezimeKorisnika,
                mejl          = tmpKorisnik.MejlKorisnika,
                broj_telefona = tmpKorisnik.BrojTelefonaKorisnika,
                id_uloge      = 3
            };

            SmartSoftwareServiceReference.DbItemKorisnici[] korisnici = service.OpKorisniciInsert(korisnik);
            this.ListaKorisnika.Add(tmpKorisnik);
            this.popuniListuKorisnika(korisnici);
            this.TmpKorisnik = new Korisnici();
        }
        public DbItemKorisnici[] ZaposleniKorisniciInsert(DbItemKorisnici korisnik)
        {
            OpZaposleniKorisniciInsert op = new OpZaposleniKorisniciInsert();

            op.ZaposleniKorisniciDataSelect = new DbItemKorisnici()
            {
                ime                 = korisnik.ime,
                prezime             = korisnik.prezime,
                mejl                = korisnik.mejl,
                broj_telefona       = korisnik.broj_telefona,
                brojOstvarenihPoena = korisnik.brojOstvarenihPoena,
                username            = korisnik.username,
                lozinka             = korisnik.lozinka,
                id_uloge            = korisnik.id_uloge,
            };
            OperationObject rezultat = OperationManager.Singleton.executeOp(op);

            DbItemKorisnici[] niz = rezultat.Niz as DbItemKorisnici[];
            return(niz);
        }