예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            KeyWordService      kyDal    = new KeyWordService();
            GoodsService        goodsDal = new GoodsService();
            string              nick     = HttpUtility.UrlDecode(Request.Cookies["nick"].Value);
            IList <KeyWordInfo> list     = kyDal.GetKeyWords(nick);

            IList <TaoBaoAPIHelper.GoodsInfo> goodsList = goodsDal.GetAllGoods(nick);
            Dictionary <string, List <TaoBaoAPIHelper.GoodsInfo> > dic = new Dictionary <string, List <TaoBaoAPIHelper.GoodsInfo> >();
            foreach (KeyWordInfo info in list)
            {
                dic.Add(info.KeyWord, new List <TaoBaoAPIHelper.GoodsInfo>());

                List <TaoBaoAPIHelper.GoodsInfo> sgoods = TaoBaoAPIHelper.TaoBaoAPI.SearchGoods(info.KeyWord);

                foreach (TaoBaoAPIHelper.GoodsInfo ginfo in new List <TaoBaoAPIHelper.GoodsInfo>(goodsList))
                {
                    for (int i = 0; i < sgoods.Count; i++)
                    {
                        if (nick == sgoods[i].nick && ginfo.num_iid == sgoods[i].num_iid)
                        {
                            ginfo.Collection = i + 1;//此处当作排名使用
                            dic[info.KeyWord].Add(ginfo);
                        }
                    }
                }
            }
            Rpt_KeyWords.DataSource = dic;
            Rpt_KeyWords.DataBind();
        }
    }
예제 #2
0
        public void GetTaoBaoGoods()
        {
            NickSessionService nsDal = new NickSessionService();
            IList <Model.TopNickSessionInfo> list = nsDal.GetAllNickSession(new[] { TopTaoBaoService.Temporary, TopTaoBaoService.YingXiaoJueCe });

            GoodsService goodsDal = new GoodsService();

            for (int i = 0; i < list.Count; i++)
            {
                string shopId = TaoBaoAPI.GetShopInfo(list[i].Nick, list[i].Session);
                list[i].ShopId = shopId;
                nsDal.UpdateNickShop(list[i].Nick, shopId);
            }

            foreach (Model.TopNickSessionInfo info in list)
            {
                List <GoodsInfo> goodsList = TaoBaoAPIService.GetGoodsInfoListByNick(info.Nick, info.Session, info.ServiceId);

                List <GoodsInfo> allGoods = goodsDal.GetAllGoods(info.Nick);

                foreach (GoodsInfo ginfo in goodsList)
                {
                    if (allGoods.Contains(ginfo))
                    {
                        goodsDal.UpdateGoodsInfo(ginfo);
                    }
                    else
                    {
                        goodsDal.InsertGoods(ginfo, info.Nick);
                    }
                }
            }
        }
        public ResultModel getAllGoods()
        {
            ResultModel res = new ResultModel();

            res.status = "200";
            res.insert("goodsInfo", GoodsService.GetAllGoods());
            return(res);
        }
예제 #4
0
        public ActionResult SearchGoods(string searchKey)
        {
            TempData["SearchKey"] = searchKey;
            var allGoods    = goodsService.GetAllGoods();
            var allGoodsDTO = allGoods.Select(item => new ViewModelGoods
            {
                GoodsId       = item.GoodsId,
                GoodsName     = item.GoodsName,
                Detail        = item.Detail,
                Configuration = item.Configuration,
                InstallWay    = item.InstallWay,
                Type          = item.Type,
            }).ToList();
            var searchResult = allGoodsDTO
                               .Where(u => u.GoodsName.Contains(searchKey)).ToList();

            return(View(searchResult));
        }
예제 #5
0
    public static void GetAllGoods(string nick, string session)
    {
        GoodsService     goodsDal  = new GoodsService();
        List <GoodsInfo> goodsList = TaoBaoAPI.GetGoodsInfoListByNick(nick, session);

        List <GoodsInfo> allGoods = goodsDal.GetAllGoods(nick);

        foreach (GoodsInfo ginfo in goodsList)
        {
            if (allGoods.Contains(ginfo))
            {
                goodsDal.UpdateGoodsInfo(ginfo);
            }
            else
            {
                goodsDal.InsertGoods(ginfo, nick);
            }
        }
    }
예제 #6
0
        public ActionResult SearchGoods(string searchKey, int?page)
        {
            var allGoods    = goodsService.GetAllGoods();
            var allGoodsDTO = allGoods.Select(item => new ViewModelGoods
            {
                GoodsId       = item.GoodsId,
                GoodsName     = item.GoodsName,
                Detail        = item.Detail,
                Configuration = item.Configuration,
                InstallWay    = item.InstallWay,
                Type          = item.Type,
            }).ToList();
            var searchResult = allGoodsDTO
                               .Where(u => u.GoodsName.Contains(searchKey)).ToList();

            int pageNumber = page ?? 1;
            int pageSize   = 5;
            var list       = searchResult.ToPagedList(pageNumber, pageSize);

            return(PartialView("ItemGoods", list));
        }
