private void btnResponse_Click(object sender, RoutedEventArgs e)
        {
            Response response     = new Response();
            string   responseText = txtResponse.Text;

            if (responseText.Length > 0)
            {
                try
                {
                    Question question = (Question)gridQuestions.SelectedItem;

                    response.Date         = DateTime.Now;
                    response.QuestionID   = question.QuestionID;
                    response.UserID       = _accessToken.UserID;
                    response.UserResponse = responseText;
                    string message = "";
                    message = "Your question '" + question.Title + "' has received a new response from Expert " + _accessToken.UserName + ".";

                    if (article.BlogID != 0)
                    {
                        response.BlogID = article.BlogID;
                    }
                    else
                    {
                        response.BlogID = null;
                    }

                    if (responseText.Length <= 250)
                    {
                        responseManager.AddResponse(response);
                        messageManager.SendMessage(message, "Your question has a new response", _accessToken.UserName, userManager.GetUser(question.CreatedBy).UserName);
                        //if (response.BlogID == null)
                        //    messageManager.SendMessage(message, "Your question has a new response", _accessToken.UserName, userManager.GetUser(question.CreatedBy).UserName);
                        btnResponse.Content = "Edit";
                        this.NavigationService.Navigate(new ExpertPages.SearchForQuestions(_accessToken, question));
                    }
                }
                catch (Exception)
                {
                    try
                    {
                        Response oldResponse = responseManager.GetResponseByQuestionIDAndUser(response.QuestionID, _accessToken.UserID);
                        responseManager.EditResponse(response, oldResponse);
                        Question question = (Question)gridQuestions.SelectedItem;
                        this.NavigationService.Navigate(new ExpertPages.SearchForQuestions(_accessToken, question));
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Your response could not get through.");
                    }
                }
            }
            else
            {
                lblReply.Content    = "Enter a response";
                lblReply.Foreground = System.Windows.Media.Brushes.Red;
            }
        }
Ejemplo n.º 2
0
        public ActionResult Vote(VoteViewModel model)
        {
            //Get Poll
            var poll = _poll.DisplayPoll(model.PollId);

            model.Text      = poll.Text;
            model.Responses = poll.Responses;


            if (ModelState.IsValid)
            {
                //Get posted Values and save to database
                var response = new ResponseModel
                {
                    PollId = model.PollId,
                    Option = model.Option,
                    Email  = model.Email,
                };
                _response.AddResponse(response, poll.PollId);
                return(RedirectToAction("details", new { id = poll.PollId }));
            }

            return(View(model));
        }
Ejemplo n.º 3
0
    public void ChangeScore()
    {
        Text txt   = GameObject.Find("Score").GetComponent <Text>();
        Data data  = GameObject.Find("Data").GetComponent <Data>();
        int  score = data.score;

        switch (this.name)
        {
        case "risk1":
            score -= 45000;
            break;

        case "risk2":
            score -= 100000;
            break;

        case "risk3":
            score -= 55000;
            break;

        case "risk4":
            score -= 50000;
            break;

        case "risk5":
            score -= 100000;
            break;

        case "risk6":
            score -= 15000;
            break;

        case "risk7":
            score -= 40000;
            break;

        case "risk8":
            score -= 20000;
            break;

        case "risk9":
            score -= 50000;
            break;

        case "risk10":
            score -= 500000;
            break;

        case "risk11":
            score -= 60000;
            break;

        case "risk12":
            score -= 30000;
            break;

        case "risk13":
            score -= 20000;
            break;

        case "risk14":
            score -= 15000;
            break;

        case "risk15":
            score -= 45000;
            break;

        case "risk16":
            score -= 15000;
            break;

        case "risk17":
            score -= 100000;
            break;

        case "risk18":
            score -= 35000;
            break;

        case "risk19":
            score -= 25000;
            break;

        case "risk20":
            score -= 50000;
            break;
        }

        if (score > 0)
        {
            txt.text = score.ToString() + "$";
            data.SetScore(score);

            Image  image = gameObject.GetComponent <Image>();
            string name  = this.name;

            ResponseManager responseManager = GameObject.Find("InventoryData").GetComponent <ResponseManager>();

            responseManager.AddResponse(name, image);
        }
    }