Example #1
0
        private void Dodaj_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("Dodaj!");

            Associate a = (Associate)Saradnik.SelectedItem;

            CelebrationOffer offer = new CelebrationOffer(this.Zahtev.Id, a, CelebrationOfferStatus.Ponudjen, this.IzabraniProizvodi.ToList());

            this.MainWindow.Ponude.Add(offer);

            foreach (CelebrationRequest req in this.MainWindow.Zahtevi)
            {
                if (req.Id == this.Zahtev.Id)
                {
                    ++req.BrojPonuda;
                }
            }

            this.MainWindow.util.write_to_file <CelebrationOffer>(this.MainWindow.Ponude, this.MainWindow.pathPonude);

            MessageBox.Show("Uspjesno dodavanje nove ponude!");
            this.Close();
        }
Example #2
0
        public DetaljiPonude(MainWindow window, CelebrationOffer offer)
        {
            InitializeComponent();

            this.MainWindow  = window;
            this.DataContext = this;

            Zahtev = offer;

            Saradnik = offer.Saradnik.Ime;
            Tip      = offer.Saradnik.Type.Ime;
            Adresa   = offer.Saradnik.Adresa;
            Grad     = offer.Saradnik.Grad;

            int ukupnaCena = 0;

            foreach (Product p in offer.Proizvodi)
            {
                ukupnaCena = ukupnaCena + p.Cena;
            }
            Cena = ukupnaCena;

            Proizvodi = new ObservableCollection <Product>(offer.Proizvodi);
        }