コード例 #1
0
        void loadCake(String cakeName)
        {
            Cake c = CakeController.get(cakeName);

            lblCakeName.Text = c.CakeName;
            lblCakePrice.Text = c.Price.ToString();
        }
コード例 #2
0
        protected void ViewAllCake_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            Member currUser = (Member)Session["userLogin"];

            if (currUser.Type == "Customer")
            {
                lblError.Text = "You're not an admin!";
            }

            else
            {
                String Cake_Name = ViewAllCakeAdmin.Rows[e.RowIndex].Cells[0].Text;

                Cake c   = CakeController.get(Cake_Name);
                int  row = CakeRepositories.deleteCake(c);
                lblError.Text = "Deletion Success!";
                if (row > 0)
                {
                    loadData();
                }
            }
        }
コード例 #3
0
        protected void btnCheckOut_Click(object sender, EventArgs e)
        {
            Member m = (Member)Session["userLogin"];

            DateTime date      = DateTime.Now.Date;
            String   custEmail = m.Email;

            List <CartSession> cart = (List <CartSession>)Session["cartSessionData"];

            foreach (CartSession c in cart)
            {
                TransactionController.create(custEmail, date, m.Name, c.cakeName, c.cakePrice, c.chocPlat, c.proTitle, c.proDiscount, c.subTotal);

                Cake ca = CakeController.get(c.cakeName);
                CakeController.minusCake(ca);
            }

            Session["cartSessionData"] = null;
            Session["cartSessionData"] = new List <CartSession>();

            erMessage.Text = "Checkout Success!";
            loadData();
        }