Example #1
0
        protected void RadLV_splb_ItemCommand(object sender, Telerik.Web.UI.RadListViewCommandEventArgs e)
        {
            string Collectid = e.CommandArgument.ToString();

            if (e.CommandName == "Delete")
            {
                string AppriseID1;
                AppriseID1 = e.CommandArgument.ToString();
                Appraise_Bll.DeleteList(e.CommandArgument.ToString());
                RadLV_splb.Rebind();//删除
            }
            if (e.CommandName == "Join")
            {
                string CommodityID1;
                CommodityID1 = e.CommandArgument.ToString();
                Maticsoft.Model.Commodity modelCommodity = Commodity_Bll.GetModel(CommodityID1.ToString());
                if (ShoppingCart_Bll.GetRecordCount(" CommodityID='" + CommodityID1 + "' and UserID='" + UsersInfo.UserID + "' ") > 0)
                {
                    Maticsoft.Model.ShoppingCart modelShoppingCart = ShoppingCart_Bll.GetModel(CommodityID1.ToString());
                    string id = ShoppingCart_Bll.GetList(" CommodityID='" + CommodityID1 + "' and UserID='" + UsersInfo.UserID + "' ").Tables[0].Rows[0]["ShoppingCartID"].ToString();
                    modelShoppingCart = ShoppingCart_Bll.GetModel(id);
                    modelShoppingCart.ShoppingCartID = modelShoppingCart.ShoppingCartID;
                    modelShoppingCart.UserID         = UsersInfo.UserID;
                    modelShoppingCart.CommodityID    = modelCommodity.CommodityID;
                    modelShoppingCart.OrderNumber    = modelShoppingCart.OrderNumber + 1;

                    if (modelShoppingCart.OrderNumber > modelCommodity.Stock)
                    {
                        RadAjaxManager1.Alert("库存不足!");
                        return;
                    }
                    ShoppingCart_Bll.Update(modelShoppingCart);
                }
                else
                {
                    Maticsoft.Model.Users modelusers = Users_Bll.GetModel(UsersInfo.UserID);
                    decimal discount1;
                    if (modelusers.UserGrade == "VIP")
                    {
                        discount1 = Convert.ToDecimal(0.95);
                    }
                    else
                    {
                        discount1 = Convert.ToDecimal(1);
                    }
                    ShoppingCart_Mol.ShoppingCartID = DateTime.Now.ToString("yyyyMMddhhmmss");
                    ShoppingCart_Mol.UserID         = UsersInfo.UserID;
                    ShoppingCart_Mol.CommodityID    = CommodityID1;
                    ShoppingCart_Mol.OrderNumber    = 1;
                    ShoppingCart_Mol.Subtotal       = ((ShoppingCart_Mol.OrderNumber * modelCommodity.VIPPrice) * discount1).ToString();
                    ShoppingCart_Bll.Add(ShoppingCart_Mol);
                }
                RadAjaxManager1.Alert("已添加到购物车!");
            }
        }
Example #2
0
        protected void DataLoad()
        {
            sqlselect  = "";
            sqlselect += "  CommodityState = '上架' ";
            if (Request.QueryString["search"] != null)
            {
                if (!string.IsNullOrEmpty(sqlselect))
                {
                    sqlselect += " and ";
                }
                sqlselect += " CommodityName like '%" + Request.QueryString["search"] + "%' ";

                if (!string.IsNullOrEmpty(Request.QueryString["search"]))
                {
                    RadLV_splb.Rebind();
                }
            }
            if (Request.QueryString["search1"] != null)
            {
                if (!string.IsNullOrEmpty(sqlselect))
                {
                    sqlselect += " and ";
                }
                sqlselect = " CommoditySonID = '" + Request.QueryString["search1"] + "' ";

                if (!string.IsNullOrEmpty(Request.QueryString["search1"]))
                {
                    RadLV_splb.Rebind();
                }
            }

            if (Request.QueryString["search2"] != null)
            {
                if (!string.IsNullOrEmpty(sqlselect))
                {
                    sqlselect += " and ";
                }
                sqlselect = " CommodityFatherID = '" + Request.QueryString["search2"] + "' ";

                if (!string.IsNullOrEmpty(Request.QueryString["search2"]))
                {
                    RadLV_splb.Rebind();
                }
            }
        }
Example #3
0
 protected void RadLV_splb_PageIndexChanged(object sender, Telerik.Web.UI.RadListViewPageChangedEventArgs e)
 {
     RadLV_splb.Rebind();
 }