private void Bind(DateTime start, DateTime end)
    {
        int TotalCount = 0; //总记录数
        int TotalPage  = 1; //总页数

        int page = 1;

        try
        {
            page = int.Parse(Request.QueryString["Page"]);
            if (ViewState["page"] != null)
            {
                page = int.Parse(ViewState["page"].ToString());
                ViewState["page"] = null;
            }
        }
        catch { }

        IList <GoodsOrderInfo> list = orderDal.GetSellCityTop(start, end, HttpUtility.UrlDecode(Request.Cookies["nick"].Value));

        TotalCount      = list.Count;
        pds.DataSource  = list;
        pds.AllowPaging = true;
        pds.PageSize    = 20;
        if (TotalCount == 0)
        {
            TotalPage = 1;
        }
        else
        {
            if (TotalCount % pds.PageSize == 0)
            {
                TotalPage = TotalCount / pds.PageSize;
            }
            else
            {
                TotalPage = TotalCount / pds.PageSize + 1;
            }
        }

        pds.CurrentPageIndex = page - 1;
        lblCurrentPage.Text  = "共" + TotalCount.ToString() + "条记录 当前页:" + page + "/" + TotalPage;

        lnkFrist.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=1&" + "start=" + start.ToShortDateString() + "&end=" + end.ToShortDateString();
        if (!pds.IsFirstPage)
        {
            lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(page - 1) + "&" + "start=" + start.ToShortDateString() + "&end=" + end.ToShortDateString();
        }

        if (!pds.IsLastPage)
        {
            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(page + 1) + "&" + "start=" + start.ToShortDateString() + "&end=" + end.ToShortDateString();
        }
        lnkEnd.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + TotalPage + "&" + "start=" + start.ToShortDateString() + "&end=" + end.ToShortDateString();

        Rpt_PageVisit.DataSource = pds;
        Rpt_PageVisit.DataBind();
        TB_Start.Text = start.ToString("yyyy-MM-dd");
        TB_End.Text   = end.ToString("yyyy-MM-dd");
    }
    private void Bind(string nick, string session, DateTime start, DateTime end, int totalCount, int recordCount)
    {
        int TotalPage = totalCount % recordCount != 0 ? (totalCount / recordCount) + 1 : totalCount / recordCount; //总页数

        int page = 1;

        try
        {
            page = int.Parse(Request.QueryString["Page"]);
            if (ViewState["page"] != null)
            {
                page = int.Parse(ViewState["page"].ToString());
                ViewState["page"] = null;
            }
        }
        catch { }

        IList <GoodsOrderInfo> list = taoGoodsOrderService.GetOrderList(HttpUtility.UrlDecode(Request.Cookies["nick"].Value), start, end, page, recordCount);


        lblCurrentPage.Text = "共" + totalCount.ToString() + "条记录 当前页:" + page + "/" + (TotalPage == 0 ? 1 : TotalPage);

        lnkFrist.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=1&" + "start=" + start.ToShortDateString() + "&end=" + end.ToShortDateString();
        if (page > 1)
        {
            lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(page - 1) + "&" + "start=" + start.ToShortDateString() + "&end=" + end.ToShortDateString();
        }

        if (page != TotalPage && TotalPage != 0)
        {
            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(page + 1) + "&" + "start=" + start.ToShortDateString() + "&end=" + end.ToShortDateString();
        }
        lnkEnd.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + (TotalPage == 0 ? 1 : TotalPage) + "&" + "start=" + start.ToShortDateString() + "&end=" + end.ToShortDateString();

        Rpt_PageVisit.DataSource = list;
        Rpt_PageVisit.DataBind();
        TB_Start.Text = start.ToString("yyyy-MM-dd");
        TB_End.Text   = end.ToString("yyyy-MM-dd");
    }
    private void Bind(string nick, string session, DateTime start, DateTime end, int totalCount, int recordCount)
    {
        int TotalPage = totalCount % recordCount != 0 ? (totalCount / recordCount) + 1 : totalCount / recordCount; //总页数

        int page = 1;

        try
        {
            page = int.Parse(Request.QueryString["Page"]);
            if (ViewState["page"] != null)
            {
                page = int.Parse(ViewState["page"].ToString());
                ViewState["page"] = null;
            }
        }
        catch { }

        IList <GoodsOrderInfo> goodsOrderList = taoGoodsOrderService.GetOrderList(HttpUtility.UrlDecode(Request.Cookies["nick"].Value), start, end, page, recordCount);


        IList <CustomerInfo> list = trDal.GetCustomerList(start, end, nick);

        if (list.Count > 0)
        {
            for (int i = 0; i < goodsOrderList.Count; i++)
            {
                IList <CustomerInfo> thislist = list.Where(o => o.CustomerNick == goodsOrderList[i].buyer_nick).ToList();
                if (thislist.Count > 0)
                {
                    if (thislist[0].FromNick.IndexOf(":") > 0)
                    {
                        goodsOrderList[i].seller_nick = thislist[0].FromNick.Substring(thislist[0].FromNick.IndexOf(":") + 1);
                    }
                    else
                    {
                        goodsOrderList[i].seller_nick = thislist[0].FromNick;
                    }
                }
                else
                {
                }
            }
        }

        lblCurrentPage.Text = "共" + totalCount.ToString() + "条记录 当前页:" + page + "/" + (TotalPage == 0 ? 1 : TotalPage);

        lnkFrist.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=1&" + "start=" + start.ToShortDateString() + "&end=" + end.ToShortDateString();
        if (page > 1)
        {
            lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(page - 1) + "&" + "start=" + start.ToShortDateString() + "&end=" + end.ToShortDateString();
        }

        if (page != TotalPage && TotalPage != 0)
        {
            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(page + 1) + "&" + "start=" + start.ToShortDateString() + "&end=" + end.ToShortDateString();
        }
        lnkEnd.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + (TotalPage == 0 ? 1 : TotalPage) + "&" + "start=" + start.ToShortDateString() + "&end=" + end.ToShortDateString();

        Rpt_PageVisit.DataSource = goodsOrderList;
        Rpt_PageVisit.DataBind();
        TB_Start.Text = start.ToString("yyyy-MM-dd");
        TB_End.Text   = end.ToString("yyyy-MM-dd");
    }
    private void Bind(string nick, string session, DateTime start, DateTime end, int totalCount, int recordCount)
    {
        int TotalPage = totalCount % recordCount != 0 ? (totalCount / recordCount) + 1 : totalCount / recordCount; //总页数

        int page = 1;

        try
        {
            page = int.Parse(Request.QueryString["Page"]);
            if (ViewState["page"] != null)
            {
                page = int.Parse(ViewState["page"].ToString());
                ViewState["page"] = null;
            }
        }
        catch { }

        IList <GoodsInfo> list = taoGoodsService.GetTopBuyGoods(HttpUtility.UrlDecode(Request.Cookies["nick"].Value), start, end, page, recordCount);

        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(nick, session, 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;
                }
            }
        }

        //for (int i = 0; i < list.Count; i++)
        //{
        //    GoodsInfo rinfo = TaoBaoAPI.GetGoodsInfo(list[i].num_iid);
        //    list[i].title = rinfo.title;
        //    list[i].price = rinfo.price;
        //}

        lblCurrentPage.Text = "共" + totalCount.ToString() + "条记录 当前页:" + page + "/" + (TotalPage == 0 ? 1 : TotalPage);

        lnkFrist.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=1&" + "start=" + start.ToShortDateString() + "&end=" + end.ToShortDateString();
        if (page > 1)
        {
            lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(page - 1) + "&" + "start=" + start.ToShortDateString() + "&end=" + end.ToShortDateString();
        }

        if (page != TotalPage && TotalPage != 0)
        {
            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(page + 1) + "&" + "start=" + start.ToShortDateString() + "&end=" + end.ToShortDateString();
        }
        lnkEnd.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + (TotalPage == 0 ? 1 : TotalPage) + "&" + "start=" + start.ToShortDateString() + "&end=" + end.ToShortDateString();

        Rpt_PageVisit.DataSource = list;
        Rpt_PageVisit.DataBind();
        TB_Start.Text = start.ToString("yyyy-MM-dd");
        TB_End.Text   = end.ToString("yyyy-MM-dd");
    }
