Ejemplo n.º 1
0
    /// <summary>
    /// 获得购物车列表
    /// </summary>
    public static IList <cart_items> GetList()
    {
        IDictionary <string, int> dic = GetCart();

        if (dic != null)
        {
            IList <cart_items> iList = new List <cart_items>();

            foreach (var item in dic)
            {
                tbl_product model = new tbl_product();
                model.GetModel(Convert.ToInt32(item.Key.Split('|')[0]));

                cart_items modelt = new cart_items();
                modelt.id                  = model.pro_id;
                modelt.title               = model.pro_name;
                modelt.goprice             = Utils.StrToDecimal(model.go_price.ToString(), 0);
                modelt.img_url             = model.pro_imgs;
                modelt.product_category_id = Convert.ToInt32(model.pro_pid);
                modelt.dw                  = model.pro_danwei;
                modelt.price               = Utils.StrToDecimal(model.salse_price.ToString(), 0);
                modelt.quantity            = item.Value;
                modelt.shuxing             = item.Key.Split('|')[1];
                modelt.key_shuxing         = item.Key;
                iList.Add(modelt);
            }
            return(iList);
        }
        return(null);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 获得购物车列表
    /// </summary>
    public static IList <cart_items> GetList()
    {
        IDictionary <string, int> dic = GetCart();

        if (dic != null)
        {
            IList <cart_items> iList = new List <cart_items>();

            foreach (var item in dic)
            {
                ps_here_depot model = new ps_here_depot();
                model.GetModel(Convert.ToInt32(item.Key));

                cart_items modelt = new cart_items();
                modelt.id                  = model.id;
                modelt.title               = model.product_name;
                modelt.img_url             = model.product_url;
                modelt.product_category_id = Convert.ToInt32(model.product_category_id);
                modelt.dw                  = model.dw;
                modelt.price               = Utils.StrToDecimal(model.salse_price.ToString(), 0);
                modelt.quantity            = item.Value;
                iList.Add(modelt);
            }
            return(iList);
        }
        return(null);
    }
Ejemplo n.º 3
0
        public static List <cart_items> ToList(List <cart_keys> ls, int group_id)
        {
            if (ls == null)
            {
                return((List <cart_items>)null);
            }
            List <cart_items> cartItemsList = new List <cart_items>();

            foreach (cart_keys l in ls)
            {
                Rain.Model.article model = new Rain.BLL.article().GetModel(l.article_id);
                if (model != null && model.fields.ContainsKey("sell_price"))
                {
                    cart_items cartItems = new cart_items();
                    cartItems.article_id = model.id;
                    if (model.fields.ContainsKey("goods_no"))
                    {
                        cartItems.goods_no = model.fields["goods_no"];
                    }
                    cartItems.title      = model.title;
                    cartItems.img_url    = model.img_url;
                    cartItems.sell_price = Utils.StrToDecimal(model.fields["sell_price"], new Decimal(0));
                    cartItems.user_price = Utils.StrToDecimal(model.fields["sell_price"], new Decimal(0));
                    if (model.fields.ContainsKey("point"))
                    {
                        cartItems.point = Utils.StrToInt(model.fields["point"], 0);
                    }
                    if (model.fields.ContainsKey("stock_quantity"))
                    {
                        cartItems.stock_quantity = Utils.StrToInt(model.fields["stock_quantity"], 0);
                    }
                    bool flag = false;
                    if (group_id > 0 && model.group_price != null)
                    {
                        user_group_price userGroupPrice = model.group_price.Find((Predicate <user_group_price>)(p => p.group_id == group_id));
                        if (userGroupPrice != null)
                        {
                            flag = true;
                            cartItems.user_price = userGroupPrice.price;
                        }
                    }
                    if (group_id > 0 && !flag)
                    {
                        int discount = new Rain.BLL.user_groups().GetDiscount(group_id);
                        if (discount > 0)
                        {
                            cartItems.user_price = cartItems.sell_price * (Decimal)discount / new Decimal(100);
                        }
                    }
                    cartItems.quantity = l.quantity;
                    cartItemsList.Add(cartItems);
                }
            }
            return(cartItemsList);
        }
Ejemplo n.º 4
0
    /// <summary>
    /// 获得购物车列表
    /// </summary>
    public static IList <cart_items> GetList()
    {
        IDictionary <string, int> dic = GetCart();

        if (dic != null)
        {
            IList <cart_items> iList = new List <cart_items>();

            foreach (var item in dic)
            {
                ax_ticket model = new ax_ticket();
                model.GetModel(Convert.ToInt32(item.Key));

                cart_items modelt = new cart_items();
                modelt.id        = model.id;
                modelt.ticket_no = model.ticket_no;

                iList.Add(modelt);
            }
            return(iList);
        }
        return(null);
    }