protected void Page_Load(object sender, EventArgs e)
        {
            ktgrls.Clear();
            SqlDataReader krd = db.dataGetir("hbrKategori");

            while (krd.Read())
            {
                pHbrKategori hbrkgtr = new pHbrKategori();
                hbrkgtr.KatId = Convert.ToInt32(krd["ID"]);
                hbrkgtr.KatAd = krd["adi"].ToString();
                ktgrls.Add(hbrkgtr);
            }
            db.kapat();

            foreach (pHbrKategori item in ktgrls)
            {
                DropDownList1.Items.Add(new ListItem(HttpUtility.HtmlDecode("") + item.KatAd, item.KatId.ToString()));
            }

            try
            {
                db.ac();
                SqlCommand    cm = new SqlCommand("select * from haberler where ID = '" + Request.QueryString["hbrID"].ToString() + "'", db.conn);
                SqlDataReader rd = cm.ExecuteReader();
                while (rd.Read())
                {
                    pHaberler hbr = new pHaberler();
                    hbr.HbrID       = Convert.ToInt32(rd["ID"]);
                    hbr.HbrKatId    = Convert.ToInt32(rd["katID"]);
                    hbr.HbrBaslik   = rd["baslik"].ToString();
                    hbr.HbrAciklama = rd["kisaAciklama"].ToString();
                    hbr.HbrIcerik   = rd["icerik"].ToString();
                    hbr.HbrDurum    = Convert.ToInt32(rd["durum"]);
                    hbr.HbrTarih    = Convert.ToDateTime(rd["tarih"]);
                    hbr.HbrResim    = rd["resim"].ToString();
                    hbrList.Add(hbr);
                }
                db.kapat();
                pHaberler lst = (pHaberler)hbrDuzenle.hbrList[0];
                txthbrBaslik.Text    = lst.HbrBaslik;
                txtIcerik.Text       = lst.HbrIcerik;
                txtKisaAciklama.Text = lst.HbrAciklama;
                FileInfo dosyaBilgi = new FileInfo(fluDosya.FileName);
            }
            catch (Exception ex)
            {
                // hata
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ktgrls.Clear();
            SqlDataReader krd = db.dataGetir("hbrKategori");
            while (krd.Read())
            {
                pHbrKategori hbrkgtr = new pHbrKategori();
                hbrkgtr.KatId = Convert.ToInt32(krd["ID"]);
                hbrkgtr.KatAd = krd["adi"].ToString();
                ktgrls.Add(hbrkgtr);
            }
            db.kapat();

            foreach (pHbrKategori item in ktgrls)
            {
                DropDownList1.Items.Add(new ListItem(HttpUtility.HtmlDecode("") + item.KatAd, item.KatId.ToString()));
            }

            try
            {
                db.ac();
                SqlCommand cm = new SqlCommand("select * from haberler where ID = '" + Request.QueryString["hbrID"].ToString() + "'", db.conn);
                SqlDataReader rd = cm.ExecuteReader();
                while (rd.Read())
                {
                    pHaberler hbr = new pHaberler();
                    hbr.HbrID = Convert.ToInt32(rd["ID"]);
                    hbr.HbrKatId = Convert.ToInt32(rd["katID"]);
                    hbr.HbrBaslik = rd["baslik"].ToString();
                    hbr.HbrAciklama = rd["kisaAciklama"].ToString();
                    hbr.HbrIcerik = rd["icerik"].ToString();
                    hbr.HbrDurum = Convert.ToInt32(rd["durum"]);
                    hbr.HbrTarih = Convert.ToDateTime(rd["tarih"]);
                    hbr.HbrResim = rd["resim"].ToString();
                    hbrList.Add(hbr);
                }
                db.kapat();
                pHaberler lst = (pHaberler)hbrDuzenle.hbrList[0];
                txthbrBaslik.Text = lst.HbrBaslik;
                txtIcerik.Text = lst.HbrIcerik;
                txtKisaAciklama.Text = lst.HbrAciklama;
                FileInfo dosyaBilgi = new FileInfo(fluDosya.FileName);
                
            }
            catch (Exception ex)
            {
                // hata
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ktgrls.Clear();

            SqlDataReader rd = db.dataGetir("hbrKategori");
            while (rd.Read())
            {
                pHbrKategori hbrkgtr = new pHbrKategori();
                hbrkgtr.KatId = Convert.ToInt32(rd["ID"]);
                hbrkgtr.KatAd = rd["adi"].ToString();

                ktgrls.Add(hbrkgtr);
            }
            db.kapat();

            foreach (pHbrKategori item in ktgrls)
            {
                DropDownList1.Items.Add(new ListItem(HttpUtility.HtmlDecode("") + item.KatAd, item.KatId.ToString()));
            }
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ktgrls.Clear();

            SqlDataReader rd = db.dataGetir("hbrKategori");

            while (rd.Read())
            {
                pHbrKategori hbrkgtr = new pHbrKategori();
                hbrkgtr.KatId = Convert.ToInt32(rd["ID"]);
                hbrkgtr.KatAd = rd["adi"].ToString();

                ktgrls.Add(hbrkgtr);
            }
            db.kapat();

            foreach (pHbrKategori item in ktgrls)
            {
                DropDownList1.Items.Add(new ListItem(HttpUtility.HtmlDecode("") + item.KatAd, item.KatId.ToString()));
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //kategori verilerinin getirilmesi
            ktgrls.Clear();
            SqlDataReader krd = db.dataGetir("hbrKategori");
            while (krd.Read())
            {
                pHbrKategori hbrkgtr = new pHbrKategori();
                hbrkgtr.KatId = Convert.ToInt32(krd["ID"]);
                hbrkgtr.KatAd = krd["adi"].ToString();
                ktgrls.Add(hbrkgtr);
            }
            db.kapat();

            foreach (pHbrKategori item in ktgrls)
            {
                DropDownList1.Items.Add(new ListItem(HttpUtility.HtmlDecode("") + item.KatAd, item.KatId.ToString()));
            }

            //Silme İşlemi
            if (Request.QueryString["hbrID"] != null)
            {
                string hbrID = Request.QueryString["hbrID"].ToString();
                string file = Request.QueryString["hbrResim"].ToString();
                string strPhysicalFolder = Server.MapPath("..\\resimler\\hbrResim\\");
                string strFileFullPath = strPhysicalFolder + file;
                if (System.IO.File.Exists(strFileFullPath))
                {
                    System.IO.File.Delete(strFileFullPath);
                    db.ac();
                    SqlCommand cm = new SqlCommand("delete from haberler where ID='" + hbrID + "'", db.conn);
                    int silSonuc = cm.ExecuteNonQuery();
                    db.kapat();
                    if (silSonuc > 0)
                    {
                        //silme başarılı
                        Response.Redirect("haberler.aspx");
                    }
                    else
                    {

                    }
                }
                else
                {

                }
            }
            //Verileri Getirme
            db.ac();
            SqlDataReader rd = db.dataGetir("haberler");
            while (rd.Read())
            {
                pHaberler hbr = new pHaberler();
                hbr.HbrID = Convert.ToInt32(rd["ID"]);
                hbr.HbrKatId = Convert.ToInt32(rd["katID"]);
                hbr.HbrBaslik = rd["baslik"].ToString();
                hbr.HbrAciklama = rd["kisaAciklama"].ToString();
                hbr.HbrIcerik = rd["icerik"].ToString();
                hbr.HbrDurum = Convert.ToInt32(rd["durum"]);
                hbr.HbrTarih = Convert.ToDateTime(rd["tarih"]);
                hbr.HbrResim = rd["resim"].ToString();
                hbrLs.Add(hbr);
            }
           // db.kapat();

           
            }
예제 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //kategori verilerinin getirilmesi
            ktgrls.Clear();
            SqlDataReader krd = db.dataGetir("hbrKategori");

            while (krd.Read())
            {
                pHbrKategori hbrkgtr = new pHbrKategori();
                hbrkgtr.KatId = Convert.ToInt32(krd["ID"]);
                hbrkgtr.KatAd = krd["adi"].ToString();
                ktgrls.Add(hbrkgtr);
            }
            db.kapat();

            foreach (pHbrKategori item in ktgrls)
            {
                DropDownList1.Items.Add(new ListItem(HttpUtility.HtmlDecode("") + item.KatAd, item.KatId.ToString()));
            }

            //Silme İşlemi
            if (Request.QueryString["hbrID"] != null)
            {
                string hbrID             = Request.QueryString["hbrID"].ToString();
                string file              = Request.QueryString["hbrResim"].ToString();
                string strPhysicalFolder = Server.MapPath("..\\resimler\\hbrResim\\");
                string strFileFullPath   = strPhysicalFolder + file;
                if (System.IO.File.Exists(strFileFullPath))
                {
                    System.IO.File.Delete(strFileFullPath);
                    db.ac();
                    SqlCommand cm       = new SqlCommand("delete from haberler where ID='" + hbrID + "'", db.conn);
                    int        silSonuc = cm.ExecuteNonQuery();
                    db.kapat();
                    if (silSonuc > 0)
                    {
                        //silme başarılı
                        Response.Redirect("haberler.aspx");
                    }
                    else
                    {
                    }
                }
                else
                {
                }
            }
            //Verileri Getirme
            db.ac();
            SqlDataReader rd = db.dataGetir("haberler");

            while (rd.Read())
            {
                pHaberler hbr = new pHaberler();
                hbr.HbrID       = Convert.ToInt32(rd["ID"]);
                hbr.HbrKatId    = Convert.ToInt32(rd["katID"]);
                hbr.HbrBaslik   = rd["baslik"].ToString();
                hbr.HbrAciklama = rd["kisaAciklama"].ToString();
                hbr.HbrIcerik   = rd["icerik"].ToString();
                hbr.HbrDurum    = Convert.ToInt32(rd["durum"]);
                hbr.HbrTarih    = Convert.ToDateTime(rd["tarih"]);
                hbr.HbrResim    = rd["resim"].ToString();
                hbrLs.Add(hbr);
            }
            // db.kapat();
        }