public bool Handle(EventBus.Events.OrderEvaluationCompletedEvent evt)
        {
            if (evt == null)
            {
                return(true);
            }

            try
            {
                var order = orderService.Single <XuHos.Entity.Order>(a => a.OrderOutID == evt.OuterID);
                if (order != null)
                {
                    order.IsEvaluated = true;
                    var result = orderService.Update(order);
                    if (result == true)
                    {
                        var CacheKey_Order = new XuHos.Common.Cache.Keys.EntityCacheKey <DTO.Platform.OrderDTO>(XuHos.Common.Cache.Keys.StringCacheKeyType.Order, order.OrderNo);
                        CacheKey_Order.RemoveCache();
                    }
                    return(result);
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Common.LogHelper.WriteError(ex);
            }

            return(false);
        }
Exemple #2
0
        /// <summary>
        /// 更新个人信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateUserInfo(UserDTO model)
        {
            using (var db = new DBEntities())
            {
                var user = db.Users.Where(t => t.UserID == model.UserID).FirstOrDefault();

                if (user != null)
                {
                    if (model.UserCNName != null)
                    {
                        user.UserCNName = model.UserCNName;
                        var member = (from m in db.UserMembers
                                      where m.UserID == user.UserID && m.Relation == EnumUserRelation.MySelf &&
                                      m.IsDeleted == false
                                      select m).FirstOrDefault();
                        if (member != null)
                        {
                            member.MemberName = model.UserCNName;
                        }
                    }

                    if (model.UserENName != null)
                    {
                        user.UserENName = model.UserENName;
                    }

                    if (model.Email != null)
                    {
                        user.Email = model.Email;
                    }

                    if (model._PhotoUrl != null)
                    {
                        user.PhotoUrl = model._PhotoUrl;
                    }

                    var CacheKey_User =
                        new XuHos.Common.Cache.Keys.EntityCacheKey <XuHos.Entity.User>(StringCacheKeyType.User,
                                                                                       user.UserID);
                    CacheKey_User.RemoveCache();

                    return(db.SaveChanges() > 0);
                }
                return(false);
            }
        }