/// <summary>
 /// 添加名家
 /// </summary>
 public CommonActionResult AddExperter(ExperterInfo experter)
 {
     try
     {
         new ExpertBusiness().AddExperter(experter);
         return(new CommonActionResult(true, "操作成功"));
     }
     catch (Exception ex)
     {
         throw new Exception("添加名家 - " + ex.Message);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加名家
        /// </summary>
        public void AddExperter(ExperterInfo experter)
        {
            using (var biz = new GameBizBusinessManagement())
            {
                biz.BeginTran();

                var manager      = new ExperterManager();
                var useerManager = new UserBalanceManager();
                var userEntity   = useerManager.QueryUserRegister(experter.UserId);
                if (userEntity == null)
                {
                    throw new LogicException(string.Format("用户Id:{0}没有找到该用户", experter.UserId));
                }
                var entityUser = manager.QueryExperterById(experter.UserId);
                if (entityUser != null)
                {
                    throw new LogicException(string.Format("该用户:{0}已经是名家", experter.UserId));
                }
                var entity = new Experter()
                {
                    UserId             = experter.UserId,
                    ExperterHeadImage  = experter.ExperterHeadImage,
                    AdeptGameCode      = "JCZQ",
                    ExperterSummary    = experter.ExperterSummary,
                    RecentlyOrderCount = 0,
                    IsEnable           = true,
                    ExperterType       = experter.ExperterType,
                    CreateTime         = DateTime.Now,
                    WeekShooting       = 0M,
                    MonthRate          = 0M,
                    TotalRate          = 0M,
                    WeekRate           = 0M,
                    DealWithType       = DealWithType.HasDealWith,
                    DisposeOpinion     = "",
                    MonthShooting      = 0M,
                    TotalShooting      = 0M,
                };
                manager.AddExperter(entity);
                biz.CommitTran();
            }
        }