Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            decimal vecaOD;
            decimal manjaOD;

            if ((cijenaVeca.Text == "") && (CijenaManja.Text == ""))
            {
                vecaOD  = 0;
                manjaOD = decimal.MaxValue;
            }
            else
            {
                if (cijenaVeca.Text == "")
                {
                    vecaOD = 0;
                }
                else
                {
                    vecaOD = Convert.ToDecimal(cijenaVeca.Text);
                }

                if (CijenaManja.Text == "")
                {
                    manjaOD = decimal.MaxValue;
                }
                else
                {
                    manjaOD = Convert.ToDecimal(CijenaManja.Text);
                }
            }


            dataGridViewCijena.AutoGenerateColumns = false;
            dataGridViewCijena.DataSource          = DBProizvodi.GetIgrePoCijeni(vecaOD, manjaOD);
        }
Ejemplo n.º 2
0
        private void comboBoxNarudžba_SelectedIndexChanged(object sender, EventArgs e)
        {
            int ID;
            SelectKupacByNarudzbaID_Result Kupac = new SelectKupacByNarudzbaID_Result();

            if (comboBoxNarudžba.SelectedIndex != 0)
            {
                ID    = Convert.ToInt32(comboBoxNarudžba.SelectedValue);
                Kupac = DBKupci.SelectKupacByNarudzbaID(ID);

                textBoxIme.Text             = Kupac.Ime;
                textBoxPrezime.Text         = Kupac.Prezime;
                dateTimePickerDatum.Visible = true;
                dateTimePickerDatum.Value   = Kupac.Datum;
                dataGridViewIgre.DataSource = DBProizvodi.SelectByNarudzbaID(ID);



                racun(ID);
            }
            else
            {
                textBoxIme.Text             = "";
                textBoxPrezime.Text         = "";
                dateTimePickerDatum.Visible = false;
            }
        }
Ejemplo n.º 3
0
        private void DodajStavku()
        {
            try{
                UlazStavke s = new UlazStavke();

                Igre igra = DBProizvodi.IgraIDBySifra(textBoxSifraProizvoda.Text);
                s.IgraID = igra.IgraID;


                s.Igre     = DBProizvodi.IgreSelectByID(s.IgraID);
                s.Kolicina = Convert.ToInt32(textBoxKolicina.Text);

                s.Cijena = Convert.ToDecimal(textBoxCijena.Text);
                stavke.Add(s);

                iznosRacuna += s.Kolicina * s.Cijena;

                pdv = (decimal)0.17 * iznosRacuna;

                textBoxRacun.Text          = Math.Round(iznosRacuna + pdv, 2).ToString();
                textBoxPDV.Text            = Math.Round(pdv, 2).ToString();
                textBoxSifraProizvoda.Text = "";
                textBoxKolicina.Text       = "";
                textBoxCijena.Text         = "";
                textBoxSifraProizvoda.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            int  IgraID = Convert.ToInt32(context.Request["IgraID"]);
            Igre igra   = DBProizvodi.IgreSelectByID(IgraID);

            context.Response.ContentType = "image/Jpeg";
            context.Response.BinaryWrite(igra.Slika);
        }
Ejemplo n.º 5
0
        private void BindGrid()
        {
            int vrstaID = 0;

            if (VrstaList.SelectedIndex != 0)
            {
                vrstaID = Convert.ToInt32(VrstaList.SelectedValue);
            }

            int offset = proizvodiGrid.CurrentPageIndex * proizvodiGrid.PageSize;

            igre = DBProizvodi.SelectByVrstaNaziv(vrstaID, TextBox1.Text, offset, proizvodiGrid.PageSize);
            proizvodiGrid.DataSource = igre;

            proizvodiGrid.VirtualItemCount = DBProizvodi.totalRows;
            proizvodiGrid.DataBind();
        }
Ejemplo n.º 6
0
        private void buttonSacuvaj_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.ValidateChildren(ValidationConstraints.Enabled))
                {
                    if (Proizvodi == null)
                    {
                        Proizvodi = new Igre();
                    }

                    if (comboBoxVrsta.SelectedIndex > 0)
                    {
                        Proizvodi.VrstaID = Convert.ToInt32(comboBoxVrsta.SelectedValue);
                    }

                    Proizvodi.Šifra = textBoxSifra.Text.Trim();
                    Proizvodi.Naziv = textBoxNaziv.Text.Trim();


                    decimal cijena = Convert.ToDecimal(textBoxCijena.Text);
                    Proizvodi.Cijena = Math.Round(cijena, 2);

                    Proizvodi.DatumIzdavanja = dateTimePickerDatum.Text;
                    Proizvodi.Opis           = textBoxOpis.Text;
                    Proizvodi.Trailer        = textBoxTrailer.Text;

                    if (comboBoxIzdavaci.SelectedIndex >= 0)
                    {
                        Proizvodi.IzdavacID = Convert.ToInt32(comboBoxIzdavaci.SelectedValue);
                    }


                    DBProizvodi.ProizvodiInsert(Proizvodi);

                    BindIGre();
                    clean();
                    MessageBox.Show(global.GetString("ulaz_succs"), "Proizvod", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Greska", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 7
0
        protected void DropDownListHistory_SelectedIndexChanged(object sender, EventArgs e)
        {
            int ID = Convert.ToInt32(DropDownListHistory.SelectedValue);


            historija.DataSource = DBProizvodi.SelectByNarudzbaID(ID);
            historija.DataBind();

            List <SelectIgreByNarudzbaID_Result> Igre = DBProizvodi.SelectByNarudzbaID(ID);

            decimal racun = 0;

            foreach (SelectIgreByNarudzbaID_Result ig in Igre)
            {
                racun = racun + ig.Cijena;
            }
            Label3.Text = Math.Round(racun, 2).ToString();
        }
Ejemplo n.º 8
0
        protected void proizvodiGrid_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemIndex != -1)
            {
                Image image = (Image)e.Item.FindControl("ThumbImage");
                image.ImageUrl = "ImageHandler.ashx?IgraID=" + igre[e.Item.ItemIndex].IgraID;

                int  id  = igre[e.Item.ItemIndex].IgraID;
                Igre igr = DBProizvodi.IgreSelectByID(id);
                if (igr.Aukcija == true)
                {
                    Image Image = (Image)e.Item.FindControl("AukcijaSlika");
                    Image.ImageUrl = "slika.jpg";

                    CheckBox c = (CheckBox)e.Item.FindControl("aukcijac");
                    c.Checked = true;
                }
            }
        }
