예제 #1
0
    void Start()
    {
        soul = GameObject.FindGameObjectWithTag("Soul").transform;
        shop = GameObject.FindGameObjectWithTag("Canvas").GetComponent <shopController>();
        Vector2 randomForce = new Vector2(Random.Range(-spawnForce, spawnForce), Random.Range(-spawnForce, spawnForce));

        GetComponent <Rigidbody2D>().AddForce(randomForce);
    }
예제 #2
0
    protected void btnAddToCart_Click(object sender, EventArgs e)
    {
        try
        {
            shopController sc    = new shopController();
            string         title = (string)Session["booktitle"];
            Book           b     = sc.loadBook(title);

            if (Session["cart"] != null)
            {
                CartList cl = (CartList)Session["cart"];

                int     id    = b.BookID;
                decimal price = 0;
                price = b.Price;

                cartController cc = new cartController();
                cl = cc.addItem(cl, id, title, price);
                Session["cart"] = cl;
            }
            else
            {
                CartList cl = new CartList();

                int     id    = b.BookID;
                decimal price = 0;
                price = b.Price;

                cartController cc = new cartController();
                cl = cc.addItem(cl, id, title, price);
                Session["cart"] = cl;
            }
            Response.Redirect("ViewCart.aspx");
        }
        catch (Exception ex)
        {
            string errormsg = string.Format("<script>Error:{0}</script>", ex.Message);
            Response.Write(errormsg);
        }
    }
예제 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         shopController sc    = new shopController();
         string         title = (string)Session["booktitle"];
         //string title = "The Hate U Give";//For testing purpose
         Book     b = sc.loadBook(title);
         Category c = sc.loadCategory(b);//Mr. Derek, I feel it is not necessary to have a seperate table for category......
         txtTitle.Text    = b.Title;
         txtISBN.Text     = b.ISBN;
         txtAuthor.Text   = b.Author;
         txtCat.Text      = c.Name;
         txtQuantity.Text = b.Stock.ToString();
         txtPrice.Text    = b.Price.ToString();//Original Price
         Image1.ImageUrl  = "~/images/" + b.ISBN + ".jpg";
     } catch (Exception ex)
     {
         string errormsg = string.Format("<script>Error:{0}</script>", ex.Message);
         Response.Write(errormsg);
     }
 }