示例#1
0
        public ResponseHelper Purchase(int courseId, string userId)
        {
            var rh = new ResponseHelper();

            try
            {
                using (var ctx = _dbContextScopeFactory.CreateWithTransaction(
                           IsolationLevel.Serializable
                           ))
                {
                    var user   = _applicationUserRepo.Single(x => x.Id == userId);
                    var course = _courseRepo.Single(x => x.Id == courseId);

                    var hasTaken = _userPerCourseRepo.Find(x =>
                                                           x.UserId == userId &&
                                                           x.CourseId == courseId
                                                           ).Any();

                    // Si el curso ya fue tomado no hacemos nada
                    if (hasTaken)
                    {
                        rh.SetResponse(false, "El curso ya ha sido tomado por este alumno");
                    }
                    // Si el precio del curso es mayor a los créditos actuales
                    else if (Convert.ToDecimal(course.Price) > user.Credit)
                    {
                        rh.SetResponse(false, "Usted no cuenta con los créditos necesarios para adquirir el curso");
                    }
                    else
                    {
                        var hasPriorCourses = _userPerCourseRepo.Find(x =>
                                                                      x.UserId == userId
                                                                      ).Any();

                        // Verificamos si es la primera vez que compra el curso. Si fuera así, asignamos el rol de estudiante
                        if (!hasPriorCourses)
                        {
                            var role = _roleRepo.Single(x =>
                                                        x.Name == RolNames.Student
                                                        );

                            _userRepo.Insert(new ApplicationUserRole
                            {
                                UserId = userId,
                                RoleId = role.Id
                            });
                        }

                        // Asignamos un curso a un usuario
                        _userPerCourseRepo.Insert(new UsersPerCourses
                        {
                            UserId   = userId,
                            CourseId = courseId
                        });

                        // Actualizamos el crédito del usuario
                        user.Credit = user.Credit - Convert.ToDecimal(course.Price);
                        _applicationUserRepo.Update(user);

                        var incomes = new List <Incomes>
                        {
                            // Ingreso total
                            new Incomes {
                                EntityType = Enums.EntityType.Courses,
                                EntityID   = course.Id,
                                IncomeType = Enums.IncomeType.Total,
                                Total      = Convert.ToDecimal(course.Price)
                            },

                            // Ingreso profesor
                            new Incomes
                            {
                                EntityType = Enums.EntityType.Courses,
                                EntityID   = course.Id,
                                IncomeType = Enums.IncomeType.TeacherTotal,
                                Total      = (Convert.ToDecimal(course.Price)) * (Convert.ToDecimal(Parameters.TeacherComission) / 100)
                            },

                            // Ingreso para la empresa
                            new Incomes
                            {
                                EntityType = Enums.EntityType.Courses,
                                EntityID   = course.Id,
                                IncomeType = Enums.IncomeType.CompanyTotal,
                                Total      = (Convert.ToDecimal(course.Price)) * (Convert.ToDecimal(Parameters.SalesCommission) / 100)
                            }
                        };

                        _incomeRepo.Insert(incomes);

                        rh.SetResponse(true);
                    }

                    ctx.SaveChanges();
                }
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                rh.SetResponse(false, e.Message);
            }

            return(rh);
        }
示例#2
0
 public RankResponse CrowdGetRank(string siteId, Guid managerId, int rankType, int pageIndex, int pageSize)
 {
     return(ResponseHelper.TryCatch <RankResponse>(() => CrossRankThread.Instance.GetRanking(siteId, managerId, rankType, pageIndex, pageSize)));
 }
示例#3
0
 public LadderHookInfoResponse LadderGetHookInfoResponse(Guid managerId)
 {
     return(ResponseHelper.TryCatch(() => CrossLadderManager.Instance.GetHookInfoResponse(managerId)));
 }
示例#4
0
 public MessageCodeResponse LadderStopHook(string siteId, Guid managerId)
 {
     return(ResponseHelper.TryCatch(() => CrossLadderManager.Instance.StopHook(managerId, siteId)));
 }
