protected void BindData()
        {
            DataTable  dt   = new DataTable();
            DataColumn dc   = null;
            string     nick = Users.Nick;

            dc = dt.Columns.Add("reciverName", Type.GetType("System.String"));
            dc = dt.Columns.Add("cellPhone", Type.GetType("System.String"));
            if (string.IsNullOrEmpty(nick) == true)
            {
                return;
            }
            DataTable trade  = null;
            string    select = drpSType.SelectedValue.ToString();

            switch (select)
            {
            case "sign_notSure":
                trade = TradeBLL.GetTradeData(nick, "taobao_trade_TradeSellerShip");
                break;

            case "sure_notSign":
                trade = TradeBLL.GetTradeDataNosign(nick, "taobao_trade_TradeSellerShip");
                break;

            case "sure_notSucce":
                trade = TradeBLL.GetTradeDataNoSuccess(nick, "taobao_trade_TradeSellerShip");
                break;
            }
            Trade tradeInfo = null;

            if (trade != null && trade.Rows.Count > 0)
            {
                string key = SellersBLL.GetSellerSessionKey(nick);
                foreach (DataRow row in trade.Rows)//轮训订单
                {
                    //获取订单id
                    string tid = row["tid"].ToString();
                    //调用淘宝接口获取订单详细交易信息
                    tradeInfo = TBTrade.GetTradeContact(Convert.ToInt64(tid), key);
                    string  cellPhone   = tradeInfo == null ? "" : tradeInfo.ReceiverMobile;
                    string  reciverName = tradeInfo == null ? "" : tradeInfo.ReceiverName;
                    DataRow drow        = dt.NewRow();
                    drow["reciverName"] = reciverName;
                    drow["cellPhone"]   = cellPhone;
                    dt.Rows.Add(drow);
                }
            }
            tb_member           = dt;
            grdBuyer.DataSource = trade;
            grdBuyer.DataBind();
        }
