Exemple #1
0
        private void btn_sacuvaj_Click(object sender, RoutedEventArgs e)
        {
            int broj = Convert.ToInt32(tb_sifNaloga.Text);
            ServisRacunaraDataContext DC = new ServisRacunaraDataContext();


            try
            {
                var podaciDC = from x in DC.RadNalogs where x.sifraNaloga == broj select x;


                foreach (RadNalog rn in podaciDC)
                {
                    rn.status      = ((ComboBoxItem)comboBox.SelectedItem).Content.ToString();
                    rn.opisKva     = new TextRange(rtb_opisKvara.Document.ContentStart, rtb_opisKvara.Document.ContentEnd).Text;
                    rn.rezDel      = new TextRange(rtb_spisakDelova.Document.ContentStart, rtb_spisakDelova.Document.ContentEnd).Text;
                    rn.spisPoslova = new TextRange(rtb_spisakPoslova.Document.ContentStart, rtb_spisakPoslova.Document.ContentEnd).Text;
                }



                DC.SubmitChanges();

                MessageBox.Show("Uspesno ste izvrsili izmene!", "Obavestenje", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception)
            {
                MessageBox.Show("errror", "Obavestenje", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void btn_dodaj_Click(object sender, RoutedEventArgs e)
        {
            bool pom = false;

            ServisRacunaraDataContext s = new ServisRacunaraDataContext();

            try
            {
                RezervniDeo rd = new RezervniDeo();

                rd.barkod   = Convert.ToInt32(tb_barkod.Text);
                rd.marka    = ((ComboBoxItem)cb_marka.SelectedItem).Content.ToString();
                rd.vrsta    = ((ComboBoxItem)cb_vrsta.SelectedItem).Content.ToString();
                rd.model    = tb_model.Text;
                rd.kolicina = Convert.ToInt32(tb_kolicina.Text);
                rd.cena     = Convert.ToInt32(tb_cena.Text);


                s.RezervniDeos.InsertOnSubmit(rd);
                s.SubmitChanges();
                pom = true;
            }
            catch (Exception)
            {
                MessageBox.Show("Barkod vec postoji u bazi!", "Obavestenje!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            if (pom)
            {
                MessageBox.Show("Uspesno ste ubacili novi rezervni deo u bazu!", "Obavestenje", MessageBoxButton.OK, MessageBoxImage.Information);
                this.Close();
            }
        }
Exemple #3
0
        private void btn_kreirajZahtev_Click(object sender, RoutedEventArgs e)
        {
            bool pom = false;
            ServisRacunaraDataContext DC = new ServisRacunaraDataContext();

            try
            {
                ZahtevServ zs = new ZahtevServ();

                zs.serviser = lbl_serviser.Content.ToString();
                zs.datum    = lbl_vreme.Content.ToString();
                zs.tekst    = new TextRange(rtb_zahtev.Document.ContentStart, rtb_zahtev.Document.ContentEnd).Text;

                DC.ZahtevServs.InsertOnSubmit(zs);
                DC.SubmitChanges();
                pom = true;
            }
            catch (Exception)
            {
            }

            if (pom)
            {
                MessageBox.Show("Uspesno ste kreirali zahtev!", "Obavestenje", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Exemple #4
0
        private void btn_sacuvaj_Click(object sender, RoutedEventArgs e)
        {
            int broj = Convert.ToInt32(tb_barkod.Text);
            ServisRacunaraDataContext DC = new ServisRacunaraDataContext();

            try
            {
                var podaciDC = from x in DC.RezervniDeos where x.barkod == broj select x;


                foreach (RezervniDeo rd in podaciDC)
                {
                    rd.cena     = Convert.ToInt32(tb_cena.Text);
                    rd.kolicina = Convert.ToInt32(tb_kolicina.Text);
                    rd.model    = tb_model.Text;
                    rd.marka    = ((ComboBoxItem)cb_marka.SelectedItem).Content.ToString();
                    rd.vrsta    = ((ComboBoxItem)cb_vrsta.SelectedItem).Content.ToString();
                }

                DC.SubmitChanges();
                MessageBox.Show("Uspesno ste izvrsili izmene!", "Obavestenje!", MessageBoxButton.OK, MessageBoxImage.Information);
                this.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Dosle je do greske prilikom snimanja!", "Obavestenje!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemple #5
0
        private void btn_brisi_Click(object sender, RoutedEventArgs e)
        {
            ServisRacunaraDataContext DC = new ServisRacunaraDataContext();
            ZahtevServ rc = (from x in DC.ZahtevServs where x.brZahteva == broj select x).SingleOrDefault();

            DC.ZahtevServs.DeleteOnSubmit(rc);
            DC.SubmitChanges();
            MessageBox.Show("Zahtev je uspesno obrisan!", "Obavestenje", MessageBoxButton.OK, MessageBoxImage.Information);
            this.Close();
        }
Exemple #6
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            int broj = Convert.ToInt32(tb_sifraRacuna.Text);
            ServisRacunaraDataContext DC = new ServisRacunaraDataContext();
            RacunVlasnika             rc = (from x in DC.RacunVlasnikas where x.sifraRacuna == broj select x).SingleOrDefault();

            DC.RacunVlasnikas.DeleteOnSubmit(rc);
            DC.SubmitChanges();

            MessageBox.Show("Racuna je uspesno obrisan!", "Obavestenje", MessageBoxButton.OK, MessageBoxImage.Information);
            this.Close();
        }
Exemple #7
0
        private void btn_sacuvaj_Click(object sender, RoutedEventArgs e)
        {
            bool pom = false;

            ServisRacunaraDataContext s = new ServisRacunaraDataContext();

            try
            {
                RadNalog rn = new RadNalog();


                rn.radnik      = tb_imeRadnika.Text;
                rn.vreme       = tb_vreme.Text;
                rn.sifraNaloga = Convert.ToInt32(tb_sifNaloga.Text);
                rn.status      = ((ComboBoxItem)comboBox.SelectedItem).Content.ToString();
                rn.imePrezime  = tb_imePrezime.Text;
                rn.brLicne     = Convert.ToInt32(tb_brLicne.Text);
                rn.adresa      = tb_adresa.Text;
                rn.mail        = tb_mail.Text;
                rn.telefon     = tb_telefon.Text;
                rn.sifraRac    = tb_sifRacunara.Text;
                rn.opisPro     = new TextRange(rtb_opisProb.Document.ContentStart, rtb_opisProb.Document.ContentEnd).Text;

                s.RadNalogs.InsertOnSubmit(rn);
                s.SubmitChanges();
                pom = true;
            }
            catch (Exception)
            {
                MessageBox.Show("Sifra radnog naloga vec postoji, morate uzeti drugu!", "Obavestenje", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            if (pom)
            {
                MessageBox.Show("Uspesno ste kreirali radni nalog!", "Obavestenje", MessageBoxButton.OK, MessageBoxImage.Information);
                tb_adresa.Clear();
                tb_brLicne.Clear();
                tb_imePrezime.Clear();
                tb_mail.Clear();
                tb_sifNaloga.Clear();
                tb_sifRacunara.Clear();
                tb_telefon.Clear();
                rtb_opisProb.Document.Blocks.Clear();
                comboBox.SelectedIndex = -1;
            }
        }
Exemple #8
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            bool pom = false;

            ServisRacunaraDataContext DC = new ServisRacunaraDataContext();

            try
            {
                RacunVlasnika rv = new RacunVlasnika();

                rv.sifraNaloga = Convert.ToInt32(cb.SelectedValue.ToString());
                rv.radnik      = tb_imeRadnika.Text;
                rv.vreme       = tb_vreme.Text;

                rv.imePrezime = tb_imePrezime.Text;
                rv.brLicne    = Convert.ToInt32(tb_brLicne.Text);
                rv.telefon    = tb_telefon.Text;
                rv.mail       = tb_mail.Text;
                rv.sifraRac   = tb_sifRacunara.Text;

                rv.opisKva     = new TextRange(rtb_opisKvara.Document.ContentStart, rtb_opisKvara.Document.ContentEnd).Text;
                rv.spisPoslova = new TextRange(rtb_SpisakPoslova.Document.ContentStart, rtb_SpisakPoslova.Document.ContentEnd).Text;
                rv.rezDel      = new TextRange(rtb_SpisakRezDel.Document.ContentStart, rtb_SpisakRezDel.Document.ContentEnd).Text;


                rv.cenaDelova = tb_cenaDelova.Text;
                rv.cenaUsluga = tb_cenaUsluga.Text;
                rv.cenaUkupna = tb_ukupnaCena.Text;

                DC.RacunVlasnikas.InsertOnSubmit(rv);
                DC.SubmitChanges();
                pom = true;
            }
            catch (Exception)
            {
                MessageBox.Show("Doslo je do greskee!");
            }
            if (pom)
            {
                MessageBox.Show("Uspesno ste kreirali racun!", "Obavestenje", MessageBoxButton.OK, MessageBoxImage.Information);
                this.Close();
            }
        }