示例#5
0
 /// <summary>
 /// GetMatch
 /// </summary>
 /// <param name="managerId"></param>
 /// <param name="matchId"></param>
 /// <returns></returns>
 public CrossladderMatchResponse LadderGetMatch(Guid managerId, Guid matchId)
 {
     return(ResponseHelper.TryCatch(() => CrossLadderCore.Instance.GetMatch(managerId, matchId)));
 }
示例#6
0
 public LadderMatchMarqueeResponse LadderGetMatchMarqueeResponse(string siteId)
 {
     return(ResponseHelper.TryCatch(() => CrossLadderManager.Instance.GetMatchMarqueeResponse(siteId)));
 }
示例#7
0
        /// <summary>
        /// 修改商品价格
        /// </summary>
        protected void ModifyPrice()
        {
            string  result      = string.Empty;
            bool    flag        = true;
            int     productId   = RequestHelper.GetQueryString <int>("productId");
            decimal salePrice   = RequestHelper.GetQueryString <decimal>("salePrice");
            string  valueList   = Server.UrlDecode(RequestHelper.GetQueryString <string>("valueList"));
            string  standIdList = RequestHelper.GetQueryString <string>("standIdList");
            string  priceList   = RequestHelper.GetQueryString <string>("priceList");

            //无规格或产品组规格  修改一口价
            if (salePrice < 0)
            {
                flag   = false;
                result = "一口价填写不规范";
            }
            if (flag)
            {
                if (productId > 0)
                {
                    var product = ProductBLL.Read(productId);

                    if (product.StandardType == (int)ProductStandardType.Single)
                    {//如果是单产品规格
                        string[]  valueArr          = valueList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        string[]  salePriceArr      = priceList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        decimal[] standardPriceList = ProductTypeStandardRecordBLL.ReadListByProduct(productId, product.StandardType).Select(k => k.SalePrice).ToArray();

                        decimal[] arr  = Array.ConvertAll <string, decimal>(salePriceArr, s => decimal.Parse(s));
                        ArrayList list = new ArrayList(arr);
                        list.AddRange(standardPriceList);
                        list.Sort();
                        decimal min = Convert.ToDecimal(list[0]);
                        decimal max = Convert.ToDecimal(list[list.Count - 1]);
                        if (salePrice > max || salePrice < min)
                        {
                            flag   = false;
                            result = "一口价必须在" + min + "-" + max + "之间";
                        }
                        else
                        {
                            product.SalePrice = salePrice;
                            ProductBLL.Update(product);
                            result = product.SalePrice.ToString();
                            for (int i = 0; i < valueArr.Length; i++)
                            {
                                ProductTypeStandardRecordInfo standardRecord = new ProductTypeStandardRecordInfo();
                                standardRecord.ProductId = product.Id;
                                standardRecord.ValueList = valueArr[i];
                                standardRecord.SalePrice = Convert.ToDecimal(salePriceArr[i]);
                                ProductTypeStandardRecordBLL.UpdateSalePrice(standardRecord);
                            }
                        }
                    }
                    else
                    {
                        //无规格或产品组规格  修改一口价
                        product.SalePrice = salePrice;
                        ProductBLL.Update(product);
                        result = product.SalePrice.ToString();
                    }
                }
                else
                {
                    flag   = false;
                    result = "参数错误";
                }
            }
            Response.Clear();
            ResponseHelper.Write(JsonConvert.SerializeObject(new { flag = flag, msg = result }));
            Response.End();
        }
示例#8
0
 /// <summary>
 /// Ladders the heart.
 /// </summary>
 /// <param name="managerId">The manager id.</param>
 /// <returns></returns>
 public CrossLadderHeartResponse LadderHeart(string siteId, Guid managerId)
 {
     return(ResponseHelper.TryCatch(() => CrossLadderManager.Instance.Heart(siteId, managerId)));
 }