示例#5
0
    private void Bind(string nick, string session, DateTime start, DateTime end)
    {
        int    TotalCount = 0; //总记录数
        int    TotalPage  = 1; //总页数
        string ip         = Request.QueryString["visitip"];
        int    page       = 1;

        try
        {
            page = int.Parse(Request.QueryString["Page"]);
            if (ViewState["page"] != null)
            {
                page = int.Parse(ViewState["page"].ToString());
                ViewState["page"] = null;
            }
        }
        catch { }

        IList <TopVisitInfo> list = visitDal.GetVisitInfoByIp(Encrypt(HttpUtility.UrlDecode(Request.Cookies["nick"].Value)), ip, start, end);


        TotalCount      = list.Count;
        pds.DataSource  = list;
        pds.AllowPaging = true;
        pds.PageSize    = 20;

        if (TotalCount == 0)
        {
            TotalPage = 1;
        }
        else
        {
            if (TotalCount % pds.PageSize == 0)
            {
                TotalPage = TotalCount / pds.PageSize;
            }
            else
            {
                TotalPage = TotalCount / pds.PageSize + 1;
            }
        }

        string startstr = HttpUtility.UrlEncode(start.ToString("yyyy-MM-dd-HH"));
        string endstr   = HttpUtility.UrlEncode(end.ToString("yyyy-MM-dd-HH"));

        pds.CurrentPageIndex = page - 1;
        lblCurrentPage.Text  = "共" + TotalCount.ToString() + "条记录 当前页:" + page + "/" + TotalPage;

        lnkFrist.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=1&visitip=" + ip + "&start=" + startstr + "&end=" + endstr;
        if (!pds.IsFirstPage)
        {
            lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + (page - 1) + "&visitip=" + ip + "&start=" + startstr + "&end=" + endstr;
        }

        if (!pds.IsLastPage)
        {
            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + (page + 1) + "&visitip=" + ip + "&start=" + startstr + "&end=" + endstr;
        }
        lnkEnd.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + TotalPage + "&visitip=" + ip + "&start=" + startstr + "&end=" + endstr;

        Rpt_PageVisit.DataSource = pds;
        Rpt_PageVisit.DataBind();
        TB_Start.Text = start.ToString("yyyy-MM-dd HH");
        TB_End.Text   = end.ToString("yyyy-MM-dd HH");
    }
