Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            sqlbaglantisi baglan = new sqlbaglantisi();

            baglan.baglan.Open();

            if (Session["kullaniciadii"] == null)
            {
                Response.Redirect("admingiris.aspx");
            }

            urunID = Request.QueryString["urunID"];
            islem  = Request.QueryString["islem"];

            if (islem == "sil")
            {
                SqlCommand cmdsil = new SqlCommand("delete from urun where id='" + urunID + "'", baglan.baglan);
                cmdsil.ExecuteNonQuery();
            }
            SqlCommand    cmdugetir = new SqlCommand("select * from urun", baglan.baglan);
            SqlDataReader drugetir  = cmdugetir.ExecuteReader();

            dl_urungunleme.DataSource = drugetir;
            dl_urungunleme.DataBind();

            baglan.baglan.Close();
        }
Exemplo n.º 2
0
        protected void ddl_il_SelectedIndexChanged(object sender, EventArgs e)
        {
            sqlbaglantisi baglan = new sqlbaglantisi();

            baglan.baglan.Open();

            SqlCommand comm = new SqlCommand("Select id,ad from ilce where il_id=" + ddl_il.SelectedItem.Value, baglan.baglan);

            try
            {
                SqlDataReader reader = comm.ExecuteReader();

                ddl_ilce.DataSource     = reader;
                ddl_ilce.DataValueField = "id";
                ddl_ilce.DataTextField  = "ad";
                ddl_ilce.DataBind();
                reader.Close();
                baglan.baglan.Close();
            }

            catch
            {
                Response.Write("Bir hata oluştu");
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            sqlbaglantisi baglan = new sqlbaglantisi();

            baglan.baglan.Open();

            if (!IsPostBack)
            {
                SqlCommand com = new SqlCommand("Select id, ad from il", baglan.baglan);

                try
                {
                    SqlDataReader reader = com.ExecuteReader();

                    ddl_il.DataSource     = reader;
                    ddl_il.DataValueField = "id";
                    ddl_il.DataTextField  = "ad";
                    ddl_il.DataBind();
                    reader.Close();
                    baglan.baglan.Close();
                }

                catch
                {
                    Response.Write("Bir hata oluştu");
                }
            }
        }
Exemplo n.º 4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            sqlbaglantisi baglan = new sqlbaglantisi();

            baglan.baglan.Open();

            if (fu_urunresim.HasFile)
            {
                fu_urunresim.SaveAs(Server.MapPath("/admin/img/" + fu_urunresim.FileName));

                SqlCommand yeni  = new SqlCommand("select id from kategori where ad='" + ddl_kategoriadi.Text + "'", baglan.baglan);
                SqlCommand yeni1 = new SqlCommand("select id from marka where ad='" + ddl_markaadi.Text + "'", baglan.baglan);
                Object     a     = yeni.ExecuteScalar();
                Object     b     = yeni1.ExecuteScalar();

                SqlCommand cmdekle = new SqlCommand("insert into urun (kategori_id,marka_id,ad,birim_fiyat,aciklama,kodu,resim) Values('" + a + "','" + b + "','" + txt_urunadi.Text + "','" + txt_birimfiyat.Text + "','" + txt_urunaciklama.Text + "','" + txt_urunkodu.Text + "','/admin/img/" + fu_urunresim.FileName + "')", baglan.baglan);
                cmdekle.ExecuteNonQuery();

                Response.Redirect("adminpanel.aspx");
            }
            else
            {
                Response.Write("<script>alert('Lütfen bir resim ekleyiniz!')</script>");
            }



            baglan.baglan.Close();
        }
