예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        koszyk = (Koszyk)Session["koszyk"];
        if (koszyk == null)
        {
            koszyk            = new Koszyk();
            Session["koszyk"] = koszyk;
        }

        if (!IsPostBack)
        {
            string req = Request.QueryString["prodID"];
            if (req != null)
            {
                int prodID = int.Parse(Request.QueryString["prodID"]);
                koszyk.Dodaj(prodID);
                //usuwanie z adresu prodID
                string url = Request.Url.AbsolutePath;
                System.Web.HttpContext.Current.RewritePath(url, "", "");
            }
        }

        KoszykGridView.DataSource = koszyk.Pobierz();
        KoszykGridView.DataBind();
        kasaButton.Enabled = (koszyk.Ilosc > 0);
    }
예제 #2
0
        protected void KoszykGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            TextBox tb = (TextBox)KoszykGridView.Rows[e.RowIndex].Controls[2].Controls[0]; try { int wartosc = int.Parse(tb.Text); if (wartosc < 0)

                                                                                                 {
                                                                                                     wartosc = wartosc * (-1);
                                                                                                 }
                                                                                                 koszyk.AktualizujIlosc(e.RowIndex, wartosc); } catch { e.Cancel = true; }

            KoszykGridView.EditIndex = -1; KoszykGridView.DataBind();
        }
예제 #3
0
 protected void KoszykGridView_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
 {
     e.Cancel = true;
     KoszykGridView.EditIndex = -1;
     KoszykGridView.DataBind();
 }
예제 #4
0
 protected void KoszykGridView_RowEditing(object sender, GridViewEditEventArgs e)
 {
     KoszykGridView.EditIndex = e.NewEditIndex;
     KoszykGridView.DataBind();
 }
예제 #5
0
 protected void KoszykGridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     koszyk.UsunElement(e.RowIndex);
     KoszykGridView.DataBind();
 }