示例#6
0
    private void Bind(string nick, string session, DateTime start, DateTime end)
    {
        int    TotalCount = 0; //总记录数
        int    TotalPage  = 1; //总页数
        string ip         = Request.QueryString["visitip"];
        int    page       = 1;

        try
        {
            page = int.Parse(Request.QueryString["Page"]);
            if (ViewState["page"] != null)
            {
                page = int.Parse(ViewState["page"].ToString());
                ViewState["page"] = null;
            }
        }
        catch { }

        IList <TopVisitInfo> list       = visitDal.GetVisitInfoByIp(DataHelper.Encrypt(HttpUtility.UrlDecode(Request.Cookies["nick"].Value)), ip, start, end);
        List <GoodsInfo>     cachegoods = new List <GoodsInfo>();

        if (Cache["taobaogoodslist"] != null)
        {
            cachegoods = (List <GoodsInfo>)Cache["taobaogoodslist"];
        }
        for (int i = 0; i < list.Count; i++)
        {
            if (!string.IsNullOrEmpty(list[i].GoodsId))
            {
                List <GoodsInfo> mylist = cachegoods.Where(o => o.num_iid == list[i].GoodsId).ToList();
                if (mylist.Count == 0)
                {
                    GoodsInfo rinfo = TaoBaoAPI.GetGoodsInfo(nick, session, list[i].GoodsId);
                    list[i].GoodsName = rinfo.title;
                    cachegoods.Add(rinfo);
                    if (Cache["taobaogoodslist"] == null)
                    {
                        Cache.Insert("taobaogoodslist", cachegoods, null, DateTime.Now.AddHours(12), System.Web.Caching.Cache.NoSlidingExpiration);
                    }
                }
                else
                {
                    list[i].GoodsName = mylist[0].title;
                }
            }

            if (!string.IsNullOrEmpty(list[i].GoodsClassId))
            {
                IList <GoodsClassInfo> cList = GoodsClassList.Where(o => o.cid == list[i].GoodsClassId).ToList();
                if (cList.Count > 0)
                {
                    list[i].GoodsClassName = cList[0].name;
                }
            }
        }

        TotalCount      = list.Count;
        pds.DataSource  = list;
        pds.AllowPaging = true;
        pds.PageSize    = 20;

        if (TotalCount == 0)
        {
            TotalPage = 1;
        }
        else
        {
            if (TotalCount % pds.PageSize == 0)
            {
                TotalPage = TotalCount / pds.PageSize;
            }
            else
            {
                TotalPage = TotalCount / pds.PageSize + 1;
            }
        }

        string startstr = HttpUtility.UrlEncode(start.ToString("yyyy-MM-dd-HH"));
        string endstr   = HttpUtility.UrlEncode(end.ToString("yyyy-MM-dd-HH"));

        pds.CurrentPageIndex = page - 1;
        lblCurrentPage.Text  = "共" + TotalCount.ToString() + "条记录 当前页:" + page + "/" + TotalPage;

        lnkFrist.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=1&visitip=" + ip + "&start=" + startstr + "&end=" + endstr;
        if (!pds.IsFirstPage)
        {
            lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + (page - 1) + "&visitip=" + ip + "&start=" + startstr + "&end=" + endstr;
        }

        if (!pds.IsLastPage)
        {
            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + (page + 1) + "&visitip=" + ip + "&start=" + startstr + "&end=" + endstr;
        }
        lnkEnd.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + TotalPage + "&visitip=" + ip + "&start=" + startstr + "&end=" + endstr;

        Rpt_PageVisit.DataSource = pds;
        Rpt_PageVisit.DataBind();
        TB_Start.Text = start.ToString("yyyy-MM-dd HH");
        TB_End.Text   = end.ToString("yyyy-MM-dd HH");
    }