Exemplo n.º 5
0
        protected void btn_kaydet_Click(object sender, EventArgs e)
        {
            sqlbaglantisi baglan = new sqlbaglantisi();

            baglan.baglan.Open();

            SqlCommand cmdekle = new SqlCommand("insert into musteri_hesap (kullanici_adi,sifre,email) Values('" + txt_kkullaniciadi.Text + "','" + txt_ksifre.Text + "','" + txt_email.Text + "')", baglan.baglan);

            cmdekle.ExecuteNonQuery();

            Response.Redirect("/default.aspx");

            baglan.baglan.Close();
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            sqlbaglantisi baglan = new sqlbaglantisi();

            baglan.baglan.Open();

            if (Session["kullaniciadii"] == null)
            {
                Response.Redirect("admingiris.aspx");
            }
            urunID = Request.QueryString["urunID"];

            if (Page.IsPostBack == false)
            {
                SqlCommand    cmduduzenle = new SqlCommand("select * from urun where id='" + urunID + "'", baglan.baglan);
                SqlDataReader druduzenle  = cmduduzenle.ExecuteReader();

                SqlCommand cmdkategoriid = new SqlCommand("select kategori_id from urun where id='" + urunID + "'", baglan.baglan);
                Object     a             = cmdkategoriid.ExecuteScalar();

                SqlCommand cmdmarkaid = new SqlCommand("select marka_id from urun where id='" + urunID + "'", baglan.baglan);
                Object     b          = cmdmarkaid.ExecuteScalar();

                SqlCommand cmdgetir    = new SqlCommand("select k.ad from kategori k,urun u where u.id='" + urunID + "' and k.id='" + a + "'", baglan.baglan);
                Object     kategoriadi = cmdgetir.ExecuteScalar();

                ddl_kategoriadi.Text = kategoriadi.ToString();

                SqlCommand cmdgetir1 = new SqlCommand("select m.ad from marka m,urun u where u.id='" + urunID + "' and m.id='" + b + "'", baglan.baglan);
                Object     markaadi  = cmdgetir1.ExecuteScalar();
                ddl_markaadi.Text = markaadi.ToString();

                DataTable dtuduzenle1 = new DataTable("tablo");
                dtuduzenle1.Load(druduzenle);

                foreach (DataRow item in dtuduzenle1.Rows)
                {
                    txt_birimfiyat.Text   = item["birim_fiyat"].ToString();
                    txt_urunadi.Text      = item["ad"].ToString();
                    txt_urunkodu.Text     = item["kodu"].ToString();
                    txt_urunaciklama.Text = item["aciklama"].ToString();
                }
            }
            baglan.baglan.Close();
        }
Exemplo n.º 7
0
        protected void btn_kaydet_Click1(object sender, EventArgs e)
        {
            sqlbaglantisi baglan = new sqlbaglantisi();

            baglan.baglan.Open();

            SqlCommand cmdkontrol = new SqlCommand("select kullanici_adi from musteri_hesap where kullanici_adi='" + txt_kkullaniciadi.Text + "'", baglan.baglan);
            Object     kontrol    = cmdkontrol.ExecuteScalar();

            if (kontrol == null)
            {
                SqlCommand cmdekle = new SqlCommand("insert into musteri_hesap (kullanici_adi,sifre,email) Values('" + txt_kkullaniciadi.Text + "','" + txt_ksifre.Text + "','" + txt_email.Text + "')", baglan.baglan);
                cmdekle.ExecuteNonQuery();

                SqlCommand cmdmhid   = new SqlCommand("select id from musteri_hesap where kullanici_adi='" + txt_kkullaniciadi.Text + "'", baglan.baglan);
                Object     b         = cmdmhid.ExecuteScalar();
                SqlCommand cmdiid    = new SqlCommand("select id from il where ad='" + ddl_il.SelectedItem + "'", baglan.baglan);
                Object     c         = cmdiid.ExecuteScalar();
                SqlCommand cmdilceid = new SqlCommand("select id from ilce where ad='" + ddl_ilce.SelectedItem + "'", baglan.baglan);
                Object     d         = cmdilceid.ExecuteScalar();

                if (rbtn_erkek.Checked)
                {
                    cinsiyet = "E";
                }
                else
                {
                    cinsiyet = "K";
                }

                SqlCommand cmdekle1 = new SqlCommand("insert into musteri (ad,soyad,telefon,cinsiyet,il_id,ilce_id,musteri_hesap_id) Values('" + txt_ad.Text + "','" + txt_soyad.Text + "','" + txt_telefon.Text + "','" + cinsiyet + "','" + c + "','" + d + "','" + b + "')", baglan.baglan);
                cmdekle1.ExecuteNonQuery();
                Response.Redirect("/default.aspx");
            }
            else
            {
                Response.Write("<script>alert('Kullanıcı adınız önceden kullanılmıştır!')</script>");
            }



            baglan.baglan.Close();
        }
