コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Predbiljezbe predbiljezbe = db.Predbiljezbe.Find(id);

            db.Predbiljezbe.Remove(predbiljezbe);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public ActionResult DeletePredbiljezbe(int id)
        {
            Predbiljezbe predbiljezbe = _db.Predbiljezbe.Find(id);

            _db.Predbiljezbe.Remove(predbiljezbe);
            _db.SaveChanges();
            return(RedirectToAction("UvidAndObradaPredbiljezbi"));
        }
コード例 #3
0
    protected void btnPrikazi_Click(object sender, EventArgs e)
    {
        lblStatus.Text = "";
        if (txtPretraga.Text == "")
        {
            DohvatiPredbiljezbe();
        }
        else
        {
            ArrayList lista = new ArrayList();

            SqlConnection conn    = new SqlConnection(ConnString);
            SqlCommand    cmd     = new SqlCommand("SELECT * FROM Predbiljezba WHERE Prezime like @Prezime", conn);
            string        prezime = "%" + txtPretraga.Text + "%";
            cmd.Parameters.AddWithValue("@Prezime", prezime);

            try
            {
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    Predbiljezbe predbiljezba = new Predbiljezbe();
                    predbiljezba.IdPredbiljezba = (int)reader["IdPredbiljezba"];
                    predbiljezba.Datum          = (DateTime)reader["Datum"];
                    predbiljezba.Ime            = (string)reader["Ime"];
                    predbiljezba.Prezime        = (string)reader["Prezime"];
                    predbiljezba.Adresa         = (string)reader["Adresa"];
                    predbiljezba.IdSeminar      = (int)reader["IdSeminar"];
                    predbiljezba.Status         = (string)reader["Status"];
                    predbiljezba.email          = (string)reader["Email"];

                    lista.Add(predbiljezba);
                }

                if (reader.IsClosed)
                {
                    reader.Close();
                }
            }
            catch (Exception greska)
            {
                lblStatus.Text = string.Format("Došlo je do greške. Detalji: {0}", greska.Message);
            }
            finally
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }

            gvPredbiljezbe.DataSource = lista;
            gvPredbiljezbe.DataBind();
        }
    }
コード例 #4
0
        public ActionResult IzradaPredbiljezbe(Predbiljezbe novaPredbiljezba)
        {
            novaPredbiljezba.DatumPredbiljezbe = DateTime.Now; //pre set()
            novaPredbiljezba.Prihvacen_Odbijen = "neobrađen";
            //add predbiljezbe
            _db.Predbiljezbe.Add(novaPredbiljezba);
            _db.SaveChanges();

            return(RedirectToAction("RegistrationCompleted"));
        }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "IdPredbiljezba,IdSeminar,Ime,Prezime,Adresa,Email,Telefon,Prihvaceno,Odbijeno")] Predbiljezbe predbiljezbe)
 {
     if (ModelState.IsValid)
     {
         db.Entry(predbiljezbe).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IdSeminar = new SelectList(db.Seminari, "IdSeminar", "Naziv", predbiljezbe.IdSeminar);
     return(View(predbiljezbe));
 }
コード例 #6
0
 public ActionResult EditPredbiljezbe([Bind(Include = "Id,IdSeminar,DatumPredbiljezbe,Ime,Prezime,Adresa,Mobitel,Email,Prihvacen_Odbijen")] Predbiljezbe predbiljezbe)
 {
     if (ModelState.IsValid)
     {
         _db.Entry(predbiljezbe).State = EntityState.Modified;
         _db.SaveChanges();
         return(RedirectToAction("UvidAndObradaPredbiljezbi"));
     }
     ViewBag.IdSeminar = new SelectList(_db.Seminari, "Id", "NazivSeminara", predbiljezbe.IdSeminar);
     return(View(predbiljezbe));
 }
コード例 #7
0
        public ActionResult Create([Bind(Include = "IdPredbiljezba,IdSeminar,Ime,Prezime,Adresa,Email,Telefon,Prihvaceno,Odbijeno")] Predbiljezbe predbiljezbe)
        {
            if (ModelState.IsValid)
            {
                db.Predbiljezbe.Add(predbiljezbe);
                db.SaveChanges();
                //return RedirectToAction("Index");
                return(RedirectToRoute(new { controller = "Zahvala", action = "Index" }));
            }

            ViewBag.IdSeminar = new SelectList(db.Seminari, "IdSeminar", "Naziv", predbiljezbe.IdSeminar);
            return(View(predbiljezbe));
        }
コード例 #8
0
        // GET: Predbiljezbe/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Predbiljezbe predbiljezbe = db.Predbiljezbe.Find(id);

            if (predbiljezbe == null)
            {
                return(HttpNotFound());
            }
            return(View(predbiljezbe));
        }
