public static void Execute(TourStepRequest request)
        {
            var turnamentName = string.Empty;
            var turnamentId   = Guid.Parse(request.TurnamentId);
            var game          = new List <game_for_turnament>();

            switch (request.TurnamentType)
            {
            case 1:
                game          = DbHelper.CloseTour(turnamentId, request.Tour);
                turnamentName = DbHelper.GetTurnamentName(turnamentId);
                break;

            case 2:
                game          = DbHelper.CloseTour(turnamentId, request.Tour);
                turnamentName = DbHelper.GetTurnamentNameForGroup(turnamentId);
                break;

            case 3:
                var circleId = Guid.Parse(request.CircleId);
                game          = DbHelper.CloseTour(circleId);
                turnamentName = DbHelper.GetTurnamentNameForPlayOff(circleId);
                CreateGameNewTour(turnamentId, circleId);
                break;
            }
            ;

            CalculatePosition(Guid.Parse(request.TurnamentId));
            game.ForEach(x =>
            {
                SendEmailBLL.SendEmail("Окончание тура", $"{request.Tour} тур, в турнире \"{turnamentName}\" завершен", DbHelper.GetAccountEmail(x.id_command_one));
                SendEmailBLL.SendEmail("Окончание тура", $"{request.Tour} тур, в турнире \"{turnamentName}\" завершен", DbHelper.GetAccountEmail(x.id_command_two));
            });
        }
Exemple #2
0
        public static void NotificationCommandForActive(Guid turnamentId, int tour, int step, string turnamentName)
        {
            var game = DbHelper.GetGameForTout(turnamentId, tour);

            game.ForEach(x =>
            {
                if (x.date_start == null)
                {
                    throw new ApplicationException("Не установлена дата проведения");
                }
                if (x.id_game_arena == null)
                {
                    throw new ApplicationException("Не установлено место проведения");
                }
            });

            game.ForEach(x =>
            {
                SendEmailBLL.SendEmail("Новый тур", $"{tour} тур, в турнире \"{turnamentName}\" " +
                                       $"пройдет - {x.date_start.Value.ToShortDateString()} в {x.date_start.Value.ToShortTimeString()}. " +
                                       $"Место проведения тура - {DbHelper.GetArenaName(x.id_game_arena)} Подробности можно узнать в личном кабинете.", DbHelper.GetAccountEmail(x.id_command_one));
                SendEmailBLL.SendEmail("Новый тур", $"{tour} тур, в турнире \"{turnamentName}\" " +
                                       $"пройдет - {x.date_start.Value.ToShortDateString()} в {x.date_start.Value.ToShortTimeString()}. " +
                                       $"Место проведения тура - {DbHelper.GetArenaName(x.id_game_arena)} Подробности можно узнать в личном кабинете.", DbHelper.GetAccountEmail(x.id_command_two));
            });

            DbHelper.ChangeStatusTour(turnamentId, tour, step);
        }
        public static ElementResponse Execute(ElementRequest request, string commandId, string commandName, string OlimpEmail)
        {
            DbHelper.CheckCountCommand(Guid.Parse(commandId));
            DbHelper.DeclareTournament(Guid.Parse(request.Txt), Guid.Parse(commandId));

            SendEmailBLL.SendEmail("Заявка на турнир", $"Команда \"{commandName}\": подала заявку на участие в турнире -  \"{DbHelper.GetTurnamentName(Guid.Parse(request.Txt))}\"", OlimpEmail);

            return(new ElementResponse {
                Txt = commandName
            });
        }
        public static void Execute(ChangeStepRequest request)
        {
            DbHelper.ChangeStep(request.Id, request.Step);

            if (request.Step == 4)
            {
                var command = DbHelper.GetPositionCommand(Guid.Parse(request.Id));

                command.ForEach(x => {
                    SendEmailBLL.SendEmail("Окончание турнира", $"Турнир \"{DbHelper.GetTurnamentName(Guid.Parse(request.Id))}\" завершен.", DbHelper.GetAccountEmail(x.id_account));
                });
            }
        }
        public static void Execute(SingCodeToEmailRequest request)
        {
            if (request.Login != null)
            {
                DbHelper.CheckLodinInEmail(request.Login, request.Email);
            }

            Random rnd  = new Random();
            var    code = rnd.Next(1000, 10001);

            DbHelper.SaveUserCode(code, request.Email);

            if (request.Login != null)
            {
                SendEmailBLL.SendEmail("Смена пароля", $"Код подтверждения для изменения пароля от Вашей учетной записи: {code}", request.Email);
            }

            else
            {
                SendEmailBLL.SendEmail("Регистрация", $"Код подтверждения регистрации: {code}", request.Email);
            }
        }
Exemple #6
0
 public static void Execute(DeclareRequest request)
 {
     DbHelper.AcceptDeclare(Guid.Parse(request.TurnamentId), Guid.Parse(request.CommandId));
     SendEmailBLL.SendEmail("Решение по заявке на турнир", $"Ваша заявка на участие в турнире \"{DbHelper.GetTurnamentName(Guid.Parse(request.TurnamentId))} одобрена", DbHelper.GetAccountEmail(Guid.Parse(request.CommandId)));
 }
Exemple #7
0
 public static void Execute(RemoveDeclareRequest request)
 {
     DbHelper.RemoveDeclare(Guid.Parse(request.TurnamentId), Guid.Parse(request.CommandId));
     SendEmailBLL.SendEmail("Отказ в заявке на участие", $"Участие в турнире \"{DbHelper.GetTurnamentName(Guid.Parse(request.TurnamentId))} отклонено по причине - \"{request.Cause}\"", DbHelper.GetAccountEmail(Guid.Parse(request.CommandId)));
 }