/// <summary>
        /// 抓出推薦的手機折扣
        /// <param name="count">數量</param>
        /// <returns>搜尋結果</returns>
        public IList <PromoteVO> GetPromoteList(int count)
        {
            IList <PromoteVO> result = new List <PromoteVO>();

            //50強手機
            Dictionary <string, string> conditionsPhone = new Dictionary <string, string>();

            conditionsPhone.Add("IsPromote", "true");
            conditionsPhone.Add("NodeId", "3");
            conditionsPhone.Add("PageIndex", "0");
            conditionsPhone.Add("PageSize", count.ToString());
            conditionsPhone.Add("Order", string.Format("order by {0}", "p.WarrantySuppliers, p.SortNo, p.Title"));

            IList <PostVO> phoneList = PostDao.GetPostList(conditionsPhone);

            if (phoneList != null && phoneList.Count > 0)
            {
                foreach (PostVO vo in phoneList)
                {
                    PromoteVO promoteVO = new PromoteVO();
                    promoteVO.Id = vo.PostId;
                    promoteVO.WarrantySuppliers = vo.WarrantySuppliers;
                    promoteVO.SortNo            = vo.SortNo;
                    promoteVO.Title             = vo.Title;
                    promoteVO.SellPrice         = vo.SellPrice.ToString();
                    promoteVO.SellPriceW1       = GetPromoteSellPrice(vo.SellPrice, "中華電信");
                    promoteVO.SellPriceW2       = GetPromoteSellPrice(vo.SellPrice, "遠傳");
                    promoteVO.SellPriceW3       = GetPromoteSellPrice(vo.SellPrice, "台哥大");
                    promoteVO.SellPriceW4       = GetPromoteSellPrice(vo.SellPrice, "亞太電信");
                    promoteVO.SellPriceW5       = GetPromoteSellPrice(vo.SellPrice, "台灣之星");

                    result.Add(promoteVO);
                }
            }


            return(result);
        }
    private string GetProductList2(NodeVO vo, IList <PromoteVO> promoteList)
    {
        StringBuilder sb = new StringBuilder();

        IList <PromoteVO> list = promoteList.Where(p => p.WarrantySuppliers.Equals(vo.Name)).ToList();

        if (list != null && list.Count > 0)
        {
            for (int i = 0; i < list.Count; i++)
            {
                PromoteVO promoteVO = list[i];
                sb.AppendFormat("<tr><td class='product_ov_type'>{0}</td><td class='product_ov_price'>${1}</td><td class='product_ov_price'>${2}</td><td class='product_ov_price'>${3}</td><td class='product_ov_price'>${4}</td><td class='product_ov_price'>${5}</td><td class='product_ov_price'>${6}</td></tr>"
                                , promoteVO.Title, promoteVO.SellPrice
                                , promoteVO.SellPriceW1
                                , promoteVO.SellPriceW2
                                , promoteVO.SellPriceW3
                                , promoteVO.SellPriceW4
                                , promoteVO.SellPriceW5);
            }
        }

        return(sb.ToString());
    }
示例#3
0
    private string GetProductList(NodeVO vo, IList <PromoteVO> promoteList)
    {
        StringBuilder sb = new StringBuilder();

        IList <PromoteVO> list = promoteList.Where(p => p.WarrantySuppliers.Equals(vo.Name)).ToList();

        if (list != null && list.Count > 0)
        {
            for (int i = 0; i < list.Count; i++)
            {
                PromoteVO promoteVO = list[i];
                sb.AppendFormat("<tr onclick=\"window.location='product.aspx?id={7}';\" style='cursor:pointer;'><td class='product_ov_type'>{0}</td><td class='product_ov_price'>${1}</td><td class='product_ov_price'>${2}</td><td class='product_ov_price'>${3}</td><td class='product_ov_price'>${4}</td><td class='product_ov_price'>${5}</td><td class='product_ov_price'>${6}</td></tr>"
                                , promoteVO.Title, promoteVO.SellPrice
                                , promoteVO.SellPriceW1
                                , promoteVO.SellPriceW2
                                , promoteVO.SellPriceW3
                                , promoteVO.SellPriceW4
                                , promoteVO.SellPriceW5
                                , promoteVO.Id);
            }
        }

        return(sb.ToString());
    }