コード例 #1
0
        /// <summary>
        /// 修改买分析信息
        /// </summary>
        public void UpdateExperterAnalyzeScheme(ExperterAnalyzeUpdateInfo experter)
        {
            using (var biz = new GameBizBusinessManagement())
            {
                biz.BeginTran();

                var manager = new ExperterAnalyzeSchemeeManager();
                var entity  = manager.QueryExperterAnalyzeId(experter.AnalyzeId);
                if (entity == null)
                {
                    throw new Exception("修改信息未被查询到");
                }
                entity.DisposeOpinion = experter.DisposeOpinion;
                entity.DealWithType   = experter.DealWithType;
                manager.UpdateExperterAnalyzeScheme(entity);

                biz.CommitTran();
            }
        }
コード例 #2
0
        /// <summary>
        /// 购买分析信息
        /// </summary>
        public void BuyExperterAnalyzeScheme(ExperterAnalyzeTransactionInfo experter, string password)
        {
            using (var biz = new GameBizBusinessManagement())
            {
                biz.BeginTran();

                var manager = new ExperterAnalyzeSchemeeManager();
                var old     = manager.QueryExperterAnalyzeTransaction(experter.AnalyzeId, experter.UserId);
                if (old != null)
                {
                    throw new Exception("您已购买该分析内容!");
                }

                //用户扣款
                var user = string.Format("用户:{0}购买专家:{1}分析方案{2},单价为:{3}", experter.UserId, experter.ExperterId, experter.AnalyzeId, experter.Price);
                BusinessHelper.Payout_To_End(BusinessHelper.FundCategory_BuyExpScheme, experter.UserId, Guid.NewGuid().ToString("N"), experter.Price, user, "BuyExperter", password);
                //专家收款
                var expt = string.Format("专家:{0}收取用户:{1}分析方案{2},单价为:{3}", experter.ExperterId, experter.UserId, experter.AnalyzeId, experter.Price);
                BusinessHelper.Payin_To_Balance(AccountType.Experts, BusinessHelper.FundCategory_BuyExpScheme, experter.ExperterId, Guid.NewGuid().ToString("N"), experter.Price, expt);

                var entity = new ExperterAnalyzeTransaction()
                {
                    UserId      = experter.UserId,
                    AnalyzeId   = experter.AnalyzeId,
                    ExperterId  = experter.ExperterId,
                    Price       = experter.Price,
                    CurrentTime = experter.CurrentTime,
                    CreateTime  = DateTime.Now,
                };
                manager.AddExperterAnalyzeTransaction(entity);

                //增加购买次数
                var anId = manager.QueryExperterAnalyzeId(experter.AnalyzeId);
                if (anId == null)
                {
                    throw new Exception("修改信息未被查询到");
                }
                anId.SellCount++;
                manager.UpdateExperterAnalyzeScheme(anId);

                biz.CommitTran();
            }
        }