Exemple #1
0
        public static ResultDTO UpdateJdOrderId(ContextSession contextSession, string MainOrderId, string CommodityOrderId, string appId, string userId)
        {
            ResultDTO dto = new ResultDTO {
                isSuccess = true
            };

            try
            {
                string jsonRedis = RedisHelperNew.RegionGet <string>(RedisKeyConst.UserOrder_JdPOrderIdList, userId, "BTPCache");

                if (!string.IsNullOrEmpty(jsonRedis))
                {
                    string json = jsonRedis.ToString();
                    LogHelper.Info("【京东订单】关联JdOrderItem表--->CommodityOrderId=[" + CommodityOrderId + "],appId--->[" + appId + "],userId--->[" + userId + "],缓存Json值--->【" + jsonRedis + "】");
                    List <JdCache> arr = JsonHelper.JsonDeserialize <List <JdCache> >(json);
                    if (arr != null)
                    {
                        if (arr.Count() > 0)
                        {
                            foreach (var item in arr)
                            {
                                if (item.AppId == appId)
                                {
                                    var jdorderitem = JdOrderItem.ObjectSet().Where(p => p.JdPorderId == item.JdporderId && p.State == 1).FirstOrDefault();
                                    if (jdorderitem != null)
                                    {
                                        jdorderitem.MainOrderId      = MainOrderId;
                                        jdorderitem.CommodityOrderId = CommodityOrderId;
                                        jdorderitem.State            = 1;
                                        jdorderitem.ModifiedOn       = DateTime.Now;
                                        jdorderitem.EntityState      = EntityState.Modified;
                                        contextSession.SaveObject(jdorderitem);
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    LogHelper.Info("【京东订单】关联JdOrderItem表--->CommodityOrderId=[" + CommodityOrderId + "],appId--->[" + appId + "],userId--->[" + userId + "],缓存Json值--->【" + jsonRedis + "】");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(string.Format("JdOrderItem信息保存异常。JdOrderItem:{0}", ex.Message));
                dto = new ResultDTO()
                {
                    ResultCode = 1, Message = ex.Message, isSuccess = false
                };
            }
            return(dto);
        }
Exemple #2
0
        public static void DeleteRedisJdPOrder(string userId)
        {
            //数据获取完成,则删除redis
            //#region 原dll
            //GlobalCacheWrapper.Remove(RedisKeyConst.UserOrder_JdPOrderIdList, userId, CacheTypeEnum.redisSS, "BTPCache");
            //var jsonaa = GlobalCacheWrapper.GetData(RedisKeyConst.UserOrder_JdPOrderIdList, userId, CacheTypeEnum.redisSS, "BTPCache");// RedisHelper.GetHashValue<string>(RedisKeyConst.UserOrder_JdPOrderIdList, userId);
            //LogHelper.Info("【京东订单--删除后查询】关联JdOrderItem表--->userId--->[" + userId + "],缓存Json值--->【" + jsonaa + "】");
            //#endregion

            //数据获取完成,则删除redis

            #region 新dll
            //新dll
            RedisHelperNew.Remove(RedisKeyConst.UserOrder_JdPOrderIdList, userId, "BTPCache");
            string jsonaa = RedisHelperNew.RegionGet <string>(RedisKeyConst.UserOrder_JdPOrderIdList, userId, "BTPCache");
            LogHelper.Info("【京东订单--删除后查询】关联JdOrderItem表--->userId--->[" + userId + "],缓存Json值--->【" + jsonaa + "】");
            #endregion
        }