示例#9
0
        /// <summary>
        /// 开始射门
        /// </summary>
        /// <param name="managerId"></param>
        /// <returns></returns>
        public PenaltyKickShootResponse Shoot(Guid managerId)
        {
            var response = new PenaltyKickShootResponse();

            response.Data = new PenaltyKickShoot();
            try
            {
                if (!IsActivity)
                {
                    return(ResponseHelper.Create <PenaltyKickShootResponse>(MessageCode.AdMissSeason));
                }
                var info = GetManager(managerId);
                if (info == null)
                {
                    return(ResponseHelper.Create <PenaltyKickShootResponse>(MessageCode.MissManager));
                }
                if (info.Status != 1)
                {
                    return(ResponseHelper.Create <PenaltyKickShootResponse>(MessageCode.GameEnd));
                }
                if (info.ShootLog.Length > 0)
                {
                    var shootList = info.ShootLog.Split(',');
                    if (shootList.Length >= 5)
                    {
                        return(ResponseHelper.Create <PenaltyKickShootResponse>(MessageCode.GameEnd));
                    }
                }
                //背包满了  不让踢球
                var package = ItemCore.Instance.GetPackage(managerId, EnumTransactionType.AdTopScorerKeep);
                if (package == null)
                {
                    return(ResponseHelper.Create <PenaltyKickShootResponse>(MessageCode.NbParameterError));
                }
                if (package.IsFull)
                {
                    return(ResponseHelper.Create <PenaltyKickShootResponse>(MessageCode.ItemPackageFull));
                }
                //射门结果
                var shootResult = GetShootResult(info.ShooterAttribute);
                //射门结果处理
                Shoot(info, shootResult.IsGoals);
                int score = 0;
                //进球了才有奖励
                var prizeList = new List <PrizeEntity>();
                if (shootResult.IsGoals)
                {
                    score++; //每进一球加一点
                    prizeList = GetPrize(info.ShootLog, info.MaxCombGoals);
                    foreach (var item in prizeList)
                    {
                        switch (item.ItemType)
                        {
                        case 3:     //物品
                            var code = package.AddItems(item.ItemCode, item.ItemCount);
                            if (code != MessageCode.Success)
                            {
                                return(ResponseHelper.Create <PenaltyKickShootResponse>(code));
                            }
                            break;

                        case 5:     //积分
                            score += item.ItemCount;
                            break;
                        }
                    }
                    info.AvailableScore += score;
                    info.TotalScore     += score;
                    info.ScoreChangeTime = DateTime.Now;
                }
                info.UpdateTime = DateTime.Now;
                using (var transactionManager = new TransactionManager(Dal.ConnectionFactory.Instance.GetDefault()))
                {
                    transactionManager.BeginTransaction();
                    var messageCode = MessageCode.NbUpdateFail;
                    do
                    {
                        if (shootResult.IsGoals)
                        {
                            if (!package.Save(transactionManager.TransactionObject))
                            {
                                break;
                            }
                        }
                        if (!PenaltykickManagerMgr.Update(info, transactionManager.TransactionObject))
                        {
                            break;
                        }
                        messageCode = MessageCode.Success;
                    } while (false);
                    if (messageCode != MessageCode.Success)
                    {
                        transactionManager.Rollback();
                        return(ResponseHelper.Create <PenaltyKickShootResponse>(messageCode));
                    }
                    transactionManager.Commit();
                    package.Shadow.Save();
                }

                response.Data.Info        = GetManagerInfoResponse(info);
                response.Data.ShootResult = shootResult;
                response.Data.ItemList    = prizeList;
                //更新排名信息
                UpdateRank(info);
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("点球射门", ex);
                response.Code = (int)MessageCode.NbParameterError;
            }
            return(response);
        }
