public Pitanje(Model.Komentar pitanje)
 {
     InitializeComponent();
     txtPlan.Text     = pitanje.Plan;
     txtPitanje.Text  = pitanje.Opis;
     txtKorisnik.Text = pitanje.ImePrezime;
     txtDatum.Text    = pitanje.DatumString;
     planId           = pitanje.PlanId;
     nadkomentarId    = pitanje.Id;
 }
Пример #2
0
        public static List <Model.Komentar> getKomentare(string idPost)
        {
            string        cs     = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            SqlConnection conn   = null;
            SqlDataReader reader = null;

            try
            {
                conn = new SqlConnection(cs);
                SqlCommand com = new SqlCommand("DetaljnijeKomentari", conn);
                com.CommandType = CommandType.StoredProcedure;
                com.Parameters.AddWithValue("@idPost", idPost);
                conn.Open();
                reader = com.ExecuteReader();
                List <Model.Komentar> komentari = new List <Model.Komentar>();
                while (reader.Read())
                {
                    Model.Komentar kom = new Model.Komentar();
                    kom.Datum          = DateTime.Parse(reader["DatumKom"].ToString());
                    kom.idKomentara    = Int32.Parse(reader["idKomentar"].ToString());
                    kom.Koment         = reader["Komentar"].ToString();
                    kom.idPost         = Int32.Parse(reader["idPost"].ToString());
                    kom.AutorKomentara = reader["AutorKomentara"].ToString();
                    kom.Email          = reader["Email"].ToString();
                    kom.WebSite        = reader["WebSite"].ToString();
                    kom.imeZaSliku     = reader["imeZaSliku"].ToString();
                    kom.Putanja        = reader["Putanja"].ToString();
                    komentari.Add(kom);
                }
                return(komentari);
            }
            catch (Exception exp)
            {
                HttpContext.Current.Trace.Warn("Greška", "Greška getKomentare(string idPost)", exp);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                if (conn != null && conn.State != ConnectionState.Closed)
                {
                    conn.Close();
                }
            }
            return(null);
        }
Пример #3
0
 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 3)
     {
         Model.Komentar pitanje = new Model.Komentar
         {
             DatumString = dataGridView1.Rows[e.RowIndex].Cells["DatumString"].Value.ToString(),
             ImePrezime  = dataGridView1.Rows[e.RowIndex].Cells["ImePrezime"].Value.ToString(),
             Opis        = dataGridView1.Rows[e.RowIndex].Cells["Opis"].Value.ToString(),
             Plan        = dataGridView1.Rows[e.RowIndex].Cells["PlanIProgram"].Value.ToString(),
             Id          = (int)dataGridView1.Rows[e.RowIndex].Cells["Id"].Value,
             PlanId      = (int)dataGridView1.Rows[e.RowIndex].Cells["PlanId"].Value
         };
         Pitanje frm = new Pitanje(pitanje);
         frm.Show();
         this.Close();
     }
     ;
 }
Пример #4
0
        public static List <Model.Komentar> getPoslednjih5Komentara()
        {
            string        cs     = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            SqlConnection conn   = null;
            SqlDataReader reader = null;

            try
            {
                conn = new SqlConnection(cs);
                SqlCommand com = new SqlCommand("MasterKomentariSaStrane", conn);
                com.CommandType = CommandType.StoredProcedure;
                conn.Open();
                reader = com.ExecuteReader();
                List <Model.Komentar> komentari = new List <Model.Komentar>();
                while (reader.Read())
                {
                    Model.Komentar kom = new Model.Komentar();
                    kom.idPost         = Int32.Parse(reader["idPost"].ToString());
                    kom.AutorKomentara = reader["AutorKomentara"].ToString();
                    kom.WebSite        = reader["WebSite"].ToString();
                    kom.Naslov         = reader["Naslov"].ToString();
                    komentari.Add(kom);
                }
                return(komentari);
            }
            catch (Exception exp)
            {
                HttpContext.Current.Trace.Warn("Greška", "Greška getPoslednjih5Komentara()", exp);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                if (conn != null && conn.State != ConnectionState.Closed)
                {
                    conn.Close();
                }
            }
            return(null);
        }
 private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
 {
     Komentar = null;
 }
 public KomentarDetailPage()
 {
     this.InitializeComponent();
     Komentar = new Model.Komentar(0, new DateTime(), "text");
     this.DataContext = Komentar;
 }