public void PredstojecaRocista()
        {
            label1.Text = "Prikaz predstojećih ročišta ";
            RocisteRepository repository = new RocisteRepository(databaseContext);

            List <RocisteModel>        list = new List <RocisteModel>();
            BindingList <RocisteModel> bindingList;

            list        = repository.Get();
            bindingList = new BindingList <RocisteModel>(list);
            dataGridView1.DataSource = bindingList;
            this.dataGridView1.Columns["Id"].Visible        = false;
            this.dataGridView1.Columns["PredmetId"].Visible = false;
            rociste = true;
            Buttons(false);
            label3.Visible = true;
        }
Example #2
0
        private void ObrisiPredmetBtn_Click(object sender, EventArgs e)
        {
            PredmetRepository predmetRepository = new PredmetRepository(databaseContext);
            RocisteRepository rocisteRepository = new RocisteRepository(databaseContext);

            String brPredmeta = Interaction.InputBox("\r\n \r\n Unesite broj predmeta", "Obrisi predmet", "", -1, -1);
            var    predmet    = predmetRepository.Find(brPredmeta);

            if (predmet != null)
            {
                predmetRepository.Delete(brPredmeta);
                rocisteRepository.Delete(predmet.Id);
            }
            else
            {
                MessageBox.Show("Ne postoji predmet sa zadatim brojem");
            }
        }
Example #3
0
        private void OkBtn_Click(object sender, EventArgs e)
        {
            PredmetRepository        predmetRepository        = new PredmetRepository(databaseContext);
            PredmetRocisteRepository predmetRocisteRepository = new PredmetRocisteRepository(databaseContext);
            RocisteRepository        rocisteRepository        = new RocisteRepository(databaseContext);
            UplataRepository         uplataRepository         = new UplataRepository(databaseContext);

            switch (funkcija)
            {
            case "nova":
            {
                PredmetModel predmet = predmetRepository.Find(UplataBrPredmetaTxt.Text);
                if (predmet == null)
                {
                    MessageBox.Show("Ne postoji trazeni predmet");
                }
                else
                {
                    uplataRepository.Add(predmet.Id, new UplataModel
                        {
                            Iznos     = Double.Parse(iznosTxt.Text),
                            Uplatilac = PlatilacTxt.Text,
                            Placeno   = placenoCB.Checked
                        });
                }
            }
            break;

            case "postojeca":
            {
                PredmetModel predmet = predmetRepository.Find(PostUplBrPrTxt.Text);
                try {
                    uplataRepository.Update(predmet.Id, UplataDGV.SelectedRows[0].Cells["Id"].Value.ToString(), (bool)UplataDGV.SelectedRows[0].Cells["Placeno"].Value);
                    MessageBox.Show("Uspesna uplata");
                }
                catch (Exception)
                {
                    MessageBox.Show("Morate selektovati ceo red");
                }
            }
            break;

            case "rociste":
            {
                PredmetModel predmet = predmetRepository.Find(BrPredmetaTxt.Text);
                if (predmet == null)
                {
                    MessageBox.Show("Ne postoji trazeni predmet");
                }
                else
                {
                    predmetRocisteRepository.Add(predmet.Id, new PredmetRocisteModel
                        {
                            Datum  = dateTimePicker1.Value.Date.ToString(),
                            Pozvan = true
                        });
                    rocisteRepository.Add(new RocisteModel
                        {
                            Datum     = dateTimePicker1.Value.Date.ToString(),
                            PredmetId = predmet.Id
                        });
                }
            }
            break;

            default:
                break;
            }

            Clear(this.rocisteGB);
            Clear(this.UplataGB);
            Clear(this.NovaUplataGB);
        }
Example #4
0
        private void PredmetOkBtn(object sender, EventArgs e)
        {
            PredmetRepository        repository               = new PredmetRepository(databaseContext);
            TuzeniRepository         tuzeniRepository         = new TuzeniRepository(databaseContext);
            TuzilacRepository        tuzilacRepository        = new TuzilacRepository(databaseContext);
            PredmetRocisteRepository predmetRocisteRepository = new PredmetRocisteRepository(databaseContext);
            RocisteRepository        rocisteRepository        = new RocisteRepository(databaseContext);
            AdvokatRepository        advokatRepository        = new AdvokatRepository(databaseContext);
            UplataRepository         uplataRepository         = new UplataRepository(databaseContext);

            if (repository.Find(brojPtxt.Text) == null)
            {
                repository.Add(new PredmetModel
                {
                    BrPredmeta = brojPtxt.Text,
                    Mesto      = MestoTxt.Text,
                    Godina     = GodinaTxt.Text,
                    Podaci     = PodaciTxt.Text,
                    NazivSuda  = NazivTxt.Text,
                    Sudija     = SudijaTxt.Text,
                    Vrsta      = vrstaPtxt.Text
                });
                PredmetModel predmet = repository.Find(brojPtxt.Text);
                tuzeniRepository.Add(predmet.Id, new TuzeniModel
                {
                    PunoIme = tuzeniImeTxt.Text,
                    Telefon = TuzeniTelTxt.Text
                });
                tuzilacRepository.Add(predmet.Id, new TuzilacModel
                {
                    PunoIme = TuzilacImeTxt.Text,
                    Telefon = TuzilacTelTxt.Text
                });
                if (pozvanCB.Checked)
                {
                    predmetRocisteRepository.Add(predmet.Id, new PredmetRocisteModel
                    {
                        Datum  = dateTimePicker1.Value.Date.ToString(),
                        Pozvan = pozvanCB.Checked
                    });
                    rocisteRepository.Add(new RocisteModel
                    {
                        Datum     = dateTimePicker1.Value.Date.ToString(),
                        PredmetId = predmet.Id
                    });
                }

                advokatRepository.DodajAdvokataTuzenom(predmet.Id, new AdvokatModel
                {
                    PunoIme = TuzeniAdvImeTxt.Text,
                    Telefon = tuzeniAdvokatTelTxt.Text
                });
                advokatRepository.DodajAdvokataTuziocu(predmet.Id, new AdvokatModel
                {
                    PunoIme = tuzilacImeAdvTxt.Text,
                    Telefon = TuzilacAdvTelTxt.Text
                });

                if (IznosTxt.Text != "")
                {
                    uplataRepository.Add(predmet.Id, new UplataModel
                    {
                        Iznos     = Double.Parse(IznosTxt.Text),
                        Placeno   = PlacenoCB.Checked,
                        Uplatilac = PlatilacTxt.Text
                    });
                }
                Clear(this.DodajPredmetGB);
                GetALlControls(this.DodajPredmetGB);
            }
            else
            {
                MessageBox.Show("Vec postoji predmet sa zadatim brojem");
            }
        }