コード例 #1
0
        public IHttpActionResult PutKategorije(int id, Kategorije kategorije)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != kategorije.KategorijaID)
            {
                return(BadRequest());
            }

            db.Entry(kategorije).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!KategorijeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public IHttpActionResult PostDekovi(DekoviCreateVM model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Dekovi dek;

            if (model == null)
            {
                return(BadRequest(ModelState));
            }

            dek            = new Dekovi();
            dek.Ime        = model.Ime;
            dek.KorisnikId = model.KorisnikId;

            // create new category for deck
            Kategorije kategorija = new Kategorije();

            kategorija.Naziv = model.Kategorija;


            db.Dekovi.Add(dek);
            db.Kategorije.Add(kategorija);

            db.SaveChanges();

            return(Ok(dek));
        }
コード例 #3
0
        public IHttpActionResult DeleteDekovi(int DeckId)
        {
            Dekovi     dekovi     = db.Dekovi.Find(DeckId);
            Kategorije kategorije = null;

            // use existing category field to find cateogry
            if (dekovi.KategorijaId != null)
            {
                kategorije = db.Kategorije.Find(dekovi.KategorijaId);
            }

            if (dekovi == null)
            {
                return(NotFound());
            }

            db.Dekovi.Remove(dekovi);

            if (kategorije != null)
            {
                db.Kategorije.Remove(kategorije);
            }

            db.SaveChanges();

            return(Ok(dekovi));
        }
コード例 #4
0
        public IActionResult Snimi(string naziv)
        {
            KorisnickiNalog korisnik = HttpContext.GetLogiraniKorisnik();
            Korisnici       k        = _context.Korisnici.Where(x => x.KorisnickiNalogId == korisnik.Id).FirstOrDefault();

            if (korisnik == null || k.VrstaKorisnikaId != 1)
            {
                TempData["error_poruka"] = "Nemate pravo pristupa!";
                return(Redirect("/Autentifikacija/Index"));
            }

            List <Kategorije> temp1 = _context.Kategorije.ToList();

            foreach (var item in temp1)
            {
                if (item.Naziv == naziv)
                {
                    return(Redirect("/AdministratorModul/Kategorije/Index"));
                }
            }

            Kategorije novo = new Kategorije();

            novo.Naziv = naziv;

            _context.Kategorije.Add(novo);
            _context.SaveChanges();

            return(RedirectToAction("Index"));
        }
コード例 #5
0
        public IActionResult Obrisi(int KategorijeId)
        {
            KorisnickiNalog korisnik = HttpContext.GetLogiraniKorisnik();
            Korisnici       k        = _context.Korisnici.Where(x => x.KorisnickiNalogId == korisnik.Id).FirstOrDefault();

            if (korisnik == null || k.VrstaKorisnikaId != 1)
            {
                TempData["error_poruka"] = "Nemate pravo pristupa!";
                return(Redirect("/Autentifikacija/Index"));
            }

            Dogadjaj temp1 = _context.Dogadjaj.Where(y => y.KategorijeId == KategorijeId).FirstOrDefault();

            if (temp1 != null)
            {
                _context.Dogadjaj.Remove(temp1);
                _context.SaveChanges();
            }

            Kategorije temp = _context.Kategorije.Where(x => x.Id == KategorijeId).FirstOrDefault();

            _context.Kategorije.Remove(temp);
            _context.SaveChanges();

            return(RedirectToAction("Index"));
        }
コード例 #6
0
        public async Task <IActionResult> PutKategorije([FromRoute] int id, [FromBody] Kategorije kategorije)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != kategorije.KategorijaId)
            {
                return(BadRequest());
            }

            _context.Entry(kategorije).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!KategorijeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #7
0
        public async Task <IActionResult> Create(Kategorije kategorija)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    await _ctx.AddAsync(kategorija);

                    await _ctx.SaveChangesAsync();

                    TempData[Constants.Message]       = $"Kategorija {kategorija.Naziv} uspjesno dodana.*";
                    TempData[Constants.ErrorOccurred] = false;
                    return(RedirectToAction(nameof(Index)));
                }
                catch (Exception e)
                {
                    ModelState.AddModelError(string.Empty, e.Message);
                    return(View(kategorija));
                }
            }
            else
            {
                return(View(kategorija));
            }
        }
