Ejemplo n.º 1
0
    private void ShowChart(DateTime start, DateTime end)
    {
        //两个时间差
        if (start > end)
        {
            Page.RegisterStartupScript("error", "<script>alert('时间选择有误!');</script>");
            return;
        }
        TaoBaoGoodsOrderService orderDal = new TaoBaoGoodsOrderService();
        IList <BackTotalInfo>   list     = orderDal.GetAllBackTotalList(start, end, HttpUtility.UrlDecode(Request.Cookies["nick"].Value));

        SeriseText = "[{name:'完成订单量', data:[";
        string iptotal = ",{name:'回头客数量',data:[";
        string avg     = ",{name:'回头客占比',data:[";

        DateText = "[";
        for (DateTime i = start; i <= end; i = i.AddDays(1))
        {
            DateText += "'" + i.ToString("yyyyMMdd").Substring(6, 2) + "',";
            IList <BackTotalInfo> mylist = list.Where(o => o.PDate == i.ToString("yyyyMMdd")).ToList();
            if (mylist.Count > 0)
            {
                BackTotalInfo info = mylist[0];
                iptotal    += info.PCount + ",";
                SeriseText += info.AllCount + ",";
                if (info.AllCount == 0)
                {
                    avg += "0,";
                }
                else
                {
                    avg += ((double)info.PCount / info.AllCount).ToString(".00") + ",";
                }
            }
            else
            {
                iptotal    += "0,";
                SeriseText += "0,";
                avg        += "0,";
            }
        }
        SeriseText  = SeriseText.Substring(0, SeriseText.Length - 1);
        SeriseText += "]}";
        iptotal     = iptotal.Substring(0, iptotal.Length - 1);
        iptotal    += "]}";
        avg         = iptotal + avg.Substring(0, avg.Length - 1);
        SeriseText += avg + "]}]";

        DateText      = DateText.Substring(0, DateText.Length - 1);
        DateText     += "]";
        TB_Start.Text = start.ToShortDateString();
        TB_End.Text   = end.ToShortDateString();
    }
Ejemplo n.º 2
0
    public static void InsertGoodsOrder(DateTime start, DateTime end, string session, string nick)
    {
        TaoBaoGoodsOrderService tbgo = new TaoBaoGoodsOrderService();

        List <string> allOrderTid = tbgo.GetAllOrderId(start, end, nick);

        //等待卖家发货,即:买家已付款
        InsertGoodsOrderByState(start, end, "WAIT_SELLER_SEND_GOODS", session, nick, tbgo, allOrderTid);
        //等待买家确认收货,即:卖家已发货
        InsertGoodsOrderByState(start, end, "WAIT_BUYER_CONFIRM_GOODS", session, nick, tbgo, allOrderTid);
        //买家已签收,货到付款专用
        InsertGoodsOrderByState(start, end, "TRADE_BUYER_SIGNED", session, nick, tbgo, allOrderTid);
        //交易成功
        InsertGoodsOrderByState(start, end, "TRADE_FINISHED", session, nick, tbgo, allOrderTid);
    }
    private void ShowChart(DateTime date)
    {
        if (date.ToShortDateString() != DateTime.Now.ToShortDateString())
        {
            Btn_Totay.Visible = true;
        }
        //大于今天
        if (DateTime.Parse(date.ToShortDateString()) > DateTime.Parse(DateTime.Now.ToShortDateString()))
        {
            TB_Start.Text = HF_Date.Value;
            return;
        }
        TaoBaoGoodsOrderService orderDal = new TaoBaoGoodsOrderService();
        IList <GoodsOrderInfo>  list     = orderDal.GetHourOrderTotal(DateTime.Parse(date.ToShortDateString()), DateTime.Parse(date.AddDays(1).ToShortDateString()), HttpUtility.UrlDecode(Request.Cookies["nick"].Value));

        SeriseText = "[{name:'订单量', data:[";
        DateText   = "[";
        int nowhour = 23;

        if (date.ToShortDateString() == DateTime.Now.ToShortDateString())
        {
            nowhour = date.Hour;
        }
        for (int h = 0; h <= nowhour; h++)
        {
            DateText += "'" + h + "',";
            IList <GoodsOrderInfo> thisInfo = list.Where(o => o.OrderTotal == h).ToList();

            if (thisInfo.Count == 0)
            {
                SeriseText += "0,";
            }
            else
            {
                SeriseText += (int)thisInfo[0].payment + ",";
            }
        }
        SeriseText  = SeriseText.Substring(0, SeriseText.Length - 1);
        SeriseText += "]}]";

        DateText      = DateText.Substring(0, DateText.Length - 1);
        DateText     += "]";
        TB_Start.Text = date.ToShortDateString();
        HF_Date.Value = date.ToShortDateString();
    }
