protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { _pnlEklentiSiparisleri.Visible = false; SepetGetir(); } try { if (Request.QueryString["myp"].ToString() != "") { string YemekID = Request.QueryString["myp"].ToString(); _dtSiparis = _clsData._fncVeriGetir("select * from Yemek where YemekID=" + YemekID.ToString()); _dtSiparisEklenti = _clsData._fncVeriGetir("select * from Eklenti where YemekID=" + YemekID.ToString()); _clsSepet.Ekle(YemekID, _dtSiparis.Rows[0]["YemekAdi"].ToString(), _dtSiparis.Rows[0]["Resim"].ToString(), 1, Convert.ToDouble(_dtSiparis.Rows[0]["Fiyat"])); SepetGetir(); } } catch (Exception) { } try { if (Request.QueryString["SiparisSil"].ToString() != "") { _clsSepet.Sil(Request.QueryString["SiparisSil"].ToString()); SepetGetir(); } } catch (Exception) { } try { if (Request.QueryString["EklentiSiparisSil"].ToString() != "") { _clsSepet.EklentiSil(Request.QueryString["EklentiSiparisSil"].ToString()); SepetGetir(); } } catch (Exception) { } try { if (Request.QueryString["Sepet"].ToString() == "null") { Session.Clear(); Response.Redirect("Anasayfa.aspx"); } } catch (Exception) { } // _fncSepetGuncelle(); }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { try { _dtYemek = (DataTable)Session["Yemek"]; string _id = Session["YemekID"].ToString(); string _ad = _lblYemekAdi2.Text; string _resim = _imgYemek.ImageUrl.ToString(); int _adet = Convert.ToInt32(_txtAdet.Text); double _fiyat = Convert.ToDouble(_dtYemek.Rows[0]["Fiyat"]); _clsSepet.Ekle(_id, _ad, _resim, _adet, _fiyat); } catch (Exception) { } //Response.Redirect("Siparis.aspx?myp=" + Session["YemekID"].ToString()); Response.Redirect("Siparis.aspx"); }
public void Sepet(int id) { if (Session["AktifSepet"] == null) { Sepet s = new Sepet(); SepetEleman se = new SepetEleman(); Kitablar k = new Kitablar(); DataTable dt = Operations <Kitablar> .Select("Id", id.ToString()); k = Operations <Kitablar> .DtToET(dt, k); se.Kitab = k; se.Adet = 1; s.Ekle(se); Session["AktifSepet"] = s; } else { Sepet s = (Sepet)Session["AktifSepet"]; Kitablar k = new Kitablar(); DataTable dt = Operations <Kitablar> .Select("Id", id.ToString()); k = Operations <Kitablar> .DtToET(dt, k); SepetEleman se = new SepetEleman(); se.Kitab = k; se.Adet = 1; s.Eleman.Add(se); Session["AktifSepet"] = s; } }