Пример #1
0
        /// <summary>
        /// 根据单号获取跟踪信息
        /// </summary>
        /// <param name="orderNumber"></param>
        /// <returns></returns>
        public static bool GetTrackInfo(string orderNumber)
        {
            Log.Info("本次获取单号为:{0}".FormatWith(orderNumber));
            var result = B2CController.GetTrackInfoXmlByNumber(orderNumber);

            try
            {
                DbUtility dbUtility = new SqlDbUtility(TrackCon);
                string    obj       = dbUtility.ExecuteScalar(
                    "exec P_ImportB2CTrackInfo {0},{1}",
                    orderNumber, result).ToString();
                var issuccess = obj == "1";
                if (issuccess)
                {
                    Log.Info("本次获取单号为:{0} 插入数据库成功!".FormatWith(orderNumber));
                }
                else
                {
                    Log.Error("本次获取单号为:{0} 插入数据库失败!".FormatWith(orderNumber));
                }
                return(issuccess);
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
            return(false);
        }
Пример #2
0
        /// <summary>
        /// 获取B2C跟新信息插入数据库按时间点
        /// </summary>
        public static bool GetTrackInfo()
        {
            var intervalHours = -1 * (IntervalHours + 4);//加4小时,是防止漏抓取B2C跟踪信息
            var datetime      = long.Parse(DateTime.UtcNow.AddHours(intervalHours).ToString("yyyyMMddHH") + "0000");

            Log.Info("本次获取UTC时间点为:{0}".FormatWith(datetime));
            var result = B2CController.GetTrackInfoXmlByTime(datetime);

            try
            {
                DbUtility dbUtility = new SqlDbUtility(TrackCon);
                string    obj       = dbUtility.ExecuteScalar(
                    "exec P_ImportB2CTrackInfo {0},{1}",
                    datetime.ToString(), result).ToString();
                var issuccess = obj == "1";
                if (issuccess)
                {
                    Log.Info("本次获取UTC时间点为:{0} 插入数据库成功!".FormatWith(datetime));
                }
                else
                {
                    Log.Error("本次获取UTC时间点为:{0} 插入数据库失败!".FormatWith(datetime));
                }
                return(issuccess);
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
            return(false);
        }