示例#1
0
        private void bindAukcije()
        {
            int id = DBKupci.SelectIDByKorisnickoIme(User.Identity.Name);

            aukcije.DataSource = DBAukcija.AukcijeByKorisnik(id);
            aukcije.DataBind();
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int ID = Convert.ToInt32(Request.QueryString["id"]);

            Services.Data.Aukcije aukc = DBAukcija.SelectByID(ID);

            LabelNaslov.Text = aukc.Igre.Naziv;

            LabelPočetak.Text = aukc.DatumOD.ToShortDateString();
            LabelKraj.Text    = aukc.DatumDO.ToShortDateString();

            int id = DBKupci.SelectIDByKorisnickoIme(User.Identity.Name);

            List <Services.Data.AukcijeBYKupac_Result1> ponude = DBAukcija.AukcijeByKorisnik(id);

            decimal po = 0;

            foreach (AukcijeBYKupac_Result1 auk in ponude)
            {
                if (auk.AukcijeID == ID)
                {
                    if (auk.Ponuda > po)
                    {
                        po = auk.Ponuda;
                    }
                }
            }

            LabelTrenutna.Text = po.ToString();



            Image1.ImageUrl = "imageHandler.ashx?id=" + ID;
        }
示例#3
0
        protected void dodajOcjenu_Click(object sender, EventArgs e)
        {
            if (User.Identity.Name != "")
            {
                int KupacID = DBKupci.SelectIDByKorisnickoIme(User.Identity.Name);
                int ocjena  = Convert.ToInt32(Ocjena.SelectedValue);

                int ID = Convert.ToInt32(Request.QueryString["id"]);


                Ocjene oc = new Ocjene();

                oc.Ocjena     = ocjena;
                oc.KupacID    = KupacID;
                oc.ProizvodID = ID;
                oc.Datum      = DateTime.UtcNow;

                DBOcjene.InsertOcjene(oc);

                Labelerror.Text = "Uspješno ste ocjenili proizvod!";
            }
            else
            {
                Labelerror.Text = "Da bi ste ocjenili proizvod morate biti logirani!";
            }
        }
示例#4
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;
            }
        }
示例#5
0
        protected void Unnamed10_Click(object sender, EventArgs e)
        {
            Kupci kupac = new Kupci();

            kupac.Ime               = imeInput.Text;
            kupac.Prezime           = prezimeInput.Text;
            kupac.DatumRegistracije = DateTime.Now;
            kupac.Email             = Email.Text;
            kupac.KorisnickoIme     = korisnickoIme.Text;
            kupac.LozinkaSalt       = Services.Util.UiHelper.GenerateSalt();
            kupac.LozinkaHash       = Services.Util.UiHelper.GenerateHash(Password.Text, kupac.LozinkaSalt);

            DBKupci.KupciInsert(kupac);
        }
示例#6
0
        protected void glasaj_Click(object sender, EventArgs e)
        {
            int KupacID   = DBKupci.SelectIDByKorisnickoIme(User.Identity.Name);
            int ZahtjevID = Convert.ToInt32(Request.QueryString["id"]);

            if (DBZahtjevi.ZahtjeviKupciProvjera(ZahtjevID, KupacID) >= 1)
            {
                LabelError.Text = "Već ste glasali za ovaj zahtjev!";
            }
            else
            {
                DBZahtjevi.ZahtjeviKupciInsert(ZahtjevID, KupacID);
                LabelError.Text = "Uspješno ste glasali";
                glasovi.Text    = DBZahtjevi.SelectZahtjevi(ZahtjevID).ToString();
                pglasova.Text   = (20 - DBZahtjevi.SelectZahtjevi(ZahtjevID)).ToString();
            }
        }
示例#7
0
 protected void ButtonDodaj_Click(object sender, EventArgs e)
 {
     if (TextBoxZahtjev.Text == "")
     {
         zahtjevError.Text = "Unesite vaš zahtjev";
     }
     else
     {
         Services.Data.Zahtjevi zahtjev = new Services.Data.Zahtjevi();
         zahtjev.Naslov = TextBoxZahtjev.Text;
         zahtjev.Datum  = DateTime.Now;
         int KupacID = DBKupci.SelectIDByKorisnickoIme(User.Identity.Name);
         zahtjev.KupacID = KupacID;
         DBZahtjevi.InsertZahtjev(zahtjev);
         BindZahtjevi();
         zahtjevError.Text = "";
     }
 }
示例#8
0
        protected void ButtonDodaj_Click(object sender, EventArgs e)
        {
            int ID = Convert.ToInt32(Request.QueryString["id"]);

            int KupacID = DBKupci.SelectIDByKorisnickoIme(User.Identity.Name);

            if ((TextBoxDodaj.Text == "") || (Convert.ToDecimal(TextBoxDodaj.Text) < Convert.ToDecimal(LabelTrenutna.Text)))
            {
                error.Visible = true;
            }
            else
            {
                error.Visible = false;
                DBAukcija.UpdateAukcija(KupacID, Convert.ToDecimal(TextBoxDodaj.Text), ID);
                LabelTrenutna.Text = TextBoxDodaj.Text;
                TextBoxDodaj.Text  = "";
            }
        }
示例#9
0
        private void bindgrid()
        {
            int id = DBKupci.SelectIDByKorisnickoIme(User.Identity.Name);

            List <SELECTNARUDZBABYKUPAC_Result> Sve = DBNarudzbe.SelectAllNarudzbe(id);

            Sve = Sve.GroupBy(x => x.NarudzbaID).Select(x => x.First()).ToList();


            DropDownListHistory.DataSource = Sve;


            DropDownListHistory.DataValueField = "NarudzbaID";
            DropDownListHistory.DataTextField  = "Datum";



            DropDownListHistory.DataBind();
        }
示例#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);
                }
            }
        }
示例#11
0
        protected void loginbox_Authenticate(object sender, AuthenticateEventArgs e)
        {
            Kupci kupac = DBKupci.SelectByKorisnickoIme(loginbox.UserName, loginbox.Password);

            try
            {
                if (kupac == null)
                {
                    loginbox.FailureText = "Korisnik sa unesenim podatcima ne postoji";
                    e.Authenticated      = false;
                }
                else
                {
                    e.Authenticated = true;
                }
            }
            catch (Exception ex)
            {
                loginbox.FailureText = ex.Message;
                e.Authenticated      = false;
            }
        }