示例#10
0
        /// <summary>
        /// 积分兑换
        /// </summary>
        /// <param name="managerId"></param>
        /// <param name="itemCode"></param>
        /// <returns></returns>
        public PenaltyKickExChangeResponse ExChange(Guid managerId, int itemCode)
        {
            PenaltyKickExChangeResponse response = new PenaltyKickExChangeResponse();

            response.Data = new PenaltyKickExChange();
            try
            {
                var info = GetManager(managerId);
                if (info == null)
                {
                    return(ResponseHelper.Create <PenaltyKickExChangeResponse>(MessageCode.MissManager));
                }
                var exList = GetExChangeEntity(info.ExChangeString);
                if (exList == null)
                {
                    return(ResponseHelper.Create <PenaltyKickExChangeResponse>(MessageCode.NbParameterError));
                }
                //获取要兑换的物品
                var exItem = exList.Find(r => r.ItemCode == itemCode);
                if (exItem == null)
                {
                    return(ResponseHelper.Create <PenaltyKickExChangeResponse>(MessageCode.ExChangeItemNot));
                }
                //已经兑换过
                if (exItem.Status == 1)
                {
                    return(ResponseHelper.Create <PenaltyKickExChangeResponse>(MessageCode.RepeatExChange));
                }
                //积分不足
                if (info.AvailableScore < exItem.Price)
                {
                    return(ResponseHelper.Create <PenaltyKickExChangeResponse>(MessageCode.LadderExchangeScoreShortage));
                }
                info.AvailableScore = info.AvailableScore - exItem.Price;
                exItem.Status       = 1;
                //所有物品都兑换完了  自动刷新
                if (!exList.Exists(r => r.Status == 0))
                {
                    info.ExChangeString = RefreshExChange();
                    exList = GetExChangeEntity(info.ExChangeString);
                }
                else
                {
                    info.ExChangeString = SetExChangeString(exList);
                }

                info.UpdateTime = DateTime.Now;
                var package = ItemCore.Instance.GetPackage(managerId, EnumTransactionType.AdTopScorerKeep);
                if (package == null)
                {
                    return(ResponseHelper.Create <PenaltyKickExChangeResponse>(MessageCode.NbParameterError));
                }
                var messageCode = package.AddItem(exItem.ItemCode);
                if (messageCode != MessageCode.Success)
                {
                    return(ResponseHelper.Create <PenaltyKickExChangeResponse>(messageCode));
                }
                using (var transactionManager = new TransactionManager(Dal.ConnectionFactory.Instance.GetDefault()))
                {
                    transactionManager.BeginTransaction();
                    messageCode = MessageCode.NbUpdateFail;
                    do
                    {
                        if (!package.Save(transactionManager.TransactionObject))
                        {
                            break;
                        }
                        if (!PenaltykickManagerMgr.Update(info, transactionManager.TransactionObject))
                        {
                            break;
                        }
                        messageCode = MessageCode.Success;
                    } while (false);
                    if (messageCode != MessageCode.Success)
                    {
                        transactionManager.Rollback();
                        return(ResponseHelper.Create <PenaltyKickExChangeResponse>(messageCode));
                    }
                    transactionManager.Commit();
                    package.Shadow.Save();
                }
                response.Data.AvailableScore = info.AvailableScore;
                response.Data.ExChangeList   = exList;
                response.Data.ItemCode       = exItem.ItemCode;
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("点球积分兑换", ex);
                response.Code = (int)MessageCode.NbParameterError;
            }
            return(response);
        }
示例#11
0
        /// <summary>
        /// 开始游戏
        /// </summary>
        /// <param name="managerId"></param>
        /// <returns></returns>
        public GetPenaltyKickInfoResponse Join(Guid managerId)
        {
            var response = new GetPenaltyKickInfoResponse();

            response.Data = new GetPenaltyKickInfo();
            try
            {
                //不在活动时间内
                if (!IsActivity)
                {
                    return(ResponseHelper.Create <GetPenaltyKickInfoResponse>(MessageCode.AdMissSeason));
                }
                var manager = ManagerCore.Instance.GetManager(managerId);
                if (null == manager)
                {
                    return(ResponseHelper.Create <GetPenaltyKickInfoResponse>(MessageCode.MissManager));
                }
                var info = GetManager(managerId);
                if (info == null)
                {
                    return(ResponseHelper.Create <GetPenaltyKickInfoResponse>(MessageCode.MissManager));
                }
                //游戏还未结束
                if (info.Status == 1)
                {
                    return(ResponseHelper.Create <GetPenaltyKickInfoResponse>(MessageCode.GameNotEnd));
                }
                bool isfree = false;
                if (info.FreeNumber > 0)
                {
                    info.FreeNumber--;
                    isfree = true;
                }
                else
                {
                    if (info.GameCurrency <= 0)
                    {
                        return(ResponseHelper.Create <GetPenaltyKickInfoResponse>(MessageCode.GameCurrencyNumberNot));
                    }
                    info.GameCurrency--;
                }
                info.Status = 1;
                //获取踢球球员属性
                var shooterAttribute = GetShooterId(managerId);
                if (shooterAttribute == 0)
                {
                    return(ResponseHelper.Create <GetPenaltyKickInfoResponse>(MessageCode.NbParameterError));
                }
                info.ShooterAttribute = shooterAttribute;
                info.ShootNumber++;
                info.ShootLog     = "";
                info.CombGoals    = 0;
                info.MaxCombGoals = 0;
                info.UpdateTime   = DateTime.Now;
                if (!PenaltykickManagerMgr.Update(info))
                {
                    return(ResponseHelper.Create <GetPenaltyKickInfoResponse>(MessageCode.NbUpdateFail));
                }
                //插入消费记录
                PenaltykickManagerMgr.InsertRecord(managerId, 1, isfree);
                response.Data = GetManagerInfoResponse(info);
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("点球开始游戏", ex);
                response.Code = (int)MessageCode.NbParameterError;
            }
            return(response);
        }