コード例 #9
0
    protected void DohvatiPredbiljezbe()
    {
        txtPretraga.Focus();
        ArrayList lista = new ArrayList();

        SqlConnection conn   = new SqlConnection(ConnString);
        SqlCommand    cmd    = new SqlCommand("SELECT * FROM Predbiljezba", conn);
        SqlDataReader reader = null;

        try
        {
            conn.Open();
            reader = cmd.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    Predbiljezbe unos = new Predbiljezbe();
                    unos.IdPredbiljezba = (int)reader["IdPredbiljezba"];
                    unos.Datum          = (DateTime)reader["Datum"];
                    unos.Ime            = (string)reader["Ime"];
                    unos.Prezime        = (string)reader["Prezime"];
                    unos.Adresa         = (string)reader["Adresa"];
                    unos.IdSeminar      = (int)reader["IdSeminar"];
                    unos.Status         = (string)reader["Status"];
                    unos.email          = (string)reader["Email"];

                    lista.Add(unos);
                }
            }
            gvPredbiljezbe.DataSource = lista;
            gvPredbiljezbe.DataBind();
        }
        catch (Exception greska)
        {
            lblStatus.Text = string.Format("Došlo je do neke greškice. Detalji: {0}", greska.Message);
        }
        finally
        {
            if (!reader.IsClosed)
            {
                reader.Close();
            }
            if (conn.State == ConnectionState.Open)
            {
                conn.Close();
            }
        }
    }
コード例 #10
0
        // GET: Predbiljezbe/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Predbiljezbe predbiljezbe = db.Predbiljezbe.Find(id);

            if (predbiljezbe == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IdSeminar = new SelectList(db.Seminari, "IdSeminar", "Naziv", predbiljezbe.IdSeminar);
            return(View(predbiljezbe));
        }