Exemplo n.º 8
0
        protected void btn_kaydet_Click(object sender, EventArgs e)
        {
            sqlbaglantisi baglan = new sqlbaglantisi();

            baglan.baglan.Open();

            SqlCommand cmdilid = new SqlCommand("select id from il where ad='" + ddl_il.Text + "'", baglan.baglan);
            Object     a       = cmdilid.ExecuteScalar();

            SqlCommand cmdilceid = new SqlCommand("select id from ilce where ad='" + ddl_ilce.Text + "'", baglan.baglan);
            Object     b         = cmdilceid.ExecuteScalar();

            SqlCommand cmdmhi = new SqlCommand("select id from musteri_hesap where kullanici_adi='" + Session["kullaniciadi"] + "'", baglan.baglan);
            Object     mhid   = cmdmhi.ExecuteScalar();



            SqlCommand cmd = new SqlCommand("update musteri_hesap set kullanici_adi='" + txt_kullaniciadi.Text + "',sifre='" + txt_sifre.Text + "',email='" + txt_email.Text + "' where id='" + mhid + "'", baglan.baglan);

            cmd.ExecuteNonQuery();

            if (rbtn_erkek.Checked)
            {
                cinsiyet = "E";
            }
            else
            {
                cinsiyet = "K";
            }

            SqlCommand cmd1 = new SqlCommand("update musteri set ad='" + txt_ad.Text + "',soyad='" + txt_soyad.Text + "',telefon='" + txt_telefon.Text + "',cinsiyet='" + cinsiyet + "',il_id='" + a + "',ilce_id='" + b + "' where musteri_hesap_id='" + mhid + "'", baglan.baglan);

            cmd1.ExecuteNonQuery();

            Session["kullaniciadi"] = txt_kullaniciadi.Text;

            Response.Redirect("profil.aspx");



            baglan.baglan.Close();
        }
Exemplo n.º 9
0
        protected void btn_giris_Click1(object sender, EventArgs e)
        {
            sqlbaglantisi baglan = new sqlbaglantisi();

            baglan.baglan.Open();

            SqlCommand    cmd = new SqlCommand("Select * from musteri_hesap where kullanici_adi='" + txt_kullaniciadi.Text + "' and sifre='" + txt_sifre.Text + "'", baglan.baglan);
            SqlDataReader dr  = cmd.ExecuteReader();

            if (dr.Read())
            {
                Session["kullaniciadi"] = dr["kullanici_adi"];
                Response.Redirect("/default.aspx");
            }
            else
            {
                Response.Write("<script>alert('Kullanıcı adı veya şifre hatalı!')</script>");
            }
            baglan.baglan.Close();
        }
Exemplo n.º 10
0
        protected void btn_kaydet_Click(object sender, EventArgs e)
        {
            sqlbaglantisi baglan = new sqlbaglantisi();

            baglan.baglan.Open();

            SqlCommand cmdkategoriid = new SqlCommand("select id from kategori where ad='" + ddl_kategoriadi.Text + "'", baglan.baglan);
            Object     a             = cmdkategoriid.ExecuteScalar();

            SqlCommand cmdmarkaid = new SqlCommand("select id from marka where ad='" + ddl_markaadi.Text + "'", baglan.baglan);
            Object     b          = cmdmarkaid.ExecuteScalar();

            SqlCommand cmd = new SqlCommand("update urun set kategori_id='" + a + "',marka_id='" + b + "',ad='" + txt_urunadi.Text + "',birim_fiyat='" + txt_birimfiyat.Text + "',aciklama='" + txt_urunaciklama.Text + "',kodu='" + txt_urunkodu.Text + "' where id='" + urunID + "'", baglan.baglan);

            cmd.ExecuteNonQuery();


            Response.Redirect("urungunleme.aspx");

            baglan.baglan.Close();
        }
Exemplo n.º 11
0
        protected void btn_giris_Click(object sender, EventArgs e)
        {
            sqlbaglantisi baglan = new sqlbaglantisi();

            baglan.baglan.Open();

            SqlCommand    cmd = new SqlCommand("Select * from admin where kullanici_adi='" + txt_kullaniciadi.Text + "' and sifre='" + txt_sifre.Text + "'", baglan.baglan);
            SqlDataReader dr  = cmd.ExecuteReader();

            if (dr.Read())
            {
                Session["kullaniciadii"] = dr["kullanici_adi"];
                Response.Redirect("urunekle.aspx");
            }
            else
            {
                lbl_hata.Visible = true;
                lbl_hata.Text    = "Hatalı giriş Yaptınız!";
            }

            baglan.baglan.Close();
        }
Exemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            sqlbaglantisi baglan = new sqlbaglantisi();

            baglan.baglan.Open();

            //if (!IsPostBack)
            //{

            //    SqlCommand com = new SqlCommand("Select id, ad from il", baglan.baglan);

            //    try
            //    {


            //        SqlDataReader reader = com.ExecuteReader();

            //        ddl_il.DataSource = reader;
            //        ddl_il.DataValueField = "id";
            //        ddl_il.DataTextField = "ad";
            //        ddl_il.DataBind();


            //        //ddl_il.Items.Insert(0, new ListItem(iladi.ToString(), b.ToString()));
            //        reader.Close();



            //    }

            //    catch
            //    {
            //        Response.Write("Bir hata oluştu");
            //    }
            //}

            //SqlCommand comm = new SqlCommand("Select id,ad from ilce", baglan.baglan);

            //try
            //{


            //    SqlDataReader reader = comm.ExecuteReader();

            //    ddl_ilce.DataSource = reader;
            //    ddl_ilce.DataValueField = "id";
            //    ddl_ilce.DataTextField = "ad";
            //    ddl_ilce.DataBind();
            //    //ddl_ilce.Items.Insert(0, new ListItem(ilceadi.ToString(), c.ToString()));
            //    reader.Close();

            //}

            //catch
            //{
            //    Response.Write("Bir hata oluştu");
            //}


            SqlCommand cmdmhi = new SqlCommand("select id from musteri_hesap where kullanici_adi='" + Session["kullaniciadi"] + "'", baglan.baglan);
            Object     mhid   = cmdmhi.ExecuteScalar();


            if (Page.IsPostBack == false)
            {
                SqlCommand    cmduduzenle = new SqlCommand("select * from musteri where musteri_hesap_id='" + mhid + "'", baglan.baglan);
                SqlDataReader druduzenle  = cmduduzenle.ExecuteReader();

                SqlCommand cmdilid = new SqlCommand("select il_id from musteri where musteri_hesap_id='" + mhid + "'", baglan.baglan);
                Object     b       = cmdilid.ExecuteScalar();

                SqlCommand cmdilceid = new SqlCommand("select ilce_id from musteri where musteri_hesap_id='" + mhid + "'", baglan.baglan);
                Object     c         = cmdilceid.ExecuteScalar();


                SqlCommand cmdgetiril = new SqlCommand("select i.ad from il i,musteri m where m.musteri_hesap_id='" + mhid + "' and i.id='" + b + "'", baglan.baglan);
                Object     iladi      = cmdgetiril.ExecuteScalar();
                ddl_il.Text = iladi.ToString();



                SqlCommand cmdgetirilce = new SqlCommand("select i.ad from ilce i,musteri m where m.musteri_hesap_id='" + mhid + "' and i.id='" + c + "'", baglan.baglan);
                Object     ilceadi      = cmdgetirilce.ExecuteScalar();
                ddl_ilce.Text = ilceadi.ToString();



                SqlCommand cmdgetirka = new SqlCommand("select kullanici_adi from musteri_hesap where id='" + mhid + "'", baglan.baglan);
                Object     ka         = cmdgetirka.ExecuteScalar();
                txt_kullaniciadi.Text = ka.ToString();

                SqlCommand cmdgetirsifre = new SqlCommand("select sifre from musteri_hesap where id='" + mhid + "'", baglan.baglan);
                Object     sifre         = cmdgetirsifre.ExecuteScalar();
                txt_sifre.Text = sifre.ToString();

                SqlCommand cmdgetiremail = new SqlCommand("select email from musteri_hesap where id='" + mhid + "'", baglan.baglan);
                Object     email         = cmdgetiremail.ExecuteScalar();
                txt_email.Text = email.ToString();

                DataTable dtuduzenle1 = new DataTable("tablo");
                dtuduzenle1.Load(druduzenle);

                foreach (DataRow item in dtuduzenle1.Rows)
                {
                    txt_ad.Text      = item["ad"].ToString();
                    txt_soyad.Text   = item["soyad"].ToString();
                    txt_telefon.Text = item["telefon"].ToString();
                    if (item["cinsiyet"].ToString() == "E")
                    {
                        rbtn_erkek.Checked = true;
                    }
                    else
                    {
                        rbtn_kadın.Checked = true;
                    }
                }
            }

            baglan.baglan.Close();
        }