コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string       nickNo    = Encrypt(HttpUtility.UrlDecode(Request.Cookies["nick"].Value));
         DateTime[]   darray    = GetDateTime(DateTime.Now, 1);
         VisitService vistitDal = new VisitService();
         Rpt_OnlineCustomer.DataSource = vistitDal.GetIndexOnlineCustomer(nickNo, 10, darray[0], darray[1]);
         Rpt_OnlineCustomer.DataBind();
     }
 }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.Cookies["nick"] == null)
            {
                System.Threading.Thread.Sleep(1000 * 6);
            }
            string       nickNo    = DataHelper.Encrypt(HttpUtility.UrlDecode(Request.Cookies["nick"].Value));
            VisitService vistitDal = new VisitService();
            DateTime[]   darray    = DataHelper.GetDateTime(DateTime.Now, 1);
            Rpt_IpPV.DataSource = vistitDal.GetIndexTotalInfoList(nickNo, darray[0], darray[1]).OrderByDescending(o => o.Value).ToList();
            Rpt_IpPV.DataBind();

            Rpt_OnlineCustomer.DataSource = vistitDal.GetIndexOnlineCustomer(nickNo, 3, darray[0], darray[1]);
            Rpt_OnlineCustomer.DataBind();

            TaoBaoGoodsServive taoGoodsService = new TaoBaoGoodsServive();

            IList <GoodsInfo> list = taoGoodsService.GetTopBuyGoods(HttpUtility.UrlDecode(Request.Cookies["nick"].Value), darray[0], darray[1], 1, 3);

            if (list.Count > 0)
            {
                string           pids       = "";
                List <GoodsInfo> cachegoods = new List <GoodsInfo>();
                if (Cache["taobaogoodslist"] != null)
                {
                    cachegoods = (List <GoodsInfo>)Cache["taobaogoodslist"];
                }
                foreach (GoodsInfo info in list)
                {
                    if (!cachegoods.Contains(info))
                    {
                        pids += info.num_iid + ",";
                    }
                }

                if (pids != "")
                {
                    List <GoodsInfo> goodsinfoList = TaoBaoAPI.GetGoodsInfoList(HttpUtility.UrlDecode(Request.Cookies["nick"].Value), Request.Cookies["nicksession"].Value, pids.Substring(0, pids.Length - 1));

                    if (Cache["taobaogoodslist"] == null)
                    {
                        Cache.Insert("taobaogoodslist", goodsinfoList, null, DateTime.Now.AddHours(12), System.Web.Caching.Cache.NoSlidingExpiration);
                    }
                    else
                    {
                        cachegoods.AddRange(goodsinfoList);
                    }
                }
                for (int i = 0; i < list.Count; i++)
                {
                    IList <GoodsInfo> thislist = ((List <GoodsInfo>)Cache["taobaogoodslist"]).Where(o => o.num_iid == list[i].num_iid).ToList();
                    if (thislist.Count > 0)
                    {
                        list[i].title   = thislist[0].title;
                        list[i].price   = thislist[0].price;
                        list[i].pic_url = thislist[0].pic_url;
                    }
                }
            }

            Rpt_GoodsSellTop.DataSource = list;
            Rpt_GoodsSellTop.DataBind();

            SiteTotalService siteTotalDal = new SiteTotalService();
            BindRpt_OrderTotal(siteTotalDal);
            TopSiteTotalInfo lastweek  = siteTotalDal.GetOrderTotalInfo(DateTime.Now.AddDays(-7), DateTime.Now, HttpUtility.UrlDecode(Request.Cookies["nick"].Value));
            TopSiteTotalInfo llastweek = siteTotalDal.GetOrderTotalInfo(DateTime.Now.AddDays(-14), DateTime.Now.AddDays(-8), HttpUtility.UrlDecode(Request.Cookies["nick"].Value));
            ViewState["lastweek"]  = lastweek;
            ViewState["llastweek"] = llastweek;
        }
    }