コード例 #8
0
        protected void btnSacuvaj_Click(object sender, EventArgs e)
        {
            int katID = Convert.ToInt32(ddlKategorije.SelectedValue);

            Kategorije k = DANekretnine.getKategorijeByID(katID);

            Nekretnine n = new Nekretnine();

            n.Adresa           = tbAdresa.Text;
            n.Aktivna          = true;
            n.BrojKvadrata     = Convert.ToInt32(tbKvadrati.Text);
            n.BrojPosjeta      = 0;
            n.Cijena           = Convert.ToDouble(tbCijena.Text);
            n.DatumObjave      = DateTime.Now;
            n.Garaža           = cbGaraza.Checked;
            n.GodinaIzgradnje  = Convert.ToInt32(tbGodina.Text);
            n.GrijanjeID       = Convert.ToInt32(ddlGrijanje.SelectedValue);
            n.Internet         = cbInternet.Checked;
            n.KategorijaID     = Convert.ToInt32(ddlKategorije.SelectedValue);
            n.Knalizacija      = cbKanalizacija.Checked;
            n.Lift             = cbLift.Checked;
            n.Namješten        = cbNamjesten.Checked;
            n.Naslov           = tbNaslov.Text;
            n.NedavnoAdaptiran = cbAdaptiran.Checked;
            n.Novogradnja      = cbNovogradnja.Checked;
            n.Parking          = cbParking.Checked;
            n.SobeID           = Convert.ToInt32(ddlSobe.SelectedValue);
            n.SpratID          = Convert.ToInt32(ddlSprat.SelectedValue);
            n.StanjeID         = Convert.ToInt32(ddlStanje.SelectedValue);
            n.Struja           = cbStruja.Checked;
            n.Telefon          = cbTelefon.Checked;
            n.Uknjiženo        = cbUknjizeno.Checked;
            n.Voda             = cbVoda.Checked;
            n.VrstaID          = Convert.ToInt32(ddlVrste.SelectedValue);
            n.KantonID         = Convert.ToInt32(ddlKantoni.SelectedValue);

            n.KorisnikID = logirani;

            //Spašavanje slike
            byte[] slika = uploadImage(n);

            int id  = DANekretnine.insertID(n);
            int idG = Convert.ToInt32(ddlGrad.SelectedValue);

            List <string> mailovi = DANekretnine.PotraznjaKorisniciEmail(idG);

            foreach (var item in mailovi)
            {
                SendMail(item, n);
            }

            uploadImagesALL(id, slika);
            //Spašavanje slike



            clear();
            Response.Redirect("/Naslovna.aspx");
        }
コード例 #9
0
 public SekcijePage(Kategorije kategorija)
 {
     InitializeComponent();
     BindingContext = model = new SekcijeViewModel()
     {
         Kategorija = kategorija
     };
 }
コード例 #10
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Kategorije kategorije = await db.Kategorije.FindAsync(id);

            db.Kategorije.Remove(kategorije);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
コード例 #11
0
        public IHttpActionResult GetKategorije(int id)
        {
            Kategorije kategorije = db.Kategorije.Find(id);

            if (kategorije == null)
            {
                return(NotFound());
            }

            return(Ok(kategorije));
        }
コード例 #12
0
        public Kategorije Update(Kategorije request, int id)
        {
            var temp = _db.Kategorija.Find(id) ?? throw new ServerException(Constants.NotFoundErrorMessage + id);

            _mapper.Map(request, temp);

            _db.Kategorija.Update(temp);
            _db.SaveChanges();

            return(request);
        }
コード例 #13
0
        public IHttpActionResult PostKategorije(Kategorije kategorije)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Kategorije.Add(kategorije);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = kategorije.KategorijaID }, kategorije));
        }
コード例 #14
0
        public async Task <IActionResult> PostKategorije([FromBody] Kategorije kategorije)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Kategorije.Add(kategorije);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetKategorije", new { id = kategorije.KategorijaId }, kategorije));
        }
コード例 #15
0
        public async Task <ActionResult> Edit([Bind(Include = "KategorijaID,PredmetID,KategorijaName")] Kategorije kategorije)
        {
            if (ModelState.IsValid)
            {
                db.Entry(kategorije).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.PredmetID = new SelectList(db.Predmeti, "PredmetID", "PredmetName", kategorije.PredmetID);
            return(View(kategorije));
        }
コード例 #16
0
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Kategorije kategorije = await db.Kategorije.FindAsync(id);

            if (kategorije == null)
            {
                return(HttpNotFound());
            }
            return(View(kategorije));
        }
コード例 #17
0
        public IHttpActionResult DeleteKategorije(int id)
        {
            Kategorije kategorije = db.Kategorije.Find(id);

            if (kategorije == null)
            {
                return(NotFound());
            }

            db.Kategorije.Remove(kategorije);
            db.SaveChanges();

            return(Ok(kategorije));
        }
コード例 #18
0
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Kategorije kategorije = await db.Kategorije.FindAsync(id);

            if (kategorije == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PredmetID = new SelectList(db.Predmeti, "PredmetID", "PredmetName", kategorije.PredmetID);
            return(View(kategorije));
        }
コード例 #19
0
        public Kategorije Insert(Kategorije request)
        {
            var validation1 = _db.Kategorija.Where(x => x.Naziv == request.Naziv).FirstOrDefault();

            if (validation1 != null)
            {
                throw new UserException(Constants.AlreadyExistsErrorMessag + request.Naziv);
            }

            var temp = _mapper.Map <Database.Kategorija>(request);

            _db.Kategorija.Add(temp);
            _db.SaveChanges();

            return(request);
        }