示例#12
0
 public GenericResponse RegisterHelps(DetailsInputRequest request)
 {
     return(ResponseHelper.Success());
 }
示例#13
0
        public ResponseHelper InsertOrUpdateBasicInformation(Course model)
        {
            var rh        = new ResponseHelper();
            var newRecord = false;

            try {
                using (var ctx = _dbContextScopeFactory.Create()) {
                    if (model.Id > 0)
                    {
                        var originalCourse = _courseRepo.Single(x => x.Id == model.Id);
                        originalCourse.Name        = model.Name;
                        originalCourse.Description = model.Description;
                        originalCourse.Price       = model.Price;
                        originalCourse.CategoryId  = model.CategoryId;
                        originalCourse.Slug        = Slug.Course(model.Id, model.Name);

                        _courseRepo.Update(originalCourse);
                    }
                    else
                    {
                        newRecord      = true;
                        model.AuthorId = CurrentUserHelper.Get.UserId;
                        model.Status   = Enums.Status.Pending;
                        model.Image1   = "assets/images/courses/no-image.jpg";
                        model.Image2   = model.Image1;

                        var studentRole = _roleRepo.SingleOrDefault(x => x.Name == RolNames.Teacher);

                        var hasRole = _userRepo.Find(
                            x => x.UserId == model.AuthorId && x.RoleId == studentRole.Id).Any();

                        if (!hasRole)
                        {
                            _userRepo.Insert(new ApplicationUserRole {
                                UserId = model.AuthorId, RoleId = studentRole.Id
                            });
                        }
                        _courseRepo.Insert(model);
                    }

                    ctx.SaveChanges();
                }

                if (newRecord)
                {
                    using (var ctx = _dbContextScopeFactory.Create()) {
                        var originalCourse = _courseRepo.Single(x => x.Id == model.Id);

                        originalCourse.Slug = Slug.Course(model.Id, model.Name);

                        _courseRepo.Update(originalCourse);

                        ctx.SaveChanges();
                    }
                }

                rh.SetResponse(true);
            } catch (Exception e) {
                logger.Error(e.Message);
                rh.SetResponse(false, e.Message);
            }

            return(rh);
        }
示例#14
0
 /// <summary>
 /// 获取天梯赛信息
 /// </summary>
 /// <param name="managerId"></param>
 /// <returns></returns>
 public CrossladderManagerResponse LadderGetManagerInfo(string siteId, Guid managerId)
 {
     return(ResponseHelper.TryCatch(() => CrossLadderCore.Instance.GetManagerInfo(siteId, managerId)));
 }
 public SkillResponse Run(Request pRequest)
 {
     return(ResponseHelper.CreateTextResponse("Thank you for using Alexa Template"));
 }
示例#16
0
 /// <summary>
 /// Leaves the ladder.
 /// </summary>
 /// <param name="managerId">The manager id.</param>
 /// <returns></returns>
 public MessageCodeResponse LadderLeave(string siteId, Guid managerId)
 {
     return(ResponseHelper.TryCatch(() => CrossLadderManager.Instance.Leave(siteId, managerId)));
 }
示例#17
0
        public async Task <IActionResult> Get()
        {
            var users = await _userService.GetUserWithRoleAsync();

            return(ResponseHelper.Ok(users));
        }
