Ejemplo n.º 1
0
    /// <summary>
    /// 获取用户信息
    /// </summary>
    private void GetCustomInfo()
    {
        IUserBLL   userBLL   = (IUserBLL)SpringContext.Context.CreateSecurityProxyInstance("UserBLL");
        ICustomBLL customBLL = (ICustomBLL)SpringContext.Context.CreateSecurityProxyInstance("CustomBLL");

        if (userBLL.Logined)
        {
            ltlCustomName.Text = customBLL.Select(userBLL.UserID).CustomName;
        }
    }
Ejemplo n.º 2
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        int customId;

        int.TryParse(txtCustomId.Text.Trim(), out customId);

        ICustomBLL customBLL = (ICustomBLL)SpringContext.Context.CreateInstance("CustomBLL");
        Custom     custom    = customBLL.Select(customId);

        if (custom != null)
        {
            IUserBLL userBLL = (IUserBLL)SpringContext.Context.CreateInstance("UserBLL");
            userBLL.Login(customId);
            Response.Redirect("ProductList.aspx", true);
        }

        lblError.Text = "ID不存在!";
    }
Ejemplo n.º 3
0
    private void Login()
    {
        int customId;

        int.TryParse(Request.Form["CustomID"], out customId);

        ICustomBLL customBLL = (ICustomBLL)SpringContext.Context.CreateInstance("CustomBLL");
        Custom     custom    = customBLL.Select(customId);

        if (custom != null)
        {
            IUserBLL userBLL = (IUserBLL)SpringContext.Context.CreateInstance("UserBLL");
            userBLL.Login(customId);
            Response.Write("{success: true}");
        }
        else
        {
            Response.Write("{success: false,msg: 'CustomID不存在!'}");
        }
        Response.End();
    }
Ejemplo n.º 4
0
    protected void rpt_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        int         productId  = int.Parse(e.CommandArgument.ToString());
        IProductBLL productBLL = (IProductBLL)SpringContext.Context.CreateSecurityProxyInstance("ProductBLL");

        switch (e.CommandName.ToLower())
        {
        case "delete":
            productBLL.Delete(productId);
            Response.Redirect("ProductList.aspx", true);
            break;

        case "putcar":;
            Product product = productBLL.Select(productId);

            OrderProduct orderProduct = new OrderProduct();
            orderProduct.Num         = 1;
            orderProduct.ProductID   = productId;
            orderProduct.ProductName = product.ProductName;

            IUserBLL   userBLL   = (IUserBLL)SpringContext.Context.CreateSecurityProxyInstance("UserBLL");
            ICustomBLL customBLL = (ICustomBLL)SpringContext.Context.CreateSecurityProxyInstance("CustomBLL");
            if (customBLL.Select(userBLL.UserID).IsMember)
            {
                orderProduct.Price = product.MemberPrice;
            }
            else
            {
                orderProduct.Price = product.NormalPrice;
            }

            IShopCarBLL shopCarBLL = (IShopCarBLL)SpringContext.Context.CreateSecurityProxyInstance("ShopCarBLL");
            shopCarBLL.Add(orderProduct);
            Response.Redirect("ShopCar.aspx", true);
            break;

        default:
            break;
        }
    }
Ejemplo n.º 5
0
    /// <summary>
    /// 向购物车添加产品
    /// </summary>
    private void Add()
    {
        string id = Request.QueryString["productId"];

        if (!string.IsNullOrEmpty(id))
        {
            int productId = 0;
            int.TryParse(id, out productId);

            IProductBLL   productBLL = (IProductBLL)SpringContext.Context.CreateInstance("ProductBLL");
            Model.Product product    = productBLL.Select(productId);

            OrderProduct orderProduct = new OrderProduct();
            orderProduct.Num         = 1;
            orderProduct.ProductID   = productId;
            orderProduct.ProductName = product.ProductName;

            IUserBLL   userBLL   = (IUserBLL)SpringContext.Context.CreateInstance("UserBLL");
            ICustomBLL customBLL = (ICustomBLL)SpringContext.Context.CreateInstance("CustomBLL");
            if (customBLL.Select(userBLL.UserID).IsMember)
            {
                orderProduct.Price = product.MemberPrice;
            }
            else
            {
                orderProduct.Price = product.NormalPrice;
            }

            shopCarBLL.Add(orderProduct);

            Response.Write("{success:true}");
        }
        else
        {
            Response.Write("{success:false}");
        }
        Response.End();
    }