Ejemplo n.º 4
0
    public static void UpdateSiteTotal(string nick, string session, DateTime now, SiteTotalService taoDal)
    {
        RefundService           refDal  = new RefundService();
        TaoBaoGoodsOrderService tbgoDal = new TaoBaoGoodsOrderService();

        List <RefundInfo> refundList = (List <RefundInfo>)TaoBaoAPI.GetRefundInfoList(now.AddDays(-2), now, nick, session, "SUCCESS");
        //所有有订单的用户
        TopSiteTotalInfo stinfo = taoDal.GetOrderTotalPay(DateTime.Parse(now.ToShortDateString()), DateTime.Parse(now.AddDays(1).ToShortDateString()), nick);
        //所有表名(添加过统计代码到网页的)
        List <string> tableList   = taoDal.GetTableName();
        string        tablename   = GetTableName(nick);
        List <string> mytablelist = tableList.Where(o => o == tablename).ToList();

        TopSiteTotalInfo addup = new TopSiteTotalInfo();

        addup.SiteNick      = nick;
        addup.SiteTotalDate = now.ToString("yyyyMMdd");
        //给询单数赋值
        addup.AskOrder = new TalkRecodService().GetCustomerList(DateTime.Parse(now.ToShortDateString()), DateTime.Parse(now.AddDays(1).ToShortDateString()), nick).Count;

        //有添加统计代码
        if (mytablelist.Count > 0)
        {
            //有订单
            if (stinfo != null)
            {
                addup.SiteOrderCount     = stinfo.SiteOrderCount;
                addup.SiteOrderPay       = stinfo.SiteOrderPay;
                addup.PostFee            = stinfo.PostFee;
                addup.SiteBuyCustomTotal = stinfo.SiteBuyCustomTotal;
                addup.SiteSecondBuy      = taoDal.GetSecondBuyTotal(DateTime.Parse(now.ToShortDateString()), DateTime.Parse(now.AddDays(1).ToShortDateString()), nick);
            }
            TopSiteTotalInfo puvinfo = taoDal.GetPvUvTotal(DateTime.Parse(now.ToShortDateString()), DateTime.Parse(now.AddDays(1).ToShortDateString()), tablename);
            addup.SiteUVCount  = puvinfo.SiteUVCount;
            addup.SitePVCount  = puvinfo.SitePVCount;
            addup.ZhiTongFlow  = taoDal.GetZhiTongTotal(now, now.AddDays(1), tablename);
            addup.SiteZuanZhan = taoDal.GetZuanZhanTotal(now, now.AddDays(1), tablename);

            addup.SiteUVBack = taoDal.GetBackTotal(DateTime.Parse(now.ToShortDateString()), DateTime.Parse(now.AddDays(1).ToShortDateString()), tablename);
        }
        else
        {
            //有订单
            if (stinfo != null)
            {
                addup.SiteOrderCount     = stinfo.SiteOrderCount;
                addup.SiteOrderPay       = stinfo.SiteOrderPay;
                addup.PostFee            = stinfo.PostFee;
                addup.SiteBuyCustomTotal = stinfo.SiteBuyCustomTotal;
                addup.SiteSecondBuy      = taoDal.GetSecondBuyTotal(DateTime.Parse(now.ToShortDateString()), DateTime.Parse(now.AddDays(1).ToShortDateString()), nick);
            }
        }

        IList <string> tidList = taoDal.GetOrderIds(DateTime.Parse(now.ToShortDateString()), DateTime.Parse(now.AddDays(1).ToShortDateString()), nick);

        if (tidList.Count > 0)
        {
            addup.GoodsCount = taoDal.GetGoodsCount(tidList);
        }
        List <RefundInfo> hadReList = refDal.GetAllRefund(nick, now.AddDays(-2), now);

        //退款情况
        List <RefundInfo> trefundList = refundList.Where(o => o.modified.ToShortDateString() == now.ToShortDateString()).ToList();

        if (trefundList.Count > 0)
        {
            int     rorderCount = 0;
            decimal rpay        = 0;
            foreach (RefundInfo refund in new List <RefundInfo>(trefundList))
            {
                if (!tidList.Contains(refund.tid))
                {
                    GoodsOrderInfo roinfo = tbgoDal.GetGoodsOrderInfo(refund.tid);
                    if (roinfo == null)
                    {
                        continue;
                    }
                    else
                    {
                        if (hadReList.Where(o => o.tid == refund.tid).ToList().Count > 0)
                        {
                            continue;
                        }
                        if (roinfo.pay_time != DateTime.Parse("1990-1-1"))
                        {
                            refund.OrderTime = roinfo.pay_time;
                        }
                        else
                        {
                            refund.OrderTime = roinfo.created;
                        }
                        refund.seller_nick = nick;
                        refDal.AddRefund(refund);
                        //需要查询这一天有多少订单
                        RefundInfo newrefund = refDal.GetRefundTotal(nick, DateTime.Parse(refund.OrderTime.ToShortDateString()), DateTime.Parse(refund.OrderTime.ToShortDateString()).AddDays(1));

                        taoDal.UpdateGoodsOrderInfo(nick, refund.OrderTime.ToString("yyyyMMdd"), newrefund.total_fee, newrefund.num);
                    }
                    continue;
                }
                rorderCount++;
                rpay += (refund.total_fee - refund.payment);
            }
            addup.RefundOrderCount = rorderCount;
            addup.RefundMoney      = rpay;
        }

        taoDal.AddOrUp(addup);
    }