示例#18
0
 /// <summary>
 /// Fives the match.
 /// </summary>
 /// <param name="managerId">The manager id.</param>
 /// <returns></returns>
 public LadderMatchEntityListResponse LadderGetMatchList(Guid managerId)
 {
     return(ResponseHelper.TryCatch(() => CrossLadderCore.Instance.GetMatchList(managerId)));
 }
示例#19
0
        public async Task <IActionResult> GetRoles()
        {
            await Task.CompletedTask;

            return(ResponseHelper.Ok(AppRoles.Get()));
        }
示例#20
0
 /// <summary>
 /// 天梯荣誉兑换
 /// </summary>
 /// <param name="managerId"></param>
 /// <param name="exchangeKey"></param>
 /// <returns></returns>
 public LadderExchangeResponse LadderExchange(string siteId, Guid managerId, int exchangeKey)
 {
     return(ResponseHelper.TryCatch(() => CrossLadderCore.Instance.Exchange(siteId, managerId, exchangeKey)));
 }
示例#21
0
        public async Task <IActionResult> Update([FromBody] UserUpdateViewModel userViewModel)
        {
            await _userService.UpdateAsync(userViewModel.Email, userViewModel.Role);;

            return(ResponseHelper.Ok(userViewModel));
        }
示例#22
0
 public MessageCodeResponse LadderBuyStamina(string siteId, Guid managerId)
 {
     return(ResponseHelper.TryCatch(() => CrossLadderCore.Instance.BuyStamina(siteId, managerId)));
 }
示例#23
0
        public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command)
        {
            System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
            stopWatch.Start();
            int    overload         = 1;
            string exceptionMessage = null;

            try
            {
                NCache nCache = clientManager.CmdExecuter as NCache;
                if (nCache != null)
                {
                    _command = command.getMessageCommand;
                    var operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation);
                    CommandsUtil.PopulateClientIdInContext(ref operationContext, clientManager.ClientAddress);
                    if (command.commandVersion < 1)
                    {
                        operationContext.Add(OperationContextFieldName.ClientLastViewId, forcedViewId);
                    }
                    else //NCache 4.1 SP1 or later
                    {
                        operationContext.Add(OperationContextFieldName.ClientLastViewId, command.clientLastViewId.ToString(CultureInfo.InvariantCulture));
                    }
                    _clientId = clientManager.ClientID;
                    SubscriptionInfo subInfo = new SubscriptionInfo()
                    {
                        ClientId = clientManager.ClientID
                    };

                    MessageResponse response = nCache.Cache.GetAssignedMessages(subInfo, operationContext);
                    stopWatch.Stop();
                    //filter event messages for older clients that use pubsub
                    if (clientManager.ClientVersion < 5000)
                    {
                        if (response.AssignedMessages.ContainsKey(TopicConstant.ItemLevelEventsTopic))
                        {
                            response.AssignedMessages.Remove(TopicConstant.ItemLevelEventsTopic);
                        }
                        if (response.AssignedMessages.ContainsKey(TopicConstant.CollectionEventsTopic))
                        {
                            response.AssignedMessages.Remove(TopicConstant.CollectionEventsTopic);
                        }
                    }

                    GetMessageResponseBuilder.BuildResponse(response.AssignedMessages, command.commandVersion, _command.requestId.ToString(CultureInfo.InvariantCulture), _serializedResponsePackets, command.commandID, command.requestID, nCache, _clientId, clientManager);
                }
            }
            catch (System.Exception exc)
            {
                exceptionMessage = exc.ToString();
                _serializedResponsePackets.Add(ResponseHelper.SerializeExceptionResponseWithType(exc, command.requestID, command.commandID, clientManager.ClientVersion));
            }
            finally
            {
                TimeSpan executionTime = stopWatch.Elapsed;
                try
                {
                    if (Alachisoft.NCache.Management.APILogging.APILogManager.APILogManger != null && Alachisoft.NCache.Management.APILogging.APILogManager.EnableLogging)
                    {
                        APILogItemBuilder log = new APILogItemBuilder(MethodsName.GetTopicMessages);
                        log.GenerateGetTopicMessagesAPILogItem(executionTime, clientManager.ClientID, clientManager.ClientIP, overload, _messages, exceptionMessage);

                        // Hashtable expirationHint = log.GetDependencyExpirationAndQueryInfo(cmdInfo.ExpirationHint, cmdInfo.queryInfo);
                    }
                }
                catch
                {
                }
            }
        }