예제 #7
0
 public async Task <IActionResult> Cards()
 {
     return(await Task.Run(() => PartialView("_ProductCards", _goodsService.GetAllGoods())));
 }
예제 #8
0
    public static void GetKfjxTotal(string nick, DateTime start, DateTime now)
    {
        TalkRecodService    trDal    = new TalkRecodService();
        GoodsService        goodsDal = new GoodsService();
        GoodsOrderService   goDal    = new GoodsOrderService();
        TopKefuTotalService kfDal    = new TopKefuTotalService();
        //所有商品
        List <TaoBaoAPIHelper.GoodsInfo> goodsNickList = goodsDal.GetAllGoods(nick);

        for (DateTime h = start; h < now; h = h.AddDays(1))
        {
            //所有订单
            List <TaoBaoAPIHelper.GoodsOrderInfo> orderList = goDal.GetGoodsOrderList(nick, h, h.AddDays(1));

            //得到回复次数和接待人数
            List <CustomerInfo> cuslist = trDal.GetReceiveList(nick, h, h.AddDays(1));

            //得到接待人和购买者信息
            IList <CustomerInfo> cusBuyList = trDal.GetCustomerList(h, h.AddDays(1), nick);

            //得到客服未回复的客户数量
            List <TopKefuTotalInfo> untalkList = trDal.GetUnTalkCustomerList(nick, h, h.AddDays(1));

            for (int i = 0; i < cusBuyList.Count; i++)
            {
                IList <TaoBaoAPIHelper.GoodsOrderInfo> thislist = orderList.Where(o => o.buyer_nick == cusBuyList[i].CustomerNick).ToList();
                if (thislist.Count > 0)
                {
                    cusBuyList[i].tid = thislist[0].tid;
                }
            }
            //得到成功下单
            List <CustomerInfo> orderCusList = cusBuyList.Where(o => !string.IsNullOrEmpty(o.tid)).ToList();
            foreach (CustomerInfo fromInfo in cuslist)
            {
                TopKefuTotalInfo kefutotalInfo = new TopKefuTotalInfo();
                kefutotalInfo.CustomerCount = int.Parse(fromInfo.CustomerNick);
                kefutotalInfo.ReceiveCount  = fromInfo.TalkCount;
                kefutotalInfo.Nick          = fromInfo.FromNick;
                kefutotalInfo.NickDate      = h.ToString("yyyyMMdd");
                //赋值未回复数量
                if (untalkList.Where(o => o.Nick == fromInfo.FromNick).ToList().Count > 0)
                {
                    kefutotalInfo.UnTalkCustomerCount = untalkList.Where(o => o.Nick == fromInfo.FromNick).ToList()[0].UnTalkCustomerCount;
                }

                List <CustomerInfo> mylist = orderCusList.Where(o => o.FromNick == fromInfo.FromNick).ToList();
                if (mylist.Count > 0)
                {
                    List <string> tids = new List <string>();
                    foreach (CustomerInfo inf in mylist)
                    {
                        tids.Add(inf.tid);
                    }

                    List <TaoBaoAPIHelper.GoodsOrderInfo> myolist = orderList.Where(o => tids.Contains(o.tid)).ToList();

                    kefutotalInfo.OrderCount = mylist.Count;

                    kefutotalInfo.PostFee = myolist.Sum(o => o.post_fee);
                    kefutotalInfo.Payment = myolist.Sum(o => o.payment);

                    List <TaoBaoAPIHelper.GoodsInfo> goodsList = goDal.GetGoodsCount(tids);
                    kefutotalInfo.GoodsCount = goodsList.Sum(o => o.Count);
                    decimal goodsPriceTotal = 0;
                    foreach (TaoBaoAPIHelper.GoodsInfo ginfo in goodsList)
                    {
                        List <TaoBaoAPIHelper.GoodsInfo> mygoodsList = goodsNickList.Where(o => o.num_iid == ginfo.num_iid).ToList();
                        if (mygoodsList.Count > 0)
                        {
                            goodsPriceTotal += mygoodsList[0].price * ginfo.Count;
                        }
                        else
                        {
                            TaoBaoAPIHelper.GoodsInfo newgoods = TaoBaoAPIHelper.TaoBaoAPI.GetGoodsInfoService(ginfo.num_iid);
                            if (newgoods != null)
                            {
                                goodsPriceTotal += newgoods.price * ginfo.Count;
                                //找到后添加到集合
                                goodsNickList.Add(newgoods);
                            }
                        }
                    }
                    kefutotalInfo.GoodsPay = goodsPriceTotal;
                }
                //添加或者更新
                kfDal.AddOrUp(kefutotalInfo);
            }
        }
    }
예제 #9
0
 public async Task <IActionResult> Goods()
 {
     return(await Task.Run(() => PartialView("List/_Goods_main",
                                             _goodsService.GetAllGoods())));
 }
예제 #10
0
        public ActionResult Goods()
        {
            var goodsList = _goodsService.GetAllGoods();

            return(View(goodsList));
        }