Exemplo n.º 1
0
        public ActionResult CornerLiveQuestion(Answer corner)
        {
            var answer = corner;

            answer.Id = GolGuru.Instance.GetMatchLiveQuestionIdResponse().ToString(CultureInfo.InvariantCulture);

            var rightAnswer = new RightAnswer()
            {
                AnswerId = Convert.ToInt16(answer.Id),
                IsActive = true,
                Datetime = DateTime.Now,
                Points   = Convert.ToInt16(answer.puntaje),
                Answer   = answer.respuesta
            };

            db.RightAnswers.InsertOnSubmit(rightAnswer);

            try
            {
                db.SubmitChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            GolGuru.Instance.BrodcastMatchLiveAnswer(answer);

            var redirectUrl = new UrlHelper(Request.RequestContext).Action("MainMenu", "Home");

            return(Json(new { Url = redirectUrl }));
        }
Exemplo n.º 2
0
        private void NotifyHandler(Action <ResponseModel> d, LongPollResponse.EventsInfo e)
        {
            switch (e.Type)
            {
            case "sq_ed_game":
            {
                d.Invoke(new ResponseModel());
                break;
            }

            case "sq_question":
            {
                var q = new Question
                {
                    Id      = e.Question.Id,
                    Text    = e.Question.Text,
                    Time    = e.UnixQuestionTime,
                    Answers = e.Question.Answers_q
                };
                d.Invoke(q);
                break;
            }

            case "sq_game_winners":
            {
                var gw = new GameWinners
                {
                    Users        = e.Users,
                    Prize        = e.Prize,
                    CountWinners = e.CountWinners
                };
                d.Invoke(gw);
                break;
            }

            case "sq_friend_answer":
            {
                var fa = new FriendAnswer
                {
                    AnswerFriendId = e.AnswerFriendId,
                    PhotoFriendUrl = e.PhotoFriendUrl,
                    IsLiveEnabled  = e.IsLiveEnabled
                };
                d.Invoke(fa);
                break;
            }

            case "sq_question_answers_right":
            {
                var ra = new RightAnswer
                {
                    Id            = e.Question.Id,
                    Text          = e.Question.Text,
                    Time          = e.UnixQuestionTime,
                    Answers       = e.Question.Answers,
                    RightAnswerId = e.Question.RightAnswerId,
                    UnixSentTime  = e.Question.UnixSentTime
                };
                d.Invoke(ra);
                break;
            }

            case "video_comment_new":
            {
                var vcn = new VideoComment
                {
                    Comment = e.Comment,
                    User    = e.User
                };
                d.Invoke(vcn);
                break;
            }
            }
        }
Exemplo n.º 3
0
        public ActionResult AnswerMatchQuestion(AfterMatchQuestions amQuestions)
        {
            var match = db.MatchQuestions.Where(r => r.Datetime.Value.Date == DateTime.Now.Date);

            if (match.Any())
            {
                var question = from c in match
                               where c.Question == "Quien va a ganar el partido?" &&
                               c.Datetime.Value.Date == DateTime.Now.Date
                               select c;

                var first = question.FirstOrDefault();
                if (first != null)
                {
                    var qstn = new RightAnswer()
                    {
                        Answer   = amQuestions.equipoGanador,
                        AnswerId = first.Id,
                        Datetime = DateTime.Now,
                        IsActive = true,
                        Points   = 250
                    };

                    db.RightAnswers.InsertOnSubmit(qstn);
                }

                question = from c in match
                           where c.Question == "Quien va a tener más la pelota?" &&
                           c.Datetime.Value.Date == DateTime.Now.Date
                           select c;

                first = question.FirstOrDefault();
                if (first != null)
                {
                    var qstn = new RightAnswer()
                    {
                        Answer   = amQuestions.equipoPosesion,
                        AnswerId = first.Id,
                        Datetime = DateTime.Now,
                        IsActive = true,
                        Points   = 250
                    };

                    db.RightAnswers.InsertOnSubmit(qstn);
                }
                question = from c in match
                           where c.Question == "Quien va a rematar más al arco?" &&
                           c.Datetime.Value.Date == DateTime.Now.Date
                           select c;

                first = question.FirstOrDefault();
                if (first != null)
                {
                    var qstn = new RightAnswer()
                    {
                        Answer   = amQuestions.equipoRemate,
                        AnswerId = first.Id,
                        Datetime = DateTime.Now,
                        IsActive = true,
                        Points   = 250
                    };

                    db.RightAnswers.InsertOnSubmit(qstn);
                }
                question = from c in match
                           where c.Question == "Quien va a cometer más faltas?" &&
                           c.Datetime.Value.Date == DateTime.Now.Date
                           select c;

                first = question.FirstOrDefault();
                if (first != null)
                {
                    var qstn = new RightAnswer()
                    {
                        Answer   = amQuestions.equipoFaltas,
                        AnswerId = first.Id,
                        Datetime = DateTime.Now,
                        IsActive = true,
                        Points   = 250
                    };

                    db.RightAnswers.InsertOnSubmit(qstn);
                }
                question = from c in match
                           where c.Question == "Quien va a tener más corners a favor?" &&
                           c.Datetime.Value.Date == DateTime.Now.Date
                           select c;

                first = question.FirstOrDefault();
                if (first != null)
                {
                    var qstn = new RightAnswer()
                    {
                        Answer   = amQuestions.equipoCorner,
                        AnswerId = first.Id,
                        Datetime = DateTime.Now,
                        IsActive = true,
                        Points   = 250
                    };

                    db.RightAnswers.InsertOnSubmit(qstn);
                }
                question = from c in match
                           where c.Question == "Quien va a recibir más amarillas?" &&
                           c.Datetime.Value.Date == DateTime.Now.Date
                           select c;

                first = question.FirstOrDefault();
                if (first != null)
                {
                    var qstn = new RightAnswer()
                    {
                        Answer   = amQuestions.equipoAmarilla,
                        AnswerId = first.Id,
                        Datetime = DateTime.Now,
                        IsActive = true,
                        Points   = 250
                    };

                    db.RightAnswers.InsertOnSubmit(qstn);
                }
                try
                {
                    db.SubmitChanges();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }

            return(RedirectToAction("MainMenu", "Home"));
        }
Exemplo n.º 4
0
 private void document_Loaded(Word.Document doc)
 {
     Choice.addStyle(doc);
     RightAnswer.addStyle(doc);
     WrongAnswer.addStyle(doc);
 }