示例#24
0
 public LadderHookInfoResponse LadderStartHook(string siteId, Guid managerId, int maxTimes, int minScore, int maxScore, int winTimes)
 {
     return(ResponseHelper.TryCatch(() => CrossLadderManager.Instance.StartHook(managerId, siteId, maxTimes, minScore, maxScore, winTimes)));
 }
示例#25
0
 public CrosscrowdManagerResponse CrowdResurrection(string siteId, Guid managerId)
 {
     return(ResponseHelper.TryCatch(() => CrossCrowdCore.Instance.Resurrection(siteId, managerId)));
 }
示例#26
0
 /// <summary>
 /// 获取对手
 /// </summary>
 /// <param name="managerId"></param>
 /// <param name="zoneName"></param>
 /// <returns></returns>
 public ArenaGetOpponentResponse GetOpponent(Guid managerId, string zoneName)
 {
     return(ResponseHelper.TryCatch(() => ArenaCore.Instance.GetOpponent(managerId, zoneName)));
 }
示例#27
0
        private void UserOrderOperate()
        {
            string result = string.Empty;

            if (base.UserId <= 0)
            {
                ResponseHelper.Write("登录状态已过期,请重新登录");
                ResponseHelper.End();
            }
            int       orderID      = RequestHelper.GetQueryString <int>("OrderID");
            int       orderOperate = RequestHelper.GetQueryString <int>("operate");
            OrderInfo order        = OrderBLL.Read(orderID, base.UserId);

            if (order.Id > 0 && ((orderOperate == (int)OrderOperate.Cancle && (order.OrderStatus == (int)OrderStatus.WaitCheck || order.OrderStatus == (int)OrderStatus.WaitPay)) ||
                                 (orderOperate == (int)OrderOperate.Received && order.OrderStatus == (int)OrderStatus.HasShipping)))
            {
                if (orderOperate == (int)OrderOperate.Cancle)
                {
                    int startOrderStatus = order.OrderStatus;
                    order.OrderStatus = (int)OrderStatus.NoEffect;
                    //库存变化
                    ProductBLL.ChangeOrderCountByOrder(orderID, ChangeAction.Minus);
                    OrderBLL.UserUpdateOrderAddAction(order, "用户取消订单", orderOperate, startOrderStatus);
                    //返还积分
                    if (order.Point > 0)
                    {
                        var accountRecord = new UserAccountRecordInfo
                        {
                            RecordType = (int)AccountRecordType.Point,
                            Money      = 0,
                            Point      = order.Point,
                            Date       = DateTime.Now,
                            IP         = ClientHelper.IP,
                            Note       = "取消订单:" + order.OrderNumber + ",返还积分",
                            UserId     = base.UserId,
                            UserName   = base.UserName
                        };
                        UserAccountRecordBLL.Add(accountRecord);
                    }
                }
                else if (orderOperate == (int)OrderOperate.Received)
                {
                    //赠送积分
                    int sendPoint = OrderBLL.ReadOrderSendPoint(order.Id);
                    if (sendPoint > 0)
                    {
                        var accountRecord = new UserAccountRecordInfo
                        {
                            RecordType = (int)AccountRecordType.Point,
                            Money      = 0,
                            Point      = sendPoint,
                            Date       = DateTime.Now,
                            IP         = ClientHelper.IP,
                            Note       = ShopLanguage.ReadLanguage("OrderReceived").Replace("$OrderNumber", order.OrderNumber),
                            UserId     = base.UserId,
                            UserName   = base.UserName
                        };
                        UserAccountRecordBLL.Add(accountRecord);
                    }
                    int startOrderStatus = order.OrderStatus;
                    order.OrderStatus = (int)OrderStatus.ReceiveShipping;
                    OrderBLL.UserUpdateOrderAddAction(order, "用户确认收货", orderOperate, startOrderStatus);
                }
            }
            else
            {
                result = "订单不存在或状态错误";
            }
            ResponseHelper.Write(result);
            ResponseHelper.End();
        }