Ejemplo n.º 9
0
        private void racun(int ID)
        {
            List <SelectIgreByNarudzbaID_Result> Igre = DBProizvodi.SelectByNarudzbaID(ID);
            decimal racun = 0;

            foreach (SelectIgreByNarudzbaID_Result ig in Igre)
            {
                racun = racun + ig.Cijena;
            }

            decimal pdv = (decimal)0.17 * racun;

            textBoxIznos.Text = Math.Round(racun, 2).ToString();
            textBoxPDv.Text   = Math.Round(pdv, 2).ToString();

            decimal ukupno = pdv + racun;

            textBoxUkupno.Text = Math.Round(ukupno, 2).ToString();
        }
Ejemplo n.º 10
0
        private void button1_Click(object sender, EventArgs e)
        {
            Izlaz  = new Izlazi();
            Stavke = new List <IzlazStavke>();



            if (this.ValidateChildren(ValidationConstraints.Enabled))
            {
                try
                {
                    Izlaz.Datum      = DateTime.Now;
                    Izlaz.BrojRacuna = textBoxBrojracuna.Text;
                    int ID = Convert.ToInt32(comboBoxNarudžba.SelectedValue);
                    Izlaz.KupacID     = DBKupci.SelectKupacByNarudzbaID(ID).KupacID;
                    Izlaz.Zakljucen   = true;
                    Izlaz.NarudzbaID  = ID;
                    Izlaz.IznosBezPDV = Convert.ToDecimal(textBoxIznos.Text);
                    Izlaz.IznosSaPDV  = Convert.ToDecimal(textBoxUkupno.Text);
                    Izlaz.NarudzbaID  = ID;

                    List <SelectIgreByNarudzbaID_Result> Igre = DBProizvodi.SelectByNarudzbaID(ID);

                    foreach (SelectIgreByNarudzbaID_Result ig in Igre)
                    {
                        IzlazStavke stavka = new IzlazStavke();
                        stavka.ProizvodID = ig.IgraID;
                        stavka.Kolicina   = ig.Kolicina;
                        stavka.Cijena     = ig.Cijena;
                        Stavke.Add(stavka);
                    }


                    DBIzlazi.Insert(Izlaz, Stavke);
                    MessageBox.Show(global.GetString("izlaz_succ"), "Izlaz", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Ejemplo n.º 11
0
        //Funkcija koja se poziva iz web dijela aplikacije
        public static List <Igre> GetSlicneProizvode(int proizvodId)
        {
            UcitajProizvode(proizvodId);
            List <Ocjene> ocjene = connection.db.Ocjene.Where(x => x.ProizvodID == proizvodId).OrderBy(x => x.KupacID).ToList();

            List <Ocjene> zajednickeOcjene1 = new List <Ocjene>();
            List <Ocjene> zajednickeOcjene2 = new List <Ocjene>();

            List <Igre> preporuceno = new List <Igre>();

            //Prva petlja - lista svih proizvoda (ne uključujući onaj koji je proslijeđen u funkciju)
            foreach (var item in proizvodi)
            {
                foreach (Ocjene o in ocjene)      //Sve ocjene aktivnog proizvoda
                {
                    //Provjeriti da li je naredni proizvod (iz liste proizvodi) ocijenio isti kupac
                    if (item.Value.Where(x => x.KupacID == o.KupacID).Count() > 0)
                    {
                        zajednickeOcjene1.Add(o);
                        zajednickeOcjene2.Add(item.Value.Where(x => x.KupacID == o.KupacID).First());
                    }
                }

                //Za računanje sličnosti se uzimaju samo zajedničke ocjene, odnosno ocjene istih kupaca za oba proizvoda
                double slicnost = GetSlicnost(zajednickeOcjene1, zajednickeOcjene2);
                if (slicnost > 0.6)     //Granična vrijednost (treshold)
                {
                    preporuceno.Add(DBProizvodi.IgreSelectByID(item.Key));
                    preporuceno.Remove(DBProizvodi.IgreSelectByID(proizvodId));
                }
                zajednickeOcjene1.Clear();
                zajednickeOcjene2.Clear();
            }

            //Lista preporučenih proizvoda
            return(preporuceno);
        }
Ejemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int  ID   = Convert.ToInt32(Request.QueryString["id"]);
            Igre igra = DBProizvodi.IgreSelectByID(ID);

            lblNaziv.Text          = igra.Naziv.ToString();
            lblDatumIzdavanja.Text = igra.DatumIzdavanja.ToString();
            lblIzdavac.Text        = igra.Izdavaci.Ime.ToString();
            lblOpis.Text           = igra.Opis.ToString();
            lblCijena.Text         = Math.Round(igra.Cijena, 2).ToString() + "KM";
            lblVrsta.Text          = igra.Vrsta.Naziv;


            Image image = (Image)Slika;

            image.ImageUrl = "ImageHandlerr.ashx?IgraID=" + ID;


            video.Src = igra.Trailer;



            PID = ID;
            BinditemBasedPreporuke();

            if (preporukaListaProizvoda.Count() < 1)
            {
                ItemBasedPreporukaGrid.Visible = false;
                prepo.Visible = false;
            }
            else
            {
                ItemBasedPreporukaGrid.Visible = true;
                prepo.Visible = true;
            }
        }
Ejemplo n.º 13
0
 private void bindIGre()
 {
     comboBoxIgre.DataSource    = DBProizvodi.GetIgreAll();
     comboBoxIgre.ValueMember   = "IgraID";
     comboBoxIgre.DisplayMember = "Naziv";
 }
Ejemplo n.º 14
0
 private void frmIgreVrsta_Load(object sender, EventArgs e)
 {
     inputVrsta.DataSource    = DBProizvodi.GetVrstaAll();
     inputVrsta.DisplayMember = "Naziv";
     inputVrsta.ValueMember   = "VrstaID";
 }
Ejemplo n.º 15
0
 private void frmDodajAukciju_Load(object sender, EventArgs e)
 {
     comboBoxIgre.DataSource    = DBProizvodi.GetIgreAll();
     comboBoxIgre.DisplayMember = "Naziv";
     comboBoxIgre.ValueMember   = "IgraID";
 }
Ejemplo n.º 16
0
 private void BindVrste()
 {
     VrstaList.DataSource = DBProizvodi.GetVrstaAll();
     VrstaList.DataBind();
 }
Ejemplo n.º 17
0
 private void BindIGre()
 {
     dataGridView1.AutoGenerateColumns = false;
     dataGridView1.DataSource          = DBProizvodi.GetIgreAll();
 }
Ejemplo n.º 18
0
 private void BindVrsta()
 {
     comboBoxVrsta.DataSource    = DBProizvodi.GetVrstaAll();
     comboBoxVrsta.ValueMember   = "VrstaID";
     comboBoxVrsta.DisplayMember = "Naziv";
 }
Ejemplo n.º 19
0
 private void BindIzdavaci()
 {
     comboBoxIzdavaci.DataSource    = DBProizvodi.GetIzdavaciAll();
     comboBoxIzdavaci.ValueMember   = "IzdavacID";
     comboBoxIzdavaci.DisplayMember = "Ime";
 }