예제 #1
0
 protected void data(object sender, DataListItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         DataRowView r = (DataRowView)e.Item.DataItem;
         nganluong nl = new nganluong();
         string return_url = "http://www.beppro.vn/ThanhYou.aspx";
         string receiver = "*****@*****.**";
         string transaction_info = "";
         string order_code = "ID2200";
         string price = r["Product_Price"].ToString();
         checkout_url = nl.buildCheckoutUrl(return_url, receiver, transaction_info, order_code, price);
         ((Literal)e.Item.FindControl("Literal2")).Text = "  <a href=\"" + checkout_url + "\" title=\"\"><img src=\"https://www.nganluong.vn/data/images/buttons/3.gif\"  title=\"\"/></a>";
     }
 }
예제 #2
0
        protected void Update_Delete_Item(object sender, RepeaterCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "edit")
                {
                    objDT = (DataTable)Session["cart"];
                    foreach (RepeaterItem ri in Repeater1.Items)
                    {
                        txtQuantity = (TextBox)ri.FindControl("txtQuantity");
                        if (txtQuantity != null)
                        {
                            Label lblTitle = (Label)ri.FindControl("lblTitle");

                            UpdateCart(lblTitle.Text, Convert.ToInt32(txtQuantity.Text), objDT);
                        }
                    }

                    Session["cart"] = objDT;
                    Repeater1.DataSource = objDT;
                    Repeater1.DataBind();

                    lblSum.Text = "" + Get_Total().ToString("#,###,0");
                    Session["sum"] = Convert.ToDecimal(Get_Total());
                    Bussiness.nganluong nl = new nganluong();
                    string return_url = "http://www.beppro.vn/ThanhYou.aspx";
                    string receiver = "*****@*****.**";
                    string transaction_info = "";
                    string order_code = "ID200";
                    string price =Session["sum"].ToString();
                    checkout_url = nl.buildCheckoutUrl(return_url, receiver, transaction_info, order_code, price);
                    Literal2.Text = "  <a href=\"" + checkout_url + "\" title=\"\"><img src=\"https://www.nganluong.vn/data/images/buttons/3.gif\"  title=\"\"/></a>";
                    //Session["total"] = lblSum.Text;
                }

                else
                {
                    objDT = (DataTable)Session["cart"];

                    objDT.Rows[e.Item.ItemIndex].Delete();

                    if (objDT.Rows.Count <= 0)
                    {
                        //btnSubmit.Enabled = false;
                        //btnContinue_Shopping.Enabled = false;
                        Literal1.Text = "Không có sản phẩm nào trong giỏ hàng !";
                    }
                    Session["cart"] = objDT;

                    Repeater1.DataSource = objDT;
                    Repeater1.DataBind();

                    lblSum.Text = "" + Get_Total().ToString("#,###,00") + " (VNĐ)";
                    Session["sum"] = Convert.ToDecimal(lblSum.Text);
                }
            }
            catch (Exception ce)
            {
                this.lblMessager.Text = "Có vấn đề rồi. Làm đúng thao tác là được";
                //return 0;
            }
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    objDT = (DataTable)Session["cart"];
                    Repeater1.DataSource = objDT;
                    Repeater1.DataBind();

                    //string s = Convert.ToString(Session["sum"]);
                    s = objentity.SplitString(Session["sum"].ToString());

                    //int demo = Convert.ToInt32(Session["sum"]);
                    //(s == "")
                    if (s == "")
                    {
                        //lblSum.Text = "0";
                        lblSum.Text = 0.ToString();
                    }
                    else
                    {
                        //lblSum.Text = s;
                        lblSum.Text = objFunc.ChangeTypeMoney(s.ToString());
                    }
                }
            }
            catch (Exception ce)
            {
                this.lblMessager.Text = "Có vấn đề rồi. Làm đúng thao tác là được";
            }
            Bussiness.nganluong nl = new nganluong();

            string return_url = "http://www.beppro.vn/ThanhYou.aspx";
            string receiver = "*****@*****.**";
            string transaction_info = "";
            string order_code = "ID200";
            string price = s.ToString();
            checkout_url = nl.buildCheckoutUrl(return_url, receiver, transaction_info, order_code, price);
            Literal2.Text = "  <a href=\"" + checkout_url + "\" title=\"\"><img src=\"https://www.nganluong.vn/data/images/buttons/3.gif\"  title=\"\"/></a>";
        }