Example #1
0
        protected void btnBuy_Click(object sender, EventArgs e)
        {
            Member    member    = (Member)Session["Member"];
            CartTable cartTable = new CartTable();
            DataTable dt        = cartTable.GetCart(member);
            Sale      sale      = new Sale();

            sale.SaleDate = DateTime.Now;
            sale.MemberId = member.MemberId;
            SaleDetail[] details = new SaleDetail[dt.Rows.Count];
            for (int i = 0; i < details.Length; i++)
            {
                details[i]           = new SaleDetail();
                details[i].GoodsCode = dt.Rows[i]["GoodsCode"].ToString();
                details[i].Num       = (int)dt.Rows[i]["Num"];
            }
            sale.Detail = details;

            SaleTable st  = new SaleTable();
            int       cnt = st.Insert(sale);

            if (cnt != 0)
            {
                cartTable.Delete(member);
            }
            Server.Transfer("endmessage.aspx");
        }
Example #2
0
        private void PageDisplay()
        {
            Member    member = (Member)Session["Member"];
            CartTable ct     = new CartTable();
            DataTable dt     = ct.GetCart(member);

            dlItems.DataSource = dt;
            dlItems.DataBind();
            if (dt.Rows.Count != 0)
            {
                btnBuy.Visible     = true;
                lblNotCart.Visible = false;
            }
            else
            {
                btnBuy.Visible     = false;
                lblNotCart.Visible = true;
            }
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Member"] != null)
            {
                lbtnLogin.Visible = false;
                lbtnCart.Visible  = true;

                Member    member = (Member)Session["Member"];
                CartTable ct     = new CartTable();
                DataTable dt     = ct.GetCart(member);

                int cnt = 0;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    cnt += 1;
                }
                lbtnCart.Text = "ショッピングカート(" + cnt + "個の商品)";
            }
            else
            {
                lbtnCart.Visible  = false;
                lbtnLogin.Visible = true;
            }
        }