示例#2
0
        public static Boolean SynicOldTrade(string strSessionKey, DateTime startDate, DateTime endDate, string strNick)
        {
            List <Trade> listTrade = null;
            TBTrade      tbTrade   = new TBTrade();
            Buyers       objBuyer  = null;
            //一次性获取卖家手机号码为空的数据
            DataTable tb = BuyerOldDAL.GetBuyerNoPhone(strNick);

            if (tb != null && tb.Rows.Count > 0)
            {
                for (int i = 0; i < tb.Rows.Count; i++)
                {
                    try
                    {
                        string buyerNick = tb.Rows[i]["buyer_nick"].ToString();
                        listTrade = tbTrade.GetBuyerTrade(strSessionKey, buyerNick);
                        if (listTrade != null && listTrade.Count > 0)
                        {
                            foreach (Trade obj2 in listTrade)
                            {
                                string buyerId = tb.Rows[i]["buyer_id"].ToString();
                                objBuyer                 = new Buyers();
                                objBuyer.SELLER_ID       = strNick;
                                objBuyer.BuyerNick       = buyerNick;
                                objBuyer.Buyer_credit    = "1";
                                objBuyer.BuyerId         = Convert.ToInt64(buyerId);
                                objBuyer.Address         = obj2.ReceiverState + obj2.ReceiverCity + obj2.ReceiverDistrict + obj2.ReceiverAddress;
                                objBuyer.BuyerProvince   = obj2.ReceiverState.Equals("0") ? "其它" : obj2.ReceiverState;
                                objBuyer.CellPhone       = obj2.ReceiverMobile;
                                objBuyer.Buyer_reallName = String.IsNullOrEmpty(obj2.ReceiverName) ? "unknown!" : obj2.ReceiverName;
                                BuyerOldDAL.Update(objBuyer);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        continue;
                    }
                }
            }
            return(true);
        }
示例#3
0
        /// <summary>
        /// 差评拦截黑名单
        /// </summary>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <param name="sellerNick"></param>
        /// <returns></returns>
        public Boolean GetSellerRateCloseOrder(String startDate, String endDate, string sellerNick)
        {
            RatingTop        rateObj      = new RatingTop();
            TBTrade          objTrade     = new TBTrade();
            List <TradeRate> lstTradeRate = rateObj.GetTradeRate(CurrentPage, PageSize, startDate, endDate, ref total);

            if (lstTradeRate != null && lstTradeRate.Count > 0)
            {
                foreach (TradeRate rate in lstTradeRate)
                {
                    if (!rate.Result.Equals("good"))//将好评过滤掉
                    {
                        if (rate.Result.Equals("neutral") || rate.Result.Equals("bad"))
                        {
                            //中差评 加入黑名单
                            BlakList objList = new BlakList();
                            objList.SellerNick = sellerNick;
                            objList.BlakName   = rate.Nick;
                            RatingDAL objDal = new RatingDAL();
                            if (!ChekBlaklistCloseOrder(objList))
                            {
                                AddBlaklistCloseOrder(objList);
                            }
                        }
                    }
                }
            }
            PageNo = PageNo + PageSize;
            if (PageNo < total)
            {
                CurrentPage = CurrentPage + 1;
                GetSellerRateCloseOrder(startDate, endDate, sellerNick);
            }
            PageNo      = 0;
            CurrentPage = 1;
            PageSize    = 100;
            return(true);
        }
示例#4
0
 public static void CheckOrder(DataTable tbSource, string sellerNick)
 {
     if (tbSource != null && tbSource.Rows.Count > 0)
     {
         TBTrade objTrade = new TBTrade();
         for (int i = 0; i < tbSource.Rows.Count; i++)
         {
             string orderNo = tbSource.Rows[i]["OrderNo"].ToString();
             string id      = tbSource.Rows[i]["id"].ToString();
             string company = tbSource.Rows[i]["commpany"].ToString();
             string code    = BatchShippingDAL.GetLogistCodeByName(company);
             if (!string.IsNullOrEmpty(code))
             {
                 Trade trade = objTrade.GetBuyerInfoByTid(Convert.ToInt64(orderNo));
                 if (trade != null)
                 {
                     if (trade.Status.Equals("WAIT_SELLER_SEND_GOODS"))//等待卖家发货,即:买家已付款
                     {
                         BatchShippingDAL.UpdateOrderStatus(orderNo, sellerNick, id, "可发货", "");
                     }
                     else
                     {
                         BatchShippingDAL.UpdateOrderStatus(orderNo, sellerNick, id, "无效", "该订单号无效");
                     }
                 }
                 else
                 {
                     BatchShippingDAL.UpdateOrderStatus(orderNo, sellerNick, id, "无效", "该订单号无效");
                 }
             }
             else
             {
                 BatchShippingDAL.UpdateOrderStatus(orderNo, sellerNick, id, "无效", "物流公司名称不正确");
             }
         }
     }
 }
示例#5
0
        /// <summary>
        /// 同步近3个月会员信息
        /// </summary>
        /// <param name="strNick"></param>
        /// <param name="strSessionKey"></param>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        public Boolean SynBuyersInfo3Months(string strNick, string strSessionKey, DateTime startDate, DateTime endDate)
        {
            //会员同步
            List <CrmMember> buyers = null;
            int  PageNo = 1, PageSize = 100;
            long total = 0;
            //交易同步
            List <Trade> allTrades   = new List <Trade>();
            Int64        tradePageNo = 1;
            Boolean      hasNext     = false;
            TBTrade      tbTrade     = new TBTrade();

            do
            {
                //读取卖家最近3个月的交易数据
                List <Trade> partTrades = tbTrade.GetBuyerTrades(strSessionKey, tradePageNo, ref hasNext);
                if (partTrades != null && partTrades.Count > 0)
                {
                    allTrades.AddRange(partTrades);
                }
                PageNo++;
            } while (hasNext);
            do
            {
                try
                {
                    //获取卖家会员
                    buyers = GetTBBuyerList(strSessionKey, PageNo, PageSize, ref total);
                    SynchronizeBuyerInfoWithSeller(strNick, strSessionKey, buyers, allTrades);
                }
                catch (Exception ex)
                {
                    ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Data);
                }
            } while (buyers.Count == 100);
            return(true);
        }
示例#6
0
        /// <summary>
        /// 查询卖家最近半年获得的中差评
        /// 修改人:LU
        /// 日期:20160909
        /// </summary>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        public List <TradeRateChild> GetSellerRate(String startDate, String endDate, string sellerNick)
        {
            RatingTop rateObj  = new RatingTop();
            TBTrade   objTrade = new TBTrade();
            RatingDAL objDal   = new RatingDAL();

            List <TradeRate> lstTradeRate = new List <TradeRate>();
            //检查商家设置:是否开通半年内差评和退款的买家加入黑名单
            DataRow drCfg = objDal.CheckIsOpenAddBlakList(sellerNick);

            if (drCfg != null)
            {
                //调用接口搜索评价信息:只能获取距今180天内的评价记录(只支持查询卖家给出或得到的评价)
                lstTradeRate = rateObj.GetTradeRate(CurrentPage, PageSize, startDate, endDate, ref total);
            }

            if (lstTradeRate != null && lstTradeRate.Count > 0)
            {
                TradeRateChild objRate = null;
                foreach (TradeRate rate in lstTradeRate)
                {
                    if (TotalPoolRates == null)
                    {
                        TotalPoolRates = new List <TradeRateChild>();
                    }
                    if (!rate.Result.Equals("good"))//将好评过滤掉
                    {
                        if (rate.Result.Equals("neutral"))
                        {
                            rate.Result = "中评";
                        }
                        if (rate.Result.Equals("bad"))
                        {
                            rate.Result = "差评";
                        }
                        objRate           = new TradeRateChild();
                        objRate.Nick      = rate.Nick;
                        objRate.Content   = rate.Content;
                        objRate.ItemTitle = rate.ItemTitle;
                        objRate.Result    = rate.Result;
                        Trade objContact = objTrade.GetBuyerInfoByTid(rate.Tid);
                        objRate.Cellphone = objContact == null ? "" : objContact.ReceiverMobile;
                        objRate.RealName  = objContact == null ? "" : objContact.ReceiverName;
                        objRate.Created   = rate.Created;
                        TotalPoolRates.Add(objRate);
                    }

                    #region 判断黑名单加入条件

                    if (drCfg != null)
                    {
                        if (Convert.ToInt32(drCfg["atuoAddBlackListBadRate"]) > 0)
                        { //开通将半年内差评用户加入黑名单
                            if (!rate.Result.Equals("good"))
                            {
                                //中差评 加入黑名单
                                BlakList objList = new BlakList();
                                objList.SellerNick = sellerNick;
                                objList.BlakName   = rate.Nick;
                                if (!objDal.ChekBlaklist(objList))
                                {
                                    objDal.AddBlaklist(objList);
                                }
                            }
                        }
                        if (Convert.ToInt32(drCfg["atuoAddBlackListTuiKuan"]) > 0)
                        {  //开通将半年内退款用户加入黑名单
                           // 获取单笔交易的部分信息:查询该笔订单是否有退货
                            string buyerNick = objTrade.GetBuyerTradeByTid(rate.Tid);
                            if (!string.IsNullOrEmpty(buyerNick))
                            {
                                //中差评 加入黑名单
                                BlakList objList = new BlakList();
                                objList.SellerNick = sellerNick;
                                objList.BlakName   = buyerNick;
                                if (!objDal.ChekBlaklist(objList))
                                {
                                    objDal.AddBlaklist(objList);
                                }
                            }
                        }
                    }

                    #endregion
                }
            }
            PageNo = PageNo + PageSize;
            if (PageNo < total)
            {
                CurrentPage = CurrentPage + 1;
                GetSellerRate(startDate, endDate, sellerNick);
            }
            PageNo      = 0;
            CurrentPage = 1;
            PageSize    = 100;
            return(TotalPoolRates);
        }
示例#7
0
        private void SendMessageDoTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            try
            {
                sendMessageDoTimer.Enabled = true;
                //查询同步过来的消息MESSAGE
                //查询主动通知信息从DB开始用于发送短信:只取交易完成的数据用于秒评
                DataTable tbTrade = DBUtil.GetTradeData("");
                //如果该卖家有消息推送
                if (!busySend && tbTrade != null && tbTrade.Rows.Count > 0)
                {
                    busySend = true;
                    foreach (DataRow row in tbTrade.Rows)//轮训通知消息
                    {
                        string   sellerNick = row["seller_nick"].ToString();
                        string   buyerNick  = row["buyer_nick"].ToString();
                        string   tid        = row["tid"].ToString();
                        DateTime createDate = Convert.ToDateTime(row["createDate"]);

                        // 获取卖家保存的自动评价策略
                        DataTable dtAutoConfig    = DBUtil.GetSellerAutoRateConfig(sellerNick);
                        int       isMiaoRate      = 0;
                        int       isWaitBuyerRate = 0;
                        int       isQiangRate     = 0;
                        if (dtAutoConfig == null || dtAutoConfig.Rows.Count == 0)
                        {
                            continue;
                        }

                        isMiaoRate      = Convert.ToInt32(dtAutoConfig.Rows[0]["isMiaoRate"]);
                        isWaitBuyerRate = Convert.ToInt32(dtAutoConfig.Rows[0]["isWaitBuyerRate"]);
                        isQiangRate     = Convert.ToInt32(dtAutoConfig.Rows[0]["isQiangRate"]);
                        //判断卖家是否开通秒评
                        if (isMiaoRate == 1)
                        {
                            #region 秒评

                            //评价开始
                            string sessionKey = DBUtil.GetSellerSessionKey(sellerNick);
                            if (!string.IsNullOrEmpty(sessionKey))
                            {
                                // 获取卖家保存的评价策略
                                DataTable tbSellerRateConfig = DBUtil.GetSellerRateConfig(sellerNick);
                                //检查商家设置:秒评:只检查该用户是否在黑名单
                                if (!DBUtil.CheckIsBlacklst(sellerNick, buyerNick))
                                {
                                    Trade objTrade = TBTrade.GetBuyerTrade(tid, sessionKey);
                                    if (objTrade != null && objTrade.Orders.Count > 0)
                                    {
                                        foreach (Order o in objTrade.Orders)
                                        {
                                            if (!o.SellerRate)
                                            {
                                                RateConfig objRate = new RateConfig();
                                                objRate.Tid        = Convert.ToInt64(tid);
                                                objRate.Oid        = o.Oid;
                                                objRate.Content1   = tbSellerRateConfig.Rows[0]["content1"].ToString();
                                                objRate.Content2   = tbSellerRateConfig.Rows[0]["content2"].ToString();
                                                objRate.Content3   = tbSellerRateConfig.Rows[0]["content3"].ToString();
                                                objRate.Result     = tbSellerRateConfig.Rows[0]["result"].ToString();
                                                objRate.SellerNick = sellerNick;
                                                string    strContent = "";
                                                TBRating  objRateDal = new TBRating();
                                                TradeRate obj        = null;
                                                //调用接口 新增单个评价
                                                obj = objRateDal.BuyerTradeRateOneByOne(objRate, ref strContent, sessionKey);
                                                if (obj == null)
                                                {
                                                    // 调用API进行批量评价
                                                    obj = objRateDal.BuyerTradeRate(objRate, ref strContent, sessionKey);
                                                }
                                                if (obj != null)
                                                {       //rating sucessfull
                                                    obj.Content = strContent;
                                                    obj.Nick    = objRate.SellerNick;
                                                    obj.Tid     = Convert.ToInt64(tid);
                                                    obj.Created = obj.Created;

                                                    // 添加卖家评价:秒评
                                                    //Console.WriteLine("评价卖家:" + obj.Nick + " 评价日期:" + obj.Created);
                                                    DBUtil.AddRateHisWithSeller(obj, "秒评");

                                                    Console.WriteLine("当前卖家:" + sellerNick + "评价时间:" + DateTime.Now.ToString());
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            #endregion
                        }

                        //判断卖家是否开通买家评价以后评价
                        if (isWaitBuyerRate == 1)
                        {
                            #region 方案二(买家评价以后评价)
                            string     sessionKey = DBUtil.GetSellerSessionKey(sellerNick);
                            RateConfig objRate    = new RateConfig();
                            TBRating   objRateDal = new TBRating();

                            objRate.Content1   = dtAutoConfig.Rows[0]["content1"].ToString();
                            objRate.Content2   = dtAutoConfig.Rows[0]["content2"].ToString();
                            objRate.Content3   = dtAutoConfig.Rows[0]["content3"].ToString();
                            objRate.SellerNick = sellerNick;
                            //默认好评
                            objRate.Result = dtAutoConfig.Rows[0]["result"].ToString();

                            //检查买家是否评论
                            List <TradeRate> sates   = objRateDal.GetTradeRate(sessionKey);
                            bool             isRated = false;
                            foreach (TradeRate trade in sates)
                            {
                                if (trade.Tid.ToString() == tid)
                                {
                                    isRated = true;
                                    break;
                                }
                            }
                            if (isRated) //买家已评价
                            {
                                //买家在黑名单
                                if (DBUtil.CheckIsBlacklst(sellerNick, buyerNick))
                                {
                                    int blackBuyerRatedIsRate = Convert.ToInt32(dtAutoConfig.Rows[0]["blackBuyerRatedIsRate"]);
                                    if (blackBuyerRatedIsRate == 1)
                                    {
                                        continue;
                                    }
                                    if (blackBuyerRatedIsRate == 3)
                                    {
                                        objRate.Result         = "neutral";
                                        objRate.BadRateContent = dtAutoConfig.Rows[0]["badRateContent"].ToString();
                                        objRate.Content1       = dtAutoConfig.Rows[0]["badRateContent"].ToString();
                                        objRate.Content2       = dtAutoConfig.Rows[0]["badRateContent"].ToString();
                                        objRate.Content3       = dtAutoConfig.Rows[0]["badRateContent"].ToString();
                                    }
                                    if (blackBuyerRatedIsRate == 4)
                                    {
                                        objRate.Result         = "bad";
                                        objRate.BadRateContent = dtAutoConfig.Rows[0]["badRateContent"].ToString();
                                        objRate.Content1       = dtAutoConfig.Rows[0]["badRateContent"].ToString();
                                        objRate.Content2       = dtAutoConfig.Rows[0]["badRateContent"].ToString();
                                        objRate.Content3       = dtAutoConfig.Rows[0]["badRateContent"].ToString();
                                    }
                                }
                            }
                            else //买家未评价
                            {
                                //买家在黑名单
                                if (DBUtil.CheckIsBlacklst(sellerNick, buyerNick))
                                {
                                    //检查是否到评论时间
                                    TimeSpan ts           = DateTime.Now - createDate;
                                    int      jiange       = (ts.Days * 24 * 60 * 60) + (ts.Hours * 60 * 60) + (ts.Minutes * 60) + (ts.Minutes);
                                    int      congigJiange = (Convert.ToInt32(dtAutoConfig.Rows[0]["blackBuyerNoRateQiangRateDay"]) * 24 * 60 * 60)
                                                            + (Convert.ToInt32(dtAutoConfig.Rows[0]["blackBuyerNoRateQiangRateHour"]) * 60 * 60) + (Convert.ToInt32(dtAutoConfig.Rows[0]["blackBuyerNoRateQiangRateFen"]) * 60);
                                    if (congigJiange < jiange)
                                    {
                                        continue;
                                    }
                                }
                                else //买家不在黑名单
                                {
                                    //检查是否到评论时间
                                    TimeSpan ts           = DateTime.Now - createDate;
                                    int      jiange       = (ts.Days * 24 * 60 * 60) + (ts.Hours * 60 * 60) + (ts.Minutes * 60) + (ts.Minutes);
                                    int      congigJiange = (Convert.ToInt32(dtAutoConfig.Rows[0]["waitBuyerTimeDay"]) * 24 * 60 * 60)
                                                            + (Convert.ToInt32(dtAutoConfig.Rows[0]["waitBuyerTimeHour"]) * 60 * 60) + (Convert.ToInt32(dtAutoConfig.Rows[0]["waitBuyerTimeFen"]) * 60);
                                    if (congigJiange < jiange)
                                    {
                                        continue;
                                    }
                                }
                            }

                            //评价开始
                            if (!string.IsNullOrEmpty(sessionKey))
                            {
                                // 获取卖家保存的评价策略
                                //DataTable tbSellerRateConfig = DBUtil.GetSellerRateConfig(sellerNick);

                                Trade objTrade = TBTrade.GetBuyerTrade(tid, sessionKey);
                                if (objTrade != null && objTrade.Orders.Count > 0)
                                {
                                    foreach (Order o in objTrade.Orders)
                                    {
                                        if (!o.SellerRate)
                                        {
                                            objRate.Tid = Convert.ToInt64(tid);
                                            objRate.Oid = o.Oid;
                                            string    strContent = "";
                                            TradeRate obj        = null;
                                            //调用接口 新增单个评价
                                            obj = objRateDal.BuyerTradeRateOneByOne(objRate, ref strContent, sessionKey);
                                            if (obj == null)
                                            {
                                                // 调用API进行批量评价
                                                obj = objRateDal.BuyerTradeRate(objRate, ref strContent, sessionKey);
                                            }
                                            if (obj != null)
                                            {       //rating sucessfull
                                                obj.Content = strContent;
                                                obj.Nick    = objRate.SellerNick;
                                                obj.Tid     = Convert.ToInt64(tid);
                                                obj.Created = obj.Created;

                                                // 添加卖家评价
                                                //Console.WriteLine("评价卖家:" + obj.Nick + " 评价日期:" + obj.Created);
                                                DBUtil.AddRateHisWithSeller(obj, "方案二");
                                                Console.WriteLine("当前卖家:" + sellerNick + "评价时间:" + DateTime.Now.ToString());
                                            }
                                        }
                                    }
                                }
                            }
                            #endregion
                        }

                        //判断卖家是否开通交易后多长时间评价
                        if (isQiangRate == 1)
                        {
                            #region 方案三(交易后多长时间评价)

                            //检查是否到评论时间
                            TimeSpan ts = DateTime.Now - createDate;
                            //当前时间到提单的时间间隔
                            int jiange = (ts.Days * 24 * 60 * 60) + (ts.Hours * 60 * 60) + (ts.Minutes * 60) + (ts.Minutes);
                            //评价配置的时间间隔
                            int congigJiange = (Convert.ToInt32(dtAutoConfig.Rows[0]["qiangRateTimeDay"]) * 24 * 60 * 60)
                                               + (Convert.ToInt32(dtAutoConfig.Rows[0]["qiangRateTimeHour"]) * 60 * 60) + (Convert.ToInt32(dtAutoConfig.Rows[0]["qiangRateTimeFen"]) * 60);
                            if (congigJiange < jiange)
                            {
                                continue;
                            }
                            //评价开始
                            string sessionKey = DBUtil.GetSellerSessionKey(sellerNick);
                            if (!string.IsNullOrEmpty(sessionKey))
                            {
                                //检查商家设置:秒评:只检查该用户是否在黑名单
                                if (!DBUtil.CheckIsBlacklst(sellerNick, buyerNick))
                                {
                                    Trade objTrade = TBTrade.GetBuyerTrade(tid, sessionKey);
                                    if (objTrade != null && objTrade.Orders.Count > 0)
                                    {
                                        foreach (Order o in objTrade.Orders)
                                        {
                                            if (!o.SellerRate)
                                            {
                                                RateConfig objRate = new RateConfig();
                                                objRate.Tid        = Convert.ToInt64(tid);
                                                objRate.Oid        = o.Oid;
                                                objRate.Content1   = dtAutoConfig.Rows[0]["content1"].ToString();
                                                objRate.Content2   = dtAutoConfig.Rows[0]["content2"].ToString();
                                                objRate.Content3   = dtAutoConfig.Rows[0]["content3"].ToString();
                                                objRate.Result     = dtAutoConfig.Rows[0]["result"].ToString();
                                                objRate.SellerNick = sellerNick;
                                                string    strContent = "";
                                                TBRating  objRateDal = new TBRating();
                                                TradeRate obj        = null;
                                                //调用接口 新增单个评价
                                                obj = objRateDal.BuyerTradeRateOneByOne(objRate, ref strContent, sessionKey);
                                                if (obj == null)
                                                {
                                                    // 调用API进行批量评价
                                                    obj = objRateDal.BuyerTradeRate(objRate, ref strContent, sessionKey);
                                                }
                                                if (obj != null)
                                                {   //rating sucessfull
                                                    obj.Content = strContent;
                                                    obj.Nick    = objRate.SellerNick;
                                                    obj.Tid     = Convert.ToInt64(tid);
                                                    obj.Created = obj.Created;

                                                    // 添加卖家评价:秒评
                                                    //Console.WriteLine("评价卖家:" + obj.Nick + " 评价日期:" + obj.Created);
                                                    DBUtil.AddRateHisWithSeller(obj, "方案三");

                                                    Console.WriteLine("当前卖家:" + sellerNick + "评价时间:" + DateTime.Now.ToString());
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            #endregion
                        }
                        //自动删除数据
                        DBUtil.DeleteValidTradeForMiaoRate(tid);
                    }
                    busySend = false;
                }
            }
            catch (Exception ex)
            {
                ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Data);
            }
            finally
            {
                sendMessageDoTimer.Enabled = true;
            }
        }
示例#8
0
        private static void GetCanRateTID(string sellerNick, DataRow fliterRow, DateTime startDate, DateTime endDate, ref bool hasNextPage, string sesionKey, long pageNo, DataTable dtAllOrder)
        {
            List <Trade> objTradeRateList = TBTrade.GetBuyerTrade(sellerNick, startDate, endDate, ref hasNextPage, sesionKey, pageNo);

            for (int i = 0; i < objTradeRateList.Count; i++)
            {
                //在评价之前需要对订单成功的时间进行判定(end_time),如果超过15天,不用再通过该接口进行评价
                if (Convert.ToDateTime(objTradeRateList[i].EndTime) < DateTime.Now.AddDays(-15))
                {
                    continue;
                }
                //如果双方已评价则过滤
                if (objTradeRateList[i].SellerRate)
                {
                    continue;
                }

                DateTime tradeEndTime = Convert.ToDateTime(objTradeRateList[i].EndTime);

                #region 第二套评价:买家评价以后评价
                if (Convert.ToInt32(fliterRow["isWaitBuyerRate"]).Equals(1))
                {
                    foreach (Order o in objTradeRateList[i].Orders)
                    {
                        var buyerNick = objTradeRateList[i].BuyerNick;
                        //检查是不是黑名单买家
                        if (!CheckIsBlacklst(sellerNick, buyerNick))
                        {
                            if (o.BuyerRate)//买家已评价
                            {
                                DataRow drALLOrder = dtAllOrder.NewRow();
                                drALLOrder["tid"] = objTradeRateList[i].Tid.ToString();
                                drALLOrder["oid"] = o.Oid.ToString();
                                drALLOrder["blackBuyerRatedIsRate"] = "0";//表示默认好评
                                dtAllOrder.Rows.Add(drALLOrder);
                            }
                            else
                            {
                                if (Convert.ToInt32(fliterRow["waitBuyerTimeDay"]).Equals(0) &&
                                    Convert.ToInt32(fliterRow["waitBuyerTimeHour"]).Equals(0) &&
                                    Convert.ToInt32(fliterRow["waitBuyerTimeFen"]).Equals(0))
                                {
                                    continue;
                                }

                                DateTime BuyerStartRateDate = tradeEndTime
                                                              .AddDays(Convert.ToDouble(fliterRow["waitBuyerTimeDay"]))
                                                              .AddHours(Convert.ToDouble(fliterRow["waitBuyerTimeHour"]))
                                                              .AddMinutes(Convert.ToDouble(fliterRow["waitBuyerTimeFen"]));
                                TimeSpan ts = DateTime.Now.Subtract(BuyerStartRateDate);
                                if (ts.Days > 0 || ts.Hours > 0 || ts.Minutes > 0)//定时评价
                                {
                                    DataRow drALLOrder2 = dtAllOrder.NewRow();
                                    drALLOrder2["tid"] = objTradeRateList[i].Tid.ToString();
                                    drALLOrder2["oid"] = o.Oid.ToString();
                                    drALLOrder2["blackBuyerRatedIsRate"] = "0";//表示默认好评
                                    dtAllOrder.Rows.Add(drALLOrder2);
                                }
                            }
                        }
                        else//黑名单买家
                        {
                            if (!o.BuyerRate)//如果黑名单买家一直未评价
                            {
                                if (Convert.ToInt32(fliterRow["blackBuyerNoRateQiangRateDay"]).Equals(0) &&
                                    Convert.ToInt32(fliterRow["blackBuyerNoRateQiangRateHour"]).Equals(0) &&
                                    Convert.ToInt32(fliterRow["blackBuyerNoRateQiangRateFen"]).Equals(0))
                                {
                                    continue;
                                }
                                DateTime blackBuyerStartRateDate = tradeEndTime
                                                                   .AddDays(Convert.ToInt32(fliterRow["blackBuyerNoRateQiangRateDay"]))
                                                                   .AddHours(Convert.ToInt32(fliterRow["blackBuyerNoRateQiangRateHour"]))
                                                                   .AddMinutes(Convert.ToInt32(fliterRow["blackBuyerNoRateQiangRateFen"]));

                                TimeSpan ts2 = DateTime.Now.Subtract(blackBuyerStartRateDate);
                                if (ts2.Days > 0 || ts2.Hours > 0 || ts2.Minutes > 0)//定时评价
                                {
                                    DataRow drALLOrder3 = dtAllOrder.NewRow();
                                    drALLOrder3["tid"] = objTradeRateList[i].Tid.ToString();
                                    drALLOrder3["oid"] = o.Oid.ToString();
                                    drALLOrder3["blackBuyerRatedIsRate"] = "0";//表示默认好评;
                                    dtAllOrder.Rows.Add(drALLOrder3);
                                }
                            }
                            else if (o.BuyerRate)
                            {
                                if (Convert.ToInt32(fliterRow["blackBuyerRatedIsRate"]).Equals(1))//不自动评价
                                {
                                    continue;
                                }
                                if (Convert.ToInt32(fliterRow["blackBuyerRatedIsRate"]).Equals(2))//自动好评
                                {
                                    DataRow drALLOrder = dtAllOrder.NewRow();
                                    drALLOrder["tid"] = objTradeRateList[i].Tid.ToString();
                                    drALLOrder["oid"] = o.Oid.ToString();
                                    drALLOrder["blackBuyerRatedIsRate"] = "2";
                                    dtAllOrder.Rows.Add(drALLOrder);
                                }
                                if (Convert.ToInt32(fliterRow["blackBuyerRatedIsRate"]).Equals(3))//自动中评
                                {
                                    DataRow drALLOrder = dtAllOrder.NewRow();
                                    drALLOrder["tid"] = objTradeRateList[i].Tid.ToString();
                                    drALLOrder["oid"] = o.Oid.ToString();
                                    drALLOrder["blackBuyerRatedIsRate"] = "3";
                                    dtAllOrder.Rows.Add(drALLOrder);
                                }
                                if (Convert.ToInt32(fliterRow["blackBuyerRatedIsRate"]).Equals(4))//自动差评
                                {
                                    DataRow drALLOrder = dtAllOrder.NewRow();
                                    drALLOrder["tid"] = objTradeRateList[i].Tid.ToString();
                                    drALLOrder["oid"] = o.Oid.ToString();
                                    drALLOrder["blackBuyerRatedIsRate"] = "4";
                                    dtAllOrder.Rows.Add(drALLOrder);
                                }
                            }
                        }
                    }
                }

                #endregion

                #region 评价方案三:总是在交易完成后多久评价
                if (Convert.ToInt32(fliterRow["isQiangRate"]).Equals(1))
                {
                    foreach (Order o in objTradeRateList[i].Orders)
                    {
                        if (Convert.ToInt32(fliterRow["qiangRateTimeDay"]).Equals(0) &&
                            Convert.ToInt32(fliterRow["qiangRateTimeHour"]).Equals(0) &&
                            Convert.ToInt32(fliterRow["qiangRateTimeFen"]).Equals(0))
                        {
                            continue;
                        }

                        DateTime qiangRateStartDate = tradeEndTime
                                                      .AddDays(Convert.ToInt32(fliterRow["qiangRateTimeDay"]))
                                                      .AddHours(Convert.ToInt32(fliterRow["qiangRateTimeHour"]))
                                                      .AddMinutes(Convert.ToInt32(fliterRow["qiangRateTimeFen"]));

                        TimeSpan ts3 = DateTime.Now.Subtract(qiangRateStartDate);
                        if (ts3.Days > 0 || ts3.Hours > 0 || ts3.Minutes > 0)//定时评价
                        {
                            DataRow drALLOrder = dtAllOrder.NewRow();
                            drALLOrder["tid"] = objTradeRateList[i].Tid.ToString();
                            drALLOrder["oid"] = o.Oid.ToString();
                            drALLOrder["blackBuyerRatedIsRate"] = "0";//表示默认好评
                            dtAllOrder.Rows.Add(drALLOrder);
                        }
                    }
                }
                #endregion
            }
        }
示例#9
0
        /// <summary>
        /// 同步会员信息
        /// </summary>
        /// <param name="strNick"></param>
        /// <param name="strSessionKey"></param>
        /// <returns></returns>
        public Boolean SynicBuyersInformation(string strNick, string strSessionKey)
        {
            List <CrmMember> buyers = null;
            int  PageNo = 1, PageSize = 100, nProcess;
            long total = 0;

            //交易同步
            List <Trade> allTrades   = new List <Trade>();
            Int64        tradePageNo = 1;
            Boolean      hasNext     = false;
            TBTrade      tbTrade     = new TBTrade();

            do
            {
                //获取卖家3个月的交易数据
                List <Trade> partTrades = tbTrade.GetBuyerTrades(strSessionKey, tradePageNo, ref hasNext);

                if (partTrades != null && partTrades.Count > 0)
                {
                    allTrades.AddRange(partTrades);//将list加入到末尾
                }
                tradePageNo++;
            } while (hasNext);//hasNext表示是否有下一页
            if (allTrades == null)
            {
                Console.WriteLine("卖家" + strNick + "的3个月的交易量:null");
                return(false);
            }
            Console.WriteLine("卖家" + strNick + "的3个月的交易量:" + allTrades.Count.ToString());

            do
            {
                try
                {
                    //获取买家信息
                    buyers = GetTBBuyerList(strSessionKey, PageNo, PageSize, ref total);
                    if (buyers == null)
                    {
                        Console.WriteLine("卖家" + strNick + "的买家数量:null");
                        continue;
                    }
                    //Console.WriteLine("卖家" + strNick + "的买家数量:" + buyers.Count.ToString());
                    SynchronizeBuyerInfoWithSeller(strNick, strSessionKey, buyers, allTrades);
                    if (total != 0)
                    {
                        nProcess = (int)(PageNo * PageSize * 100F / total);
                    }
                    else
                    {
                        nProcess = 0;
                    }
                    if (nProcess > 100)
                    {
                        nProcess = 100;
                    }
                    SellersBLL.SetSyncProcess(strNick, nProcess);
                }
                catch (Exception ex)
                {
                    ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Data);
                }
            } while (PageNo++ *PageSize < total);
            return(true);
        }
示例#10
0
        protected void BindData()
        {
            DataTable  dt   = new DataTable();
            DataColumn dc   = null;
            string     nick = TextBox4.Text.Trim();

            string startDate = txt_StartTime.Value;
            string endDate   = txt_EndTime.Value;
            string startPay  = TextBox2.Text.Trim();
            string endDPay   = TextBox3.Text.Trim();

            try
            {
                if (!string.IsNullOrEmpty(startPay))
                {
                    Convert.ToInt32(startPay);
                }
                if (!string.IsNullOrEmpty(endDPay))
                {
                    Convert.ToInt32(endDPay);
                }
            }
            catch (Exception e)
            {
                Response.Write("<script language='javascript'>alert('输入正确格式的金额!');</script>");
                return;
            }

            dc = dt.Columns.Add("reciverName", Type.GetType("System.String"));
            dc = dt.Columns.Add("cellPhone", Type.GetType("System.String"));
            if (string.IsNullOrEmpty(nick) == true)
            {
                return;
            }
            DataTable trade  = null;
            string    select = drpSType.SelectedValue.ToString();

            switch (select)
            {
            case "sign_notSure":
                trade = TradeBLL.GetTradeData(nick, startDate, endDate, startPay, endDPay, "taobao_trade_TradeSellerShip");
                break;

            case "sure_notSign":
                trade = TradeBLL.GetTradeDataNosign(nick, startDate, endDate, startPay, endDPay, "taobao_trade_TradeSellerShip");
                break;

            case "sure_notSucce":
                trade = TradeBLL.GetTradeDataNoSuccess(nick, startDate, endDate, startPay, endDPay, "taobao_trade_TradeSellerShip");
                break;
            }
            Trade tradeInfo = null;

            if (trade != null && trade.Rows.Count > 0)
            {
                string key = SellersBLL.GetSellerSessionKey(nick);
                foreach (DataRow row in trade.Rows)//轮训订单
                {
                    //获取订单id
                    string tid = row["tid"].ToString();
                    //调用淘宝接口获取订单详细交易信息
                    tradeInfo = TBTrade.GetTradeContact(Convert.ToInt64(tid), key);
                    string  cellPhone   = tradeInfo == null ? "" : tradeInfo.ReceiverMobile;
                    string  reciverName = tradeInfo == null ? "" : tradeInfo.ReceiverName;
                    DataRow drow        = dt.NewRow();
                    drow["reciverName"] = reciverName;
                    drow["cellPhone"]   = cellPhone;
                    dt.Rows.Add(drow);
                }
            }
            tb_member           = dt;
            grdBuyer.DataSource = trade;
            grdBuyer.DataBind();
        }
示例#11
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            var command = context.Request.Form["command"];

            if (!string.IsNullOrEmpty(command))
            {
                switch (command)
                {
                    #region OpenDefense
                case "OpenDefense":
                {
                    DataRow orderDate = SellersBLL.GetSelerOrderDate(Users.Nick);
                    if (orderDate != null)
                    {
                        if (orderDate["OrderVersion"].Equals("体验版"))
                        {
                            context.Response.Write("nopower");        //试用版不能用
                            context.Response.End();
                            return;
                        }
                    }

                    if (!ShieldRulesBLL.CheckCloseOrderConfigIsExit(Users.Nick))
                    {
                        context.Response.Write("noConfig");        //保存拦截条件设置,才能开启差评自动防御!
                        context.Response.End();
                    }
                    else
                    {
                        DataTable tb = ShieldRulesBLL.GeCloseOrderConfigByNick(Users.Nick);
                        if (tb != null && tb.Rows.Count > 0)
                        {
                            if (tb.Rows[0]["isAutoCloseOrder"].ToString().Equals("1"))
                            {
                                //btnOpen.ImageUrl = "~/images/closed.png";
                                ShieldRulesBLL.UpdateAutoCloseOrderStatus(Users.Nick, 0);
                                //关闭订单自动拦截时先判断用户是否设置了自动秒评,否则关闭后就会出现问题
                                if (!ShieldRulesBLL.CheckIsMiaoPingAuto(Users.Nick))
                                {
                                    ITopClient           client = TBManager.GetClient();
                                    TmcUserCancelRequest req    = new TmcUserCancelRequest();
                                    req.Nick = Users.Nick;
                                    TmcUserCancelResponse response = client.Execute(req);
                                    if (response.IsSuccess)
                                    {
                                    }
                                }
                                context.Response.Write("cloedDefens");        //差评自动防御已关闭!
                                context.Response.End();
                            }
                            else
                            {
                                //btnOpen.ImageUrl = "~/images/open.png";
                                ShieldRulesBLL.UpdateAutoCloseOrderStatus(Users.Nick, 1);
                                //检查是否开启了主动通知
                                ITopClient            client   = TBManager.GetClient();
                                TmcUserPermitRequest  req      = new TmcUserPermitRequest();
                                TmcUserPermitResponse response = client.Execute(req, Users.SessionKey);
                                if (response.IsSuccess)
                                {
                                }
                                context.Response.Write("openDefens");        //差评自动防御已开启!
                                context.Response.End();
                            }
                        }
                    }
                }
                break;
                    #endregion

                    #region ClearDate
                case "ClearDate":
                {
                    if (ShieldRulesBLL.UpdateCloseDate(Users.Nick))
                    {
                        context.Response.Write("1");        //定时间段关闭已清除!
                        context.Response.End();
                    }
                }
                break;
                    #endregion

                    #region closeOrder
                case "closeOrder":
                {
                    string  orderNo  = context.Request.Form["orderNo"];
                    string  reason   = context.Request.Form["reason"];
                    TBTrade objTrade = new TBTrade();
                    Trade   trade    = objTrade.CloseOrderByTradeID(Convert.ToInt64(orderNo), reason);
                    if (trade != null)
                    {
                        context.Response.Write("1");        //关闭成功
                        context.Response.End();
                    }
                    if (ShieldRulesBLL.UpdateCloseDate(Users.Nick))
                    {
                        context.Response.Write("0");        //关闭失败
                        context.Response.End();
                    }
                }
                break;
                    #endregion
                }
            }
        }