Jump to content

User talk:StrahinjaKralj

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Domen; using Sesija;


namespace KolokvijumPrimer1 {

   public partial class FrmKlijent : Form
   {
       
       //List<Predmet> pre = new List<Predmet>();
       
       Broker b = new Broker();
       public FrmKlijent()
       {
           InitializeComponent();
           // Prikazuje unete Studente i Predmete
           cmbStudent.DataSource = Broker.dajSesiju().vratiStudente();//sta je bolje?
           cmbPredmet.DataSource = b.vratiPredmete();
           cmbPredmetStatistika.DataSource = b.vratiPredmete();
       }
       // akcija na dugme "Sačuvaj ispitnu prijavu"
       private void button1_Click(object sender, EventArgs e)
       {
           // Skuplja podatke o prijavi
           Prijava prijava = new Prijava();
           prijava.DatumPolaganja = txtDatumPolaganja.Text;
          
           prijava.Profesor = txtProfesor.Text;
           //jako biitno radi sa odabranim studentima
           Student s = cmbStudent.SelectedItem as Student;
           prijava.Student = s;
           Predmet p = cmbPredmet.SelectedItem as Predmet;
           prijava.Predmet = p;
           // Proverava da li su sva polja za unos prijave popunjena
           if (txtDatumPolaganja.Text == "" || txtOcena.Text == "" || txtProfesor.Text == "" || cmbPredmet.SelectedItem == null || cmbStudent.SelectedItem == null)
           {
               MessageBox.Show("Morate popuniti sva polja!");
           }
           else
           {
               prijava.Ocena = Convert.ToInt32(txtOcena.Text);
               // Proverava da li ima novca na racunu
               if (s.StanjeNaRAcunu == 0 || s.StanjeNaRAcunu < Convert.ToDouble(p.Espb_Bodovi*100))
               {
                   MessageBox.Show("Nemate dovoljno novca na računu!");
               }
               else
               {
                   bool found = false;
                   // Proverava da li je već uneta prijava za ovog sudenta za ovaj predmet 
                   foreach (Prijava pr in b.vratiPrijave())
                   {
                       if (prijava.Predmet.SifraPredmeta == pr.Predmet.SifraPredmeta && prijava.Student.SifraStudenta == pr.Student.SifraStudenta)
                       {
                           MessageBox.Show("Prijava već postoji!");
                           found = true;
                           break;
                       }
                   }
                   if (!found)
                   {
                       // Unosi prijavu
                       b.unesiPrijavu(prijava);
                       // Smanjuje stanje na racunu za vrednost prijave
                       s.StanjeNaRAcunu = s.StanjeNaRAcunu - p.Espb_Bodovi * 100;
                       b.azurirajStanjeNaRacunu(s);
                       MessageBox.Show("Prijava je uspešno sačuvana.");
                   }
               }
           }
           
       }
       // akcija na comboBox
       private void cmbPredmetStatistika_SelectedIndexChanged(object sender, EventArgs e)
       {
           //2 Za selektovani predmet iz comboBox-a prikazuje u tabeli sve Stdente koji su položili taj predmet
           Predmet p = cmbPredmetStatistika.SelectedItem as Predmet;
           dataGridView1.DataSource = b.prikaziPolozene(p);
       }
       //3 akcija na dugme "Poništi ispit"
       private void btnPonistiIspit_Click(object sender, EventArgs e)
       {
           // Za selektovanog Studenta i Predmet se vrši brisanje prijave iz baze
           Student s = cmbStudent.SelectedItem as Student;
           Predmet p = cmbPredmet.SelectedItem as Predmet;
           bool found = false;
           // Proverava se da li ispitna prijava postoji u bazi
               foreach (Prijava prijava in b.vratiPrijave())
               {
                   if (prijava.Student.SifraStudenta == s.SifraStudenta && prijava.Predmet.SifraPredmeta == p.SifraPredmeta)
                   {
                       // Ako postoji ispitna prijava, proveravamo da li ima dovoljno novca na stanju da bi de prijava poništila
                       if (s.StanjeNaRAcunu == 0 || s.StanjeNaRAcunu < Convert.ToDouble(prijava.Ocena * 100))
                       {
                           MessageBox.Show("Nemate dovoljno novca na računu!");
                       }
                       // Ako ima novca na stanju brišemo prijavu
                       else
                       {
                           b.obrisiPrijavu(s, p);
                           s.StanjeNaRAcunu = s.StanjeNaRAcunu - prijava.Ocena * 100;
                           b.azurirajStanjeNaRacunu(s);
                           MessageBox.Show("Ispitna prijava je poništena.");
                       }
                       found = true;
                       break;
                   }
               }
               if (!found)
                   MessageBox.Show("Prijava ne postoji u bazi!");
       }
   }

}

If this is the first article that you have created, you may want to read the guide to writing your first article.

You may want to consider using the Article Wizard to help you create articles.

Hello, and welcome to Wikipedia. This is a notice to inform you that a tag has been placed on StrahinjaKralj requesting that it be speedily deleted from Wikipedia. This has been done under section A1 of the criteria for speedy deletion, because it is a very short article providing little or no context to the reader. Please see Wikipedia:Stub for our minimum information standards for short articles. Also please note that articles must be on notable subjects and should provide references to reliable sources that verify their content.

If you think this page should not be deleted for this reason, you may contest the nomination by visiting the page and clicking the button labelled "Click here to contest this speedy deletion". This will give you the opportunity to explain why you believe the page should not be deleted. However, be aware that once a page is tagged for speedy deletion, it may be removed without delay. Please do not remove the speedy deletion tag from the page yourself, but do not hesitate to add information in line with Wikipedia's policies and guidelines. If the page is deleted, and you wish to retrieve the deleted material for future reference or improvement, you can place a request here. - MrX 23:41, 11 May 2013 (UTC)[reply]

If this is the first article that you have created, you may want to read the guide to writing your first article.

You may want to consider using the Article Wizard to help you create articles.

Hello, and welcome to Wikipedia. This is a notice to inform you that a tag has been placed on Strahinjakralj requesting that it be speedily deleted from Wikipedia. This has been done under section A1 of the criteria for speedy deletion, because it is a very short article providing little or no context to the reader. Please see Wikipedia:Stub for our minimum information standards for short articles. Also please note that articles must be on notable subjects and should provide references to reliable sources that verify their content.

If you think this page should not be deleted for this reason, you may contest the nomination by visiting the page and clicking the button labelled "Click here to contest this speedy deletion". This will give you the opportunity to explain why you believe the page should not be deleted. However, be aware that once a page is tagged for speedy deletion, it may be removed without delay. Please do not remove the speedy deletion tag from the page yourself, but do not hesitate to add information in line with Wikipedia's policies and guidelines. If the page is deleted, and you wish to retrieve the deleted material for future reference or improvement, you can place a request here. - MrX 23:42, 11 May 2013 (UTC)[reply]