コード例 #20
0
        public async Task <IActionResult> Update(int id, int page = 1, int sort = 1, bool ascending = true)
        {
            try
            {
                Kategorije kategorija = await _ctx.Kategorije.FindAsync(id);

                if (kategorija == null)
                {
                    return(NotFound($"Ne postoji kategorija s oznakom {id}"));
                }

                ViewBag.Page      = page;
                ViewBag.Sort      = sort;
                ViewBag.Ascending = ascending;
                bool ok = await TryUpdateModelAsync <Kategorije>(kategorija,
                                                                 "", b => b.IdKategorije, b => b.Naziv);

                if (ok)
                {
                    try
                    {
                        TempData[Constants.Message]       = $"Kategorija {kategorija.Naziv} uspjesno azurirana.*";
                        TempData[Constants.ErrorOccurred] = false;
                        await _ctx.SaveChangesAsync();

                        return(RedirectToAction(nameof(Index), new { page, sort, ascending }));
                    }
                    catch (Exception e)
                    {
                        ModelState.AddModelError(string.Empty, e.Message);
                        return(View(kategorija));
                    }
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "Podatke o kategoriji nije moguce povezati.");
                    return(View(kategorija));
                }
            }
            catch (Exception e)
            {
                TempData[Constants.Message]       = "Pogreska prilikom azuriranja kategorije." + e.Message;
                TempData[Constants.ErrorOccurred] = true;
                return(RedirectToAction(nameof(Edit), new { id, page, sort, ascending }));
            }
        }
コード例 #21
0
ファイル: Obrada.cs プロジェクト: vrana28/VesaloIgrica_Klk2
        private char[] VratiPojam(Kategorije kat)
        {
            Kategorije k = s.kateogorije.Single(s => s.KateogrijeId == kat.KateogrijeId);
            Random     r = new Random();

            Pojam            = k.Pojmovi[r.Next(k.Pojmovi.Count)];
            pojamZaKorisnika = new char[Pojam.Length];
            brojPokusaja     = Pojam.Length + 8;
            for (int i = 0; i < Pojam.Length; i++)
            {
                if (Pojam[i] == ' ')
                {
                    pojamZaKorisnika[i] = ' ';
                }
                else
                {
                    pojamZaKorisnika[i] = '*';
                }
            }
            return(pojamZaKorisnika);
        }