Ejemplo n.º 5
0
    private static void InsertGoodsOrderByState(DateTime start, DateTime end, string orderState, string session, string nick, TaoBaoGoodsOrderService tbgoDal, List <string> tids)
    {
        IList <GoodsOrderInfo> goodsOrderList = TaoBaoAPI.GetGoodsOrderInfoList(nick, start, end, session, orderState);

        if (goodsOrderList == null)
        {
            LogInfo.WriteLog("订购时获取订单错误", "参数错误");
        }
        else
        {
            for (int i = 0; i < goodsOrderList.Count; i++)
            {
                //判断是否已经添加
                if (tids.Contains(goodsOrderList[i].tid))
                {
                    continue;
                }

                goodsOrderList[i].UsePromotion = TaoBaoAPI.GetPromotion(nick, session, goodsOrderList[i].tid, "店铺优惠券");
                goodsOrderList[i].PingInfo     = TaoBaoAPI.GetPingjia(nick, session, goodsOrderList[i].tid);
                if (goodsOrderList[i].PingInfo == null)
                {
                    goodsOrderList[i].PingInfo = new PingJiaInfo
                    {
                        content = "",
                        created = DateTime.Parse("1990-1-1"),
                        result  = ""
                    };
                }
                tbgoDal.InsertTaoBaoGoodsOrder(goodsOrderList[i]);
                tbgoDal.InsertChildOrderInfo(goodsOrderList[i].orders, goodsOrderList[i].tid);
                //添加进集合
                tids.Add(goodsOrderList[i].tid);
            }
        }
    }
Ejemplo n.º 6
0
    private void ShowChart(DateTime start, DateTime end)
    {
        //两个时间差
        if (start > end)
        {
            Page.RegisterStartupScript("error", "<script>alert('时间选择有误!');</script>");
            return;
        }
        TaoBaoGoodsOrderService tboDal = new TaoBaoGoodsOrderService();
        IList <PingJiaInfo>     list   = tboDal.GetPingjiaTotal(start, end, HttpUtility.UrlDecode(Request.Cookies["nick"].Value));

        SeriseText = "[{name:'好评', data:[";
        string zhong = ",{name:'中评',data:[";
        string cha   = ",{name:'差评',data:[";
        string nop   = ",{name:'尚未评价',data:[";

        DateText = "[";
        for (DateTime i = start; i <= end; i = i.AddDays(1))
        {
            DateText += "'" + i.ToString("yyyyMMdd").Substring(6, 2) + "',";
            IList <PingJiaInfo> mylist = list.Where(o => o.pdate == i.ToString("yyyyMMdd")).ToList();

            if (mylist.Count > 0)
            {
                if (mylist.Where(o => o.result == "good").ToList().Count > 0)
                {
                    SeriseText += mylist.Where(o => o.result == "good").ToList()[0].pcount + ",";
                }
                else
                {
                    SeriseText += "0,";
                }
                if (mylist.Where(o => o.result == "neutral").ToList().Count > 0)
                {
                    zhong += mylist.Where(o => o.result == "neutral").ToList()[0].pcount + ",";
                }
                else
                {
                    zhong += "0,";
                }
                if (mylist.Where(o => o.result == "bad").ToList().Count > 0)
                {
                    cha += mylist.Where(o => o.result == "bad").ToList()[0].pcount + ",";
                }
                else
                {
                    cha += "0,";
                }
                if (mylist.Where(o => o.result == "").ToList().Count > 0)
                {
                    nop += mylist.Where(o => o.result == "").ToList()[0].pcount + ",";
                }
                else
                {
                    nop += "0,";
                }
            }
            else
            {
                zhong      += "0,";
                SeriseText += "0,";
                cha        += "0,";
                nop        += "0,";
            }
        }
        SeriseText  = SeriseText.Substring(0, SeriseText.Length - 1);
        SeriseText += "]}";
        zhong       = zhong.Substring(0, zhong.Length - 1);
        zhong      += "]}";
        cha         = zhong + cha.Substring(0, cha.Length - 1);
        cha        += "]}";
        nop         = cha + nop.Substring(0, nop.Length - 1);
        SeriseText += nop + "]}]";

        DateText      = DateText.Substring(0, DateText.Length - 1);
        DateText     += "]";
        TB_Start.Text = start.ToString("yyyy-MM-dd");
        TB_End.Text   = end.ToString("yyyy-MM-dd");
    }