public void getOrder() { orderid = Request.QueryString["Siparisid"]; SqlCommand userbasketcommand = new SqlCommand("select * from Tbl_Siparis where Siparisid=@orderid", cnnclss.Connection()); userbasketcommand.Parameters.AddWithValue("@orderid", orderid); SqlDataReader basketdr = userbasketcommand.ExecuteReader(); cnnclss.Connection().Close(); while (basketdr.Read()) { prdIDs = basketdr[1].ToString(); } string[] prds = prdIDs.Split('/'); foreach (string prd in prds) { string prdid = prd; SqlCommand prdcommand = new SqlCommand("select * from Tbl_Parcalar where Parcaid=@prdid", cnnclss.Connection()); prdcommand.Parameters.AddWithValue("@prdid", prdid); SqlDataReader dr = prdcommand.ExecuteReader(); while (dr.Read()) { prdimg = dr[3].ToString(); prdbrand = dr[2].ToString(); prdname = dr[1].ToString(); } MyPlaceholder.Controls.Add(new Literal() { Text = "<div class='orderPrd orderw'> <img src=" + prdimg + " class=\"orderPrdIMG\"> <span class='orderPrdLBL'>" + prdbrand + " " + prdname + "</span></div>" }); cnnclss.Connection().Close(); } cnnclss.Connection().Close(); }
public void makeOrder() { SqlCommand command = new SqlCommand("select STRING_AGG(Parcaid, '/') as 'OrderIDs' from Tbl_Sepet where Kullaniciid=@userid", cnnclss.Connection()); command.Parameters.AddWithValue("@userid", userid); SqlDataReader dr = command.ExecuteReader(); while (dr.Read()) { orderIDs = dr[0].ToString(); } SqlCommand addordercommand = new SqlCommand("insert into Tbl_Siparis (Siparis, SiparisAdres, SiparisNotu, Musteriid) values (@p1,@p2,@p3,@p4)", cnnclss.Connection()); addordercommand.Parameters.AddWithValue("@p1", orderIDs); addordercommand.Parameters.AddWithValue("@p2", orderAdressTB.Text); addordercommand.Parameters.AddWithValue("@p3", orderNoteTB.Text); addordercommand.Parameters.AddWithValue("@p4", Convert.ToInt16(userid)); addordercommand.ExecuteNonQuery(); SqlCommand userbasketdeletecommand = new SqlCommand("delete from Tbl_Sepet where Kullaniciid=@p1", cnnclss.Connection()); userbasketdeletecommand.Parameters.AddWithValue("@p1", userid); userbasketdeletecommand.ExecuteNonQuery(); response.CssClass = "response"; response.Text = "Siparişiniz Alınmıştır."; Response.AddHeader("REFRESH", "2;URL=PCBuilder.aspx"); cnnclss.Connection().Close(); }
public void getAllUsers() { SqlCommand command = new SqlCommand("Select * From Tbl_Kullanicilar", cnnclss.Connection()); SqlDataReader read = command.ExecuteReader(); usersDataList.DataSource = read; usersDataList.DataBind(); cnnclss.Connection().Close(); }
public void getAllProducts() { SqlCommand command = new SqlCommand("Select * From Tbl_Parcalar", cnnclss.Connection()); SqlDataReader read = command.ExecuteReader(); productsDataList.DataSource = read; productsDataList.DataBind(); cnnclss.Connection().Close(); }
public void getAllMessages() { SqlCommand command = new SqlCommand("Select * From Tbl_KullaniciMesajlari", cnnclss.Connection()); SqlDataReader read = command.ExecuteReader(); messagesDataList.DataSource = read; messagesDataList.DataBind(); cnnclss.Connection().Close(); }
protected void siteInfoUpdateBTN_Click(object sender, EventArgs e) { string siteInfoString = siteInfoTB.Text; SqlCommand updatecommand = new SqlCommand("update Tbl_Hakkimizda set siteInfo=@p1 where siteID=1", cnnclss.Connection()); updatecommand.Parameters.AddWithValue("@p1", siteInfoString); updatecommand.ExecuteNonQuery(); cnnclss.Connection().Close(); getSiteInfo(); }
protected void prdDetailSaveBTN_Click(object sender, EventArgs e) { SqlCommand savecommand = new SqlCommand("update Tbl_Parcalar set ParcaAd=@p1, ParcaMarka=@p2, ParcaResim=@p3, Kategoriid=@p4 where Parcaid=@p5", cnnclss.Connection()); savecommand.Parameters.AddWithValue("@p1", prdNameTB.Text); savecommand.Parameters.AddWithValue("@p2", prdBrandTB.Text); savecommand.Parameters.AddWithValue("@p3", prgImageTB.Text); savecommand.Parameters.AddWithValue("@p4", prdCategoryList.SelectedValue); savecommand.Parameters.AddWithValue("@p5", prdid); savecommand.ExecuteNonQuery(); cnnclss.Connection().Close(); getProductData(); }
public void getUserBasket() { userid = Session["UserID"].ToString(); SqlCommand userbasketcommand = new SqlCommand("select * from Tbl_Sepet, Tbl_Parcalar where Tbl_Parcalar.Parcaid=Tbl_Sepet.Parcaid and Kullaniciid=@userid", cnnclss.Connection()); userbasketcommand.Parameters.AddWithValue("@userid", userid); SqlDataReader basketdr = userbasketcommand.ExecuteReader(); userBasketDataList.DataSource = basketdr; userBasketDataList.DataBind(); cnnclss.Connection().Close(); }
protected void signUpBTN_Click(object sender, EventArgs e) { try { SqlCommand command = new SqlCommand("insert into Tbl_Kullanicilar (Adi,KullaniciAdi,EPosta,Sifre) values (@t1,@t2,@t3,@t4)", cnnclss.Connection()); command.Parameters.AddWithValue("@t1", signUpName.Text); command.Parameters.AddWithValue("@t2", signUpUsername.Text); command.Parameters.AddWithValue("@t3", signUpMail.Text); command.Parameters.AddWithValue("@t4", signUpPassword.Text); command.ExecuteNonQuery(); cnnclss.Connection().Close(); response.CssClass = "response"; response.Text = "Kullanıcı Kaydedilmiştir. GİRİŞ Sayfasına Yönlendiriliyorsunuz."; signUpName.Text = ""; signUpUsername.Text = ""; signUpMail.Text = ""; signUpPassword.Text = ""; signUpPasswordAgain.Text = ""; Response.AppendHeader("Refresh", "4;url=Login.aspx"); } catch (Exception Ex) { response.CssClass = "response"; response.Text = "Kullanıcı Kaydedilemedi.. HATA:" + Ex; } }
protected void Page_Load(object sender, EventArgs e) { SqlCommand command = new SqlCommand("Select * From Tbl_Siparis, Tbl_Kullanicilar where Tbl_Siparis.Musteriid=Tbl_Kullanicilar.Kullaniciid", cnnclss.Connection()); SqlDataReader read = command.ExecuteReader(); ordersDataList.DataSource = read; ordersDataList.DataBind(); cnnclss.Connection().Close(); }
protected void contactButton_Click(object sender, EventArgs e) { SqlCommand command = new SqlCommand("insert into Tbl_KullaniciMesajlari (MesajAd,MesajMail,MesajMesaj) values (@t1,@t2,@t3)", cnnclss.Connection()); command.Parameters.AddWithValue("@t1", contactNameTB.Text); command.Parameters.AddWithValue("@t2", contactMailTB.Text); command.Parameters.AddWithValue("@t3", contactMessageTB.Text); command.ExecuteNonQuery(); cnnclss.Connection().Close(); response.CssClass = "response"; response.Text = "Mesajınız Kaydedilmiştir.."; contactNameTB.Text = ""; contactMailTB.Text = ""; contactMessageTB.Text = ""; }
public void getProductData() { SqlCommand command = new SqlCommand("select Tbl_Parcalar.Parcaid,Tbl_Parcalar.ParcaMarka,Tbl_Parcalar.ParcaResim ,Tbl_Parcalar.Kategoriid ,Tbl_Kategoriler.KategoriAdi , Tbl_Parcalar.ParcaAd, STRING_AGG(Ozellik,' ') as 'ParcaOzellik' from Tbl_Parcalar, Tbl_Ozellik, Tbl_Kategoriler where Tbl_Parcalar.Parcaid =@p1 and Tbl_Ozellik.Parcaid = Tbl_Parcalar.Parcaid and Tbl_Parcalar.Kategoriid=Tbl_Kategoriler.Kategoriid group by Tbl_Parcalar.Parcaid, Tbl_Parcalar.ParcaMarka, Tbl_Parcalar.ParcaAd, Tbl_Parcalar.Kategoriid, Tbl_Parcalar.ParcaResim, Tbl_Kategoriler.KategoriAdi", cnnclss.Connection()); command.Parameters.AddWithValue("@p1", prodid); SqlDataReader dr = command.ExecuteReader(); while (dr.Read()) { prodInfoBrand.Text = dr[1].ToString(); prodInfoName.Text = dr[5].ToString(); prodInfoAttribute.Text = dr[6].ToString(); prodInfoCategory.Text = dr[4].ToString(); prodImg.ImageUrl = dr[2].ToString(); } cnnclss.Connection().Close(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["User"] != null) { SqlCommand command = new SqlCommand("select isAdmin from Tbl_Kullanicilar where KullaniciAdi= '" + Session["User"] + "'", cnnclss.Connection()); String output = command.ExecuteScalar().ToString(); if (output == "True") { cnnclss.Connection().Close(); Response.Redirect("~/pages/AdminDefault.aspx"); } else { cnnclss.Connection().Close(); Response.Redirect("~/pages/Default.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { SqlCommand command = new SqlCommand("Select * From Tbl_Parcalar,Tbl_Kategoriler where Tbl_Kategoriler.Kategoriid=Tbl_Parcalar.Kategoriid", cnnclss.Connection()); SqlDataReader read = command.ExecuteReader(); mainPageDataList.DataSource = read; mainPageDataList.DataBind(); }
public void catCommand(int a) { SqlCommand command = new SqlCommand("Select * From Tbl_Parcalar,Tbl_Kategoriler where Tbl_Parcalar.Kategoriid=" + a + " and Tbl_Kategoriler.Kategoriid=Tbl_Parcalar.Kategoriid", cnnclss.Connection()); SqlDataReader read = command.ExecuteReader(); productPageDataList.DataSource = read; productPageDataList.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { SqlCommand command = new SqlCommand("select siteInfo from Tbl_Hakkimizda where siteID=1", cnnclss.Connection()); SqlDataReader dr = command.ExecuteReader(); while (dr.Read()) { aboutUsText.Text = dr[0].ToString(); } }