コード例 #22
0
        private void DodajBtn_Click(object sender, EventArgs e)
        {
            if (this.ValidateChildren())
            {
                Kategorije k = new Kategorije();
                k.Naziv = NazivTxt.Text;

                HttpResponseMessage response = KategorijeService.PostResponse(k);

                if (response.IsSuccessStatusCode)
                {
                    MessageBox.Show("Uspjesno dodana kategorija", "Dodano", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                else
                {
                    string msg = response.ReasonPhrase;

                    MessageBox.Show("Kategorija vec postoji");
                }
            }
        }
コード例 #23
0
        public IActionResult SnimiPromjene(int KategorijeId, string naziv)
        {
            KorisnickiNalog korisnik = HttpContext.GetLogiraniKorisnik();
            Korisnici       k        = _context.Korisnici.Where(x => x.KorisnickiNalogId == korisnik.Id).FirstOrDefault();

            if (korisnik == null || k.VrstaKorisnikaId != 1)
            {
                TempData["error_poruka"] = "Nemate pravo pristupa!";
                return(Redirect("/Autentifikacija/Index"));
            }

            Kategorije novo = _context.Kategorije.Where(x => x.Id == KategorijeId).FirstOrDefault();



            _context.Kategorije.Update(novo);
            _context.SaveChanges();



            return(RedirectToAction("Index"));
        }
コード例 #24
0
        //private void comboBoxKategorije_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    Kategorije k = (Kategorije)comboBoxKategorije.SelectedItem;

        //    if (k.KategorijaID != 0)
        //    {
        //        if (k.NazivKategorije == "Garaže")
        //        {
        //            comboBoxGrijanje.Enabled = false;
        //            comboBoxSobe.Enabled = false;
        //            comboBoxSprat.Enabled = false;

        //            checkBoxGaraža.Enabled = false;
        //            checkBoxInternet.Enabled = false;
        //            checkBoxLift.Enabled = false;
        //            checkBoxNamješten.Enabled = false;
        //            checkBoxParking.Enabled = false;
        //            checkBoxTelefon.Enabled = false;
        //        }

        //        if (k.NazivKategorije == "Kuće" || k.NazivKategorije == "Vikendice")
        //        {
        //            comboBoxSprat.Enabled = false;
        //            comboBoxSobe.Enabled = false;
        //        }
        //    }
        //}

        private void dodajButton_Click(object sender, EventArgs e)
        {
            int kkk = Convert.ToInt32(Global.prijavljeniKorisnik.KorisnikID);

            if (this.ValidateChildren(ValidationConstraints.Enabled))
            {
                Kategorije k = (Kategorije)comboBoxKategorije.SelectedItem;

                //if (k.NazivKategorije == "Garaže")
                //{
                //    Nekretnine n = new Nekretnine();

                //    n.Adresa = tbAdresa.Text;
                //    n.Aktivna = checkBoxAktivna.Checked;
                //    n.BrojKvadrata = Convert.ToInt32(tbBrojKvadrata.Text);
                //    n.BrojPosjeta = 0;
                //    n.Cijena = Convert.ToDouble(cijenaInput.Text);
                //    n.DatumObjave = DateTime.Now;
                //    n.GodinaIzgradnje = Convert.ToInt32(textBoxGodina.Text);
                //    n.KategorijaID = Convert.ToInt32(comboBoxKategorije.SelectedValue);
                //    n.Naslov = tbNaslov.Text;
                //    n.NedavnoAdaptiran = checkBoxNedavnoAdaptiran.Checked;
                //    n.Novogradnja = checkBoxNovogradnja.Checked;
                //    n.StanjeID = Convert.ToInt32(comboBoxStanje.SelectedValue);
                //    n.Struja = checkBoxStruja.Checked;
                //    n.Uknjiženo = checkBoxUknjiženo.Checked;
                //    n.VrstaID = Convert.ToInt32(comboVrste.SelectedValue);
                //    n.KantonID = Convert.ToInt32(comboBox1.SelectedValue);
                //    n.SpratID = null;
                //    n.KorisnikID = kkk;
                //    n.GrijanjeID = null;
                //    n.Internet = null;

                //    //Spašavanje slike

                //    if (pictureBox1.Image != null)
                //    {
                //        using (MemoryStream ms = new MemoryStream())
                //        {
                //            pictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                //            n.SlikaThumb = ms.ToArray();
                //        }
                //    }

                //    DANekretnine.insert(n);

                //    MessageBox.Show(Global.GetString("nekre_succ"), "Korisnik", MessageBoxButtons.OK, MessageBoxIcon.Information);

                //    clear();
                //}

                //if (k.NazivKategorije == "Kuće" || k.NazivKategorije == "Vikendice")
                //{
                //    Nekretnine n = new Nekretnine();
                //    n.Adresa = tbAdresa.Text;
                //    n.Aktivna = checkBoxAktivna.Checked;
                //    n.BrojKvadrata = Convert.ToInt32(tbBrojKvadrata.Text);
                //    n.BrojPosjeta = 0;
                //    n.Cijena = Convert.ToDouble(cijenaInput.Text);
                //    n.DatumObjave = DateTime.Now;
                //    n.Garaža = checkBoxGaraža.Checked;
                //    n.GodinaIzgradnje = Convert.ToInt32(textBoxGodina.Text);
                //    n.GrijanjeID = Convert.ToInt32(comboBoxGrijanje.SelectedValue);
                //    n.Internet = checkBoxInternet.Checked;
                //    n.KategorijaID = Convert.ToInt32(comboBoxKategorije.SelectedValue);
                //    n.Knalizacija = checkBoxKanalizacija.Checked;
                //    n.Namješten = checkBoxNamješten.Checked;
                //    n.Naslov = tbNaslov.Text;
                //    n.NedavnoAdaptiran = checkBoxNedavnoAdaptiran.Checked;
                //    n.Novogradnja = checkBoxNovogradnja.Checked;
                //    n.Parking = checkBoxParking.Checked;
                //    n.StanjeID = Convert.ToInt32(comboBoxStanje.SelectedValue);
                //    n.Struja = checkBoxStruja.Checked;
                //    n.Telefon = checkBoxTelefon.Checked;
                //    n.Uknjiženo = checkBoxUknjiženo.Checked;
                //    n.Voda = checkBoxVoda.Checked;
                //    n.VrstaID = Convert.ToInt32(comboVrste.SelectedValue);
                //    n.KantonID = Convert.ToInt32(comboBox1.SelectedValue);
                //    n.KorisnikID = kkk;


                //    //Spašavanje slike

                //    if (pictureBox1.Image != null)
                //    {
                //        using (MemoryStream ms = new MemoryStream())
                //        {
                //            pictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                //            n.SlikaThumb = ms.ToArray();
                //        }
                //    }

                //    DANekretnine.insert(n);
                //    MessageBox.Show(Global.GetString("nekre_succ"), "Korisnik", MessageBoxButtons.OK, MessageBoxIcon.Information);

                //    clear();
                //}
                //else
                //{

                if (Validacija() == true)
                {
                    Nekretnine n = new Nekretnine();

                    //   if(comboBoxSobe.SelectedIndex==0)
                    //   {
                    //       n.SobeID = null;
                    //   }
                    //else
                    //   {
                    //       n.SobeID = Convert.ToInt32(comboBoxSobe.SelectedValue); ;
                    //   }
                    //if(comboBoxGrijanje.SelectedIndex==0)
                    //{
                    //    n.GrijanjeID = null;
                    //}
                    //else
                    //{
                    //    n.GrijanjeID = Convert.ToInt32(comboBoxGrijanje.SelectedValue); ;
                    //}
                    //if(comboBoxSprat.SelectedIndex==0)
                    //{
                    //    n.SpratID = null;
                    //}
                    //else
                    //{
                    //    n.SpratID = Convert.ToInt32(comboBoxSprat.SelectedValue); ;
                    //}
                    n.Adresa          = tbAdresa.Text;
                    n.Aktivna         = checkBoxAktivna.Checked;
                    n.BrojKvadrata    = Convert.ToInt32(tbBrojKvadrata.Text);
                    n.BrojPosjeta     = 0;
                    n.Cijena          = Convert.ToDouble(cijenaInput.Text);
                    n.DatumObjave     = DateTime.Now;
                    n.Garaža          = checkBoxGaraža.Checked;
                    n.GodinaIzgradnje = Convert.ToInt32(textBoxGodina.Text);
                    //n.GrijanjeID = Convert.ToInt32(comboBoxGrijanje.SelectedValue);
                    n.Internet         = checkBoxInternet.Checked;
                    n.KategorijaID     = Convert.ToInt32(comboBoxKategorije.SelectedValue);
                    n.Knalizacija      = checkBoxKanalizacija.Checked;
                    n.Lift             = checkBoxLift.Checked;
                    n.Namješten        = checkBoxNamješten.Checked;
                    n.Naslov           = tbNaslov.Text;
                    n.NedavnoAdaptiran = checkBoxNedavnoAdaptiran.Checked;
                    n.Novogradnja      = checkBoxNovogradnja.Checked;
                    n.Parking          = checkBoxParking.Checked;
                    n.SobeID           = Convert.ToInt32(comboBoxSobe.SelectedValue);
                    // n.SpratID = Convert.ToInt32(comboBoxSprat.SelectedValue);
                    n.StanjeID   = Convert.ToInt32(comboBoxStanje.SelectedValue);
                    n.Struja     = checkBoxStruja.Checked;
                    n.Telefon    = checkBoxTelefon.Checked;
                    n.Uknjiženo  = checkBoxUknjiženo.Checked;
                    n.Voda       = checkBoxVoda.Checked;
                    n.VrstaID    = Convert.ToInt32(comboVrste.SelectedValue);
                    n.KantonID   = Convert.ToInt32(comboBox1.SelectedValue);
                    n.KorisnikID = kkk;

                    //Spašavanje slike

                    if (pictureBox1.Image != null)
                    {
                        using (MemoryStream ms = new MemoryStream())
                        {
                            pictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                            n.SlikaThumb = ms.ToArray();
                        }
                    }

                    DANekretnine.insert(n);
                    MessageBox.Show(Global.GetString("nekre_succ"), "Korisnik", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    clear();
                }
                else
                {
                    errorProvider1.SetError(dodajButton, Global.GetString("sobe_req"));
                    MessageBox.Show(Global.GetString("nekre_bad"), "Upozorenje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
コード例 #25
0
 //INSERT
 public Kategorije Insert(Kategorije kategorija)
 {
     kategorije.InsertOne(kategorija);
     return(kategorija);
 }
コード例 #26
0
        private void kategorijePicker_SelectedIndexChanged(object sender, EventArgs e)
        {
            hideAll();

            Kategorije k = (kategorijePicker.SelectedItem as Kategorije);

            if (k != null)
            {
                kId = k.KategorijaID;

                izaberiteLbl.IsVisible = false;

                pronadjiBtn.IsVisible = true;

                if (k.KategorijaID == 2) //baterija
                {
                    pronadjiBtn.IsVisible = true;
                    editor.IsVisible      = true;

                    prvi.IsVisible    = true;
                    prviTxt.IsVisible = true;
                    prviTxt.Text      = "Uređaj se gasi i kada je baterija preko 10 %";

                    drugi.IsVisible    = true;
                    drugiTxt.IsVisible = true;
                    drugiTxt.Text      = "Baterija se lagano \"napuhala\"";

                    treci.IsVisible    = true;
                    treciTxt.IsVisible = true;
                    treciTxt.Text      = "Postoje nagli padovi u postotcima napunjenosti baterije (npr. pad sa 50 na 20% za jednu minutu)";

                    cetvrti.IsVisible    = true;
                    cetvrtiTxt.IsVisible = true;
                    cetvrtiTxt.Text      = "Baterija se sporo puni";

                    peti.IsVisible    = true;
                    petiTxt.IsVisible = true;
                    petiTxt.Text      = "Ne reaguje na punjenje";
                }
                else if (k.KategorijaID == 10) //punjenje
                {
                    pronadjiBtn.IsVisible = true;
                    editor.IsVisible      = true;

                    prvi.IsVisible    = true;
                    prviTxt.IsVisible = true;
                    prviTxt.Text      = "Uređaj ne reaguje na punjač";

                    drugi.IsVisible    = true;
                    drugiTxt.IsVisible = true;
                    drugiTxt.Text      = "Konektor punjenja je klimav";

                    treci.IsVisible    = true;
                    treciTxt.IsVisible = true;
                    treciTxt.Text      = "Uređaj se puni ali vrlo sporo ";

                    cetvrti.IsVisible    = true;
                    cetvrtiTxt.IsVisible = true;
                    cetvrtiTxt.Text      = "Punjenje se prekida";

                    peti.IsVisible    = true;
                    petiTxt.IsVisible = true;
                    petiTxt.Text      = "Uređaj prepoznaje punjač ali ne puni mobitel";
                }
                else if (k.KategorijaID == 11) //displey
                {
                    pronadjiBtn.IsVisible = true;
                    editor.IsVisible      = true;

                    prvi.IsVisible    = true;
                    prviTxt.IsVisible = true;
                    prviTxt.Text      = "Ekran uopšte ne daje sliku";

                    drugi.IsVisible    = true;
                    drugiTxt.IsVisible = true;
                    drugiTxt.Text      = "Bijela svjetlost bez slike";

                    treci.IsVisible    = true;
                    treciTxt.IsVisible = true;
                    treciTxt.Text      = "Linije raznih boja po ekranu ";

                    cetvrti.IsVisible    = true;
                    cetvrtiTxt.IsVisible = true;
                    cetvrtiTxt.Text      = "Samo dio slike se prikazuje";

                    peti.IsVisible    = true;
                    petiTxt.IsVisible = true;
                    petiTxt.Text      = "Slika se prikazuje ali touch ne radi";
                }
                else if (k.KategorijaID == 13) //boot loop
                {
                    pronadjiBtn.IsVisible = true;
                    editor.IsVisible      = true;

                    prvi.IsVisible    = true;
                    prviTxt.IsVisible = true;
                    prviTxt.Text      = "Uređaj se u kontiniutetu resetuje";

                    drugi.IsVisible    = true;
                    drugiTxt.IsVisible = true;
                    drugiTxt.Text      = "Uređaj se ugasi tokom rada";

                    treci.IsVisible    = true;
                    treciTxt.IsVisible = true;
                    treciTxt.Text      = "Uređaj se vrlo dugo pali ";
                }
                else
                {
                    nemaLbl.IsVisible     = true;
                    pronadjiBtn.IsVisible = false;
                }
            }
            else
            {
                kId = 0;
                izaberiteLbl.IsVisible = true;
            }
        }
コード例 #27
0
 public IActionResult SetEditCategory(Kategorije kategorija)
 {
     _kategorijeServices.UpdateCategory(kategorija);
     return(RedirectToAction("adminPanel"));
 }
コード例 #28
0
ファイル: DbInitializer.cs プロジェクト: nmedan/Oglasi-sajt
        public static void Initialize(ApplicationDbContext context)
        {
            context.Database.EnsureCreated();
            if (context.Kategorije.Count() == 0)
            {
                var Kategorije = new Kategorije[]
                {
                    new Kategorije {
                        NazivKategorije = "Automobili, vozila"
                    },
                    new Kategorije {
                        NazivKategorije = "Domaćinstvo"
                    },
                    new Kategorije {
                        NazivKategorije = "Građevinarstvo"
                    },
                    new Kategorije {
                        NazivKategorije = "Industrija i zanatstvo"
                    },
                    new Kategorije {
                        NazivKategorije = "Kolekcionarstvo"
                    },
                    new Kategorije {
                        NazivKategorije = "Kućni ljubimci"
                    },
                    new Kategorije {
                        NazivKategorije = "Nekretnine"
                    },
                    new Kategorije {
                        NazivKategorije = "Obaveštenja"
                    },
                    new Kategorije {
                        NazivKategorije = "Odeća, obuća, nakit"
                    },
                    new Kategorije {
                        NazivKategorije = "Poljoprivreda"
                    },
                    new Kategorije {
                        NazivKategorije = "Poslovi"
                    },
                    new Kategorije {
                        NazivKategorije = "Računari"
                    },
                    new Kategorije {
                        NazivKategorije = "Razno"
                    },
                    new Kategorije {
                        NazivKategorije = "Sport"
                    },
                    new Kategorije {
                        NazivKategorije = "Tehnika"
                    },
                    new Kategorije {
                        NazivKategorije = "Turizam i ugostiteljstvo"
                    },
                    new Kategorije {
                        NazivKategorije = "Usluge"
                    },
                };
                foreach (Kategorije k in Kategorije)
                {
                    context.Kategorije.Add(k);
                }
                context.SaveChanges();
            }

            if (context.Potkategorije.Count() == 0)
            {
                var Potkategorije = new Potkategorije[]
                {
                    new Potkategorije {
                        NazivPotkategorije = "Auto delovi i oprema", KategorijeId = 3002
                    },
                    new Potkategorije {
                        NazivPotkategorije = "Automobili", KategorijeId = 3002
                    },
                    new Potkategorije {
                        NazivPotkategorije = "Bicikli", KategorijeId = 3002
                    },
                    new Potkategorije {
                        NazivPotkategorije = "Čamci i drugi plovni objekti", KategorijeId = 3002
                    },
                    new Potkategorije {
                        NazivPotkategorije = "Havarisana vozila", KategorijeId = 3002
                    },
                    new Potkategorije {
                        NazivPotkategorije = "Kamioni i autobusi", KategorijeId = 3002
                    },
                    new Potkategorije {
                        NazivPotkategorije = "Motocikli", KategorijeId = 3002
                    },
                    new Potkategorije {
                        NazivPotkategorije = "Prikolice", KategorijeId = 3002
                    },
                    new Potkategorije {
                        NazivPotkategorije = "Aparati za domaćinstvo", KategorijeId = 3003
                    },
                    new Potkategorije {
                        NazivPotkategorije = "Nameštaj", KategorijeId = 3003
                    },
                    new Potkategorije {
                        NazivPotkategorije = "Usluge u domaćinstvu", KategorijeId = 3003
                    },
                    new Potkategorije {
                        NazivPotkategorije = "Elektro materijal", KategorijeId = 3004
                    },
                    new Potkategorije {
                        NazivPotkategorije = "Građevinske mašine", KategorijeId = 3004
                    },
                    new Potkategorije {
                        NazivPotkategorije = "Građevinski materijal", KategorijeId = 3004
                    },
                    new Potkategorije {
                        NazivPotkategorije = "Keramika, sanitarija", KategorijeId = 3004
                    },
                    new Potkategorije {
                        NazivPotkategorije = "Usluge u građevinarstvu", KategorijeId = 3004
                    },
                    new Potkategorije {
                        NazivPotkategorije = "Birotehnička oprema", KategorijeId = 3005
                    },
                    new Potkategorije {
                        NazivPotkategorije = "Goriva i maziva", KategorijeId = 3005
                    },
                    new Potkategorije {
                        NazivPotkategorije = "Mašine i alati", KategorijeId = 3005
                    },
                    new Potkategorije {
                        NazivPotkategorije = "Zaštitna oprema i uređaju", KategorijeId = 3005
                    },
                };
                foreach (Potkategorije p in Potkategorije)
                {
                    context.Potkategorije.Add(p);
                }
                context.SaveChanges();
            }



            if (context.Gradovi.Count() == 0)
            {
                var Gradovi = new Gradovi[]
                {
                    new Models.Gradovi {
                        ImeGrada = "Beograd"
                    },
                    new Models.Gradovi {
                        ImeGrada = "Novi Sad"
                    },
                    new Models.Gradovi {
                        ImeGrada = "Niš"
                    },
                };
                foreach (Gradovi g in Gradovi)
                {
                    context.Gradovi.Add(g);
                }
                context.SaveChanges();
            }

            if (context.OglasiPotkategorije.Count() == 0)
            {
                var OglasiPotkategorije = new OglasiPotkategorije[]
                {
                    new Models.OglasiPotkategorije {
                        OglasiId = 34, PotkategorijeId = 50
                    },
                    new Models.OglasiPotkategorije {
                        OglasiId = 36, PotkategorijeId = 45
                    },
                    new Models.OglasiPotkategorije {
                        OglasiId = 35, PotkategorijeId = 47
                    },
                    new Models.OglasiPotkategorije {
                        OglasiId = 36, PotkategorijeId = 48
                    },
                    new Models.OglasiPotkategorije {
                        OglasiId = 37, PotkategorijeId = 54
                    },
                    new Models.OglasiPotkategorije {
                        OglasiId = 38, PotkategorijeId = 54
                    },
                    new Models.OglasiPotkategorije {
                        OglasiId = 35, PotkategorijeId = 54
                    },
                    new Models.OglasiPotkategorije {
                        OglasiId = 36, PotkategorijeId = 54
                    },
                    new Models.OglasiPotkategorije {
                        OglasiId = 36, PotkategorijeId = 52
                    },
                    new Models.OglasiPotkategorije {
                        OglasiId = 34, PotkategorijeId = 54
                    },
                };
                foreach (OglasiPotkategorije og in OglasiPotkategorije)
                {
                    context.OglasiPotkategorije.Add(og);
                }
                context.SaveChanges();
            }

            if (context.Oglasi.Count() == 0)
            {
                var Oglasi = new Models.Oglasi[]
                {
                    new  Models.Oglasi {
                        Naslov      = "Oglas1", DatumObjave = new DateTime(2018, 03, 22).Date,
                        DatumIsteka = new DateTime(2018, 04, 27), GradoviId = 2, Cena = 3000, TekstOglasa = "Oglas1"
                    },
                    new  Models.Oglasi {
                        Naslov      = "Oglas2", DatumObjave = new DateTime(2018, 03, 21).Date,
                        DatumIsteka = new DateTime(2018, 04, 25), GradoviId = 1, Cena = 3000, TekstOglasa = "Oglas2"
                    },
                    new  Models.Oglasi {
                        Naslov      = "Oglas3", DatumObjave = new DateTime(2018, 03, 20).Date,
                        DatumIsteka = new DateTime(2018, 04, 27), GradoviId = 3, Cena = 3000, TekstOglasa = "Oglas3"
                    },
                    new  Models.Oglasi {
                        Naslov      = "Oglas4", DatumObjave = new DateTime(2018, 03, 28).Date,
                        DatumIsteka = new DateTime(2018, 04, 27), GradoviId = 2, Cena = 3000, TekstOglasa = "Oglas4"
                    },
                    new  Models.Oglasi {
                        Naslov      = "Oglas5", DatumObjave = new DateTime(2018, 03, 15).Date,
                        DatumIsteka = new DateTime(2018, 04, 27), GradoviId = 2, Cena = 3000, TekstOglasa = "Oglas5"
                    },
                    new  Models.Oglasi {
                        Naslov      = "Oglas6", DatumObjave = new DateTime(2018, 03, 24).Date,
                        DatumIsteka = new DateTime(2018, 04, 27), GradoviId = 2, Cena = 3000, TekstOglasa = "Oglas6"
                    }
                };

                foreach (Models.Oglasi o in Oglasi)
                {
                    context.Oglasi.Add(o);
                }
                context.SaveChanges();
            }
        }
コード例 #29
0
        public virtual void loadFromDump(StringReader reader, IdMap map, out int prvoKoloId, out int drugoKoloId,
                                         out int treceKoloId, out int cetvrtoKoloId, out int vrhovniSudijaId)
        {
            string naziv = reader.ReadLine();

            Naziv      = naziv != NULL ? naziv : null;
            Gimnastika = (Gimnastika)Enum.Parse(typeof(Gimnastika), reader.ReadLine());
            Datum      = DateTime.Parse(reader.ReadLine());
            string mesto = reader.ReadLine();

            Mesto = mesto != NULL ? mesto : null;

            TipTakmicenja = (TipTakmicenja)Enum.Parse(typeof(TipTakmicenja), reader.ReadLine());

            string prvoKoloIdStr    = reader.ReadLine();
            string drugoKoloIdStr   = reader.ReadLine();
            string treceKoloIdStr   = reader.ReadLine();
            string cetvrtoKoloIdStr = reader.ReadLine();

            prvoKoloId = prvoKoloIdStr != NULL?int.Parse(prvoKoloIdStr) : -1;

            drugoKoloId = drugoKoloIdStr != NULL?int.Parse(drugoKoloIdStr) : -1;

            treceKoloId = treceKoloIdStr != NULL?int.Parse(treceKoloIdStr) : -1;

            cetvrtoKoloId = cetvrtoKoloIdStr != NULL?int.Parse(cetvrtoKoloIdStr) : -1;

            string vrhovniSudijaIdStr = reader.ReadLine();

            vrhovniSudijaId = vrhovniSudijaIdStr != NULL?int.Parse(vrhovniSudijaIdStr) : -1;

            BrojEOcena        = byte.Parse(reader.ReadLine());
            BrojDecimalaD     = byte.Parse(reader.ReadLine());
            BrojDecimalaE1    = byte.Parse(reader.ReadLine());
            BrojDecimalaE     = byte.Parse(reader.ReadLine());
            BrojDecimalaPen   = byte.Parse(reader.ReadLine());
            BrojDecimalaTotal = byte.Parse(reader.ReadLine());
            ZavrsenoTak1      = bool.Parse(reader.ReadLine());

            string zreb = reader.ReadLine();

            ZrebZaFinalePoSpravama = zreb != NULL ? zreb : null;

            LastModified = DateTime.Parse(reader.ReadLine());

            int brojTakmicenja = int.Parse(reader.ReadLine());

            for (int i = 0; i < brojTakmicenja; ++i)
            {
                string id = reader.ReadLine();
                RezultatskoTakmicenjeDescription d = new RezultatskoTakmicenjeDescription();
                map.descriptionsMap.Add(int.Parse(id), d);
                d.loadFromDump(reader);
                TakmicenjeDescriptions.Add(d);
            }

            int brojKategorija = int.Parse(reader.ReadLine());

            for (int i = 0; i < brojKategorija; ++i)
            {
                string id = reader.ReadLine();
                TakmicarskaKategorija k = new TakmicarskaKategorija();
                map.kategorijeMap.Add(int.Parse(id), k);
                k.loadFromDump(reader, map);
                Kategorije.Add(k);
            }
        }
コード例 #30
0
 //UPDATE
 public void UpdateCategory(Kategorije kategorija) =>
 kategorije.ReplaceOne(sub => sub.kategorijaID == kategorija.kategorijaID, kategorija);