コード例 #11
0
        public ActionResult EditPredbiljezbe(int?id)
        {
            var statusRadio = _db.Predbiljezbe.Where(p => p.Id == id).SingleOrDefault();

            ViewBag.statusPredbiljezbe = statusRadio;

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Predbiljezbe predbiljezbe = _db.Predbiljezbe.Find(id);

            if (predbiljezbe == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IdSeminar = new SelectList(_db.Seminari, "Id", "NazivSeminara", predbiljezbe.IdSeminar);
            return(View(predbiljezbe));
        }
コード例 #12
0
    protected void ddlPrikazz_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddlPrikazz.SelectedValue == "1") //prikaz svih
        {
            ArrayList lista = new ArrayList();

            SqlConnection conn   = new SqlConnection(ConnString);
            SqlCommand    cmd    = new SqlCommand("SELECT * FROM Predbiljezba", conn);
            SqlDataReader reader = null;


            conn.Open();
            reader = cmd.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    Predbiljezbe unos = new Predbiljezbe();
                    unos.IdPredbiljezba = (int)reader["IdPredbiljezba"];
                    unos.Datum          = (DateTime)reader["Datum"];
                    unos.Ime            = (string)reader["Ime"];
                    unos.Prezime        = (string)reader["Prezime"];
                    unos.Adresa         = (string)reader["Adresa"];
                    unos.IdSeminar      = (int)reader["IdSeminar"];
                    unos.Status         = (string)reader["Status"];
                    unos.email          = (string)reader["Email"];


                    lista.Add(unos);
                }
            }
            gvPredbiljezbe.DataSource = lista;
            gvPredbiljezbe.DataBind();

            {
                if (!reader.IsClosed)
                {
                    reader.Close();
                }
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
        }
        if (ddlPrikazz.SelectedValue == "2") //prikaz prihvaćenih
        {
            ArrayList lista = new ArrayList();

            SqlConnection conn   = new SqlConnection(ConnString);
            SqlCommand    cmd    = new SqlCommand("SELECT * FROM Predbiljezba where Status='Prihvaćeno'", conn);
            SqlDataReader reader = null;


            conn.Open();
            reader = cmd.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    Predbiljezbe unos2 = new Predbiljezbe();
                    unos2.IdPredbiljezba = (int)reader["IdPredbiljezba"];
                    unos2.Datum          = (DateTime)reader["Datum"];
                    unos2.Ime            = (string)reader["Ime"];
                    unos2.Prezime        = (string)reader["Prezime"];
                    unos2.Adresa         = (string)reader["Adresa"];
                    unos2.IdSeminar      = (int)reader["IdSeminar"];
                    unos2.Status         = (string)reader["Status"];
                    unos2.email          = (string)reader["Email"];


                    lista.Add(unos2);
                }
            }
            gvPredbiljezbe.DataSource = lista;
            gvPredbiljezbe.DataBind();

            {
                if (!reader.IsClosed)
                {
                    reader.Close();
                }
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
        }


        if (ddlPrikazz.SelectedValue == "3") //prikaz odbijenih
        {
            ArrayList lista = new ArrayList();

            SqlConnection conn   = new SqlConnection(ConnString);
            SqlCommand    cmd    = new SqlCommand("SELECT * FROM Predbiljezba where Status='Odbijeno'", conn);
            SqlDataReader reader = null;


            conn.Open();
            reader = cmd.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    Predbiljezbe unos3 = new Predbiljezbe();
                    unos3.IdPredbiljezba = (int)reader["IdPredbiljezba"];
                    unos3.Datum          = (DateTime)reader["Datum"];
                    unos3.Ime            = (string)reader["Ime"];
                    unos3.Prezime        = (string)reader["Prezime"];
                    unos3.Adresa         = (string)reader["Adresa"];
                    unos3.IdSeminar      = (int)reader["IdSeminar"];
                    unos3.Status         = (string)reader["Status"];
                    unos3.email          = (string)reader["Email"];


                    lista.Add(unos3);
                }
            }
            gvPredbiljezbe.DataSource = lista;
            gvPredbiljezbe.DataBind();

            {
                if (!reader.IsClosed)
                {
                    reader.Close();
                }
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
        }
        if (ddlPrikazz.SelectedValue == "4") //prikaz neobrađenih
        {
            ArrayList lista = new ArrayList();

            SqlConnection conn   = new SqlConnection(ConnString);
            SqlCommand    cmd    = new SqlCommand("SELECT * FROM Predbiljezba where Status='Neobrađeno'", conn);
            SqlDataReader reader = null;

            conn.Open();
            reader = cmd.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    Predbiljezbe unos4 = new Predbiljezbe();
                    unos4.IdPredbiljezba = (int)reader["IdPredbiljezba"];
                    unos4.Datum          = (DateTime)reader["Datum"];
                    unos4.Ime            = (string)reader["Ime"];
                    unos4.Prezime        = (string)reader["Prezime"];
                    unos4.Adresa         = (string)reader["Adresa"];
                    unos4.IdSeminar      = (int)reader["IdSeminar"];
                    unos4.Status         = (string)reader["Status"];
                    unos4.email          = (string)reader["Email"];


                    lista.Add(unos4);
                }
            }
            gvPredbiljezbe.DataSource = lista;
            gvPredbiljezbe.DataBind();

            {
                if (!reader.IsClosed)
                {
                    reader.Close();
                }
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
        }
    }