private void Bind(DateTime start, DateTime end, string nick,params int[] tid)
    {
        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 { }

        List<GoodsOrderInfo>  goodsOrderList = goDal.GetCustomerList(nick, start, end);

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

        if (list.Count > 0)
        {
            for (int i = 0; i < list.Count; i++)
            {
                IList<GoodsOrderInfo> thislist = goodsOrderList.Where(o => o.buyer_nick == list[i].CustomerNick).ToList();
                if (thislist.Count > 0)
                {
                    list[i].tid = thislist[0].tid;
                }
            }
        }

        int suc = 0;
        if (tid != null && tid.Length > 0)
        {
            list = list.Where(o => !string.IsNullOrEmpty(o.tid)).ToList();
            suc = 1;
        }

        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() + "&suc=" + suc;
        if (!pds.IsFirstPage)
            lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + (page - 1) + "&start=" + start.ToShortDateString() + "&suc=" + suc;

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

        Rpt_CustomerList.DataSource = pds;
        Rpt_CustomerList.DataBind();
        TB_Start.Text = start.ToString("yyyy-MM-dd");

    }
    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);
            }
        }
    }
    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");
    }
Exemple #4
0
    private void Bind(DateTime start, DateTime end, string nick, params int[] tid)
    {
        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 { }

        List <GoodsOrderInfo> goodsOrderList = goDal.GetCustomerList(nick, start, end);

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

        if (list.Count > 0)
        {
            for (int i = 0; i < list.Count; i++)
            {
                IList <GoodsOrderInfo> thislist = goodsOrderList.Where(o => o.buyer_nick == list[i].CustomerNick).ToList();
                if (thislist.Count > 0)
                {
                    list[i].tid = thislist[0].tid;
                }
            }
        }

        if (tid != null && tid.Length > 0)
        {
            list = list.Where(o => !string.IsNullOrEmpty(o.tid)).ToList();
        }

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

        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;

        Rpt_Jie.DataSource = pds;
        Rpt_Jie.DataBind();
    }