Exemple #1
0
 public static String GetBuyerCount(string flag, string sellerNick)
 {
     return(BuyerDAL.GetBuyerCount(flag, sellerNick, SellersDAL.GetSellerIdByNick(sellerNick)));
 }
Exemple #2
0
 public static string GetSellerIdByNick(string strNick)
 {
     return(SellersDAL.GetSellerIdByNick(strNick));
 }
Exemple #3
0
 /// <summary>
 /// 同步会员信息
 /// </summary>
 /// <param name="strNick"></param>
 /// <param name="strSessionKey"></param>
 /// <param name="obj"></param>
 /// <param name="allTrades"></param>
 /// <returns></returns>
 public static bool SynchronizeBuyerInfoWithSeller(string strNick, string strSessionKey, List <CrmMember> obj, List <Trade> allTrades)
 {
     try
     {
         int    synCount = 0;
         string sellerId = SellersDAL.GetSellerIdByNick(strNick);
         Buyers membs    = null;
         if (obj != null && obj.Count > 0)
         {
             foreach (var o in obj)
             {
                 try
                 {
                     //检查卖家是否存在当前买家信息
                     if (!BuyerDAL.CheckBuyerIsExit(o.BuyerNick.ToString(), strNick, sellerId))
                     {
                         //此处开始处理数据
                         membs = new Buyers();
                         //membs.BuyerId = o.BuyerId;官方接口停止返回
                         Random random = new Random();
                         string id     = DateTime.Now.Ticks.ToString().Substring(0, DateTime.Now.Ticks.ToString().Length - 4) + random.Next(1, 100).ToString();
                         membs.BuyerId          = Convert.ToInt64(id);
                         membs.Buyer_nick       = o.BuyerNick;
                         membs.AvgPrice         = o.AvgPrice;
                         membs.Status           = o.Status;
                         membs.CloseTradeCount  = o.CloseTradeCount;
                         membs.CloseTradeAmount = o.CloseTradeAmount;
                         membs.ItemCloseCount   = o.ItemCloseCount;
                         membs.LastTradeTime    = o.LastTradeTime;
                         membs.ItemNum          = o.ItemNum;
                         membs.TradeAmount      = o.TradeAmount;
                         membs.Grade            = o.Grade;
                         membs.Province         = o.Province;
                         membs.City             = o.City;
                         membs.TradeCount       = o.TradeCount;
                         //在交易订单中找买家详情信息
                         Trade buyerInfo = GetBuyerInfoByNick(allTrades, o.BuyerNick);
                         if (buyerInfo != null)
                         {    //如果有交易订单
                             membs.Buyer_reallName = buyerInfo.ReceiverName;
                             membs.CellPhone       = buyerInfo.ReceiverMobile;
                             membs.Address         = buyerInfo.ReceiverState + buyerInfo.ReceiverCity + buyerInfo.ReceiverDistrict + buyerInfo.ReceiverAddress;
                             membs.BuyerProvince   = buyerInfo.ReceiverState.Equals("0") ? "其它" : buyerInfo.ReceiverState;
                             membs.Buyer_credit    = "1";
                             //membs.Buyer_email = buyerInfo.BuyerEmail;
                         }
                         //写入买家基数信息
                         bool re = BuyerDAL.Add(membs, strNick, UpdateGroup(o), sellerId);     //groupNo:== 1:新客户;> 1:老客户;== 0:潜在客户;3个月未购买:休眠3个月:此处为系统默认分组,不能删除,卖家可以自定义分组,可以删除。
                         if (re)
                         {
                             synCount++;
                         }
                     }
                 }
                 catch (Exception ex)
                 {
                     continue;
                 }
             }
         }
         Console.WriteLine("新增卖家:" + strNick + "会员数量" + synCount);
         ExceptionManager exceptionManager = new ExceptionManager();
         exceptionManager.WriteFileLog(strNick, allTrades.Count.ToString(), synCount.ToString());
         return(true);
     }
     catch
     {
         return(false);
     }
 }