protected void btnAnswer_Click(object sender, EventArgs e) { AnswerQuestion aQuestion = new AnswerQuestion(); if (Session["doctorEmail"] != null) //&& Session["id"] != null) { //aQuestion.QuestionId = Session["id"].ToString(); aQuestion.QuestionId = Convert.ToInt32(txtQuestionId.Text); aQuestion.DoctorEmail = Session["doctorEmail"].ToString(); var basePath = Server.MapPath("~/Images"); var rowFile = _qManager.CountAnsImageRow(); var fileName = string.Format("{0:00000000}_{1}", rowFile, AnsphotoUpload.FileName); var filePath = System.IO.Path.Combine(basePath, fileName); aQuestion.AnsPhoto = Path.Combine("/Images", fileName); var selectedPhoto = AnsphotoUpload; selectedPhoto.SaveAs(filePath); aQuestion.AnswerDetails = txtAnswer.Value; int rowcount = _qManager.SaveAnswer(aQuestion); if (rowcount > 0) { lblmsg.Text = "Answered."; return; } } }
public IActionResult QuestionsSetting(SelectQuestions questions, AnswerQuestion answer) { ViewBag.name = HttpContext.Session.GetString("name"); ViewBag.img = HttpContext.Session.GetString("img"); string search = Request.Form["Search_info"]; if (search != null) { var info = userContent.SelectQuestions.Where(b => b.Que_name.Contains(search)).ToList(); ViewBag.questions = info; return(View()); } if (answer.AQ_Name != null) { userContent.AnswerQuestion.Add(answer); userContent.SaveChanges(); } else if (questions.Que_name != null) { userContent.SelectQuestions.Add(questions); userContent.SaveChanges(); } // var a = Request.Form["first"]; List <SelectQuestions> questions1 = userContent.SelectQuestions.ToList(); List <AnswerQuestion> answers = userContent.AnswerQuestion.ToList(); ViewBag.questions = questions1; ViewBag.answers = answers; return(View()); }
public async Task <IActionResult> PutAnswerQuestion(int id, AnswerQuestion answerQuestion) { if (id != answerQuestion.AnswerId) { return(BadRequest()); } _context.Entry(answerQuestion).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AnswerQuestionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public int CreateAnswer(AnswerQuestion Answer) { userContent.AnswerQuestion.Add(Answer); userContent.SaveChanges(); var id = userContent.AnswerQuestion.FirstOrDefault(b => b.AQ_Name == Answer.AQ_Name).AQ_ID; return(id); }
public JsonResult PutQuestionsAnswer(int id, [FromBody] AnswerQuestion answer) { if (TryValidateModel(answer)) { var custServAccessLayer = new CustomerServiceAccessLayer(_context); var question = custServAccessLayer.PutQuestionsAnswer(id, answer); return(Json(question)); } return(Json(null)); }
// 打开作业答疑区的点击事件 private void asq(object sender, RoutedEventArgs e) { Button mh = (Button)sender; String[] info = (String[])mh.Tag; //获取的直接是作业id AnswerQuestion aq = new AnswerQuestion(account, name, classId, info[1], info[4]); aq.Show(); //AnswerQuestion aq = new AnswerQuestion(info[0]); this.Visibility = Visibility.Hidden; }
internal int InsertAnswer(AnswerQuestion aQuestion) { connection.Open(); command = new SqlCommand("sp_answerQuestion", connection); command.Parameters.Add("@questionId", SqlDbType.Int).Value = aQuestion.QuestionId; command.Parameters.Add("@doctorEmail", SqlDbType.NVarChar).Value = aQuestion.DoctorEmail; command.Parameters.Add("@answerDetails", SqlDbType.NVarChar).Value = aQuestion.AnswerDetails; command.Parameters.Add("@ansphoto", SqlDbType.NVarChar).Value = aQuestion.AnsPhoto; command.CommandType = CommandType.StoredProcedure; row = command.ExecuteNonQuery(); connection.Close(); return(row); }
public void AnswerQuestion(int Id, string answer, int type, int profId) { var dto = new AnswerQuestion() { Id = Id, Answer = answer, Type = type, ProfId = profId }; var request = _httpClient.PostAsync($"{baseUSerManagementMicroserviceUrl}/api/v1/answerQuestion", new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(dto), Encoding.UTF8, "application/json")); var response = request.Result; }
/// <summary> /// Puts a questions answer based on the AnswerQuestion's Answer value. /// </summary> /// <param name="id">Question Id to change.</param> /// <param name="inAnswer">Contains the answer to update the question with.</param> /// <returns>The answered question.</returns> public Question PutQuestionsAnswer(int id, AnswerQuestion inAnswer) { try { Question question = _context.Questions.Find(id); question.Answer = inAnswer.Answer; _context.SaveChanges(); return(question); } catch (Exception e) { Console.Error.WriteLine("Something went wrong in Oblig3.CustomerServiceAccessLayer.PutQuestionsAnswer(int id, AnswerQuestion inAnswer)", e); return(null); } }
public async Task <IActionResult> CreateAnswerAsync([FromBody] AnswerQuestion ans) { try { Answer answer = new Answer(); answer.QuestionId = ans.question_id; answer.Answer1 = ans.answer; answer.AnsweredBy = ans.answeredBy; answer.AnsweredByName = ans.answeredByName; db.Answer.Add(answer); await db.SaveChangesAsync(); return(Ok("Success")); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <ActionResult <AnswerQuestion> > PostAnswerQuestion(AnswerQuestion answerQuestion) { _context.AnswerQuestions.Add(answerQuestion); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (AnswerQuestionExists(answerQuestion.AnswerId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetAnswerQuestion", new { id = answerQuestion.AnswerId }, answerQuestion)); }
public int AddAnswer(AnswerQuestion objEntity) { int result = 0; SqlParameter[] param = new SqlParameter[4]; param[0] = new SqlParameter("@AnswerDetails", SqlDbType.VarChar, 500); param[0].Value = objEntity.AnswerDetails; param[1] = new SqlParameter("@DateAndTime", SqlDbType.VarChar, 25); param[1].Value = objEntity.DateAndTime; param[2] = new SqlParameter("@QuestionId", SqlDbType.Int); param[2].Value = objEntity.QuestionId; param[3] = new SqlParameter("@UserId", SqlDbType.Int); param[3].Value = objEntity.UserId; result = objDataLayer.AddUserAnswerDataLayer(param); return(result); }
void AddItem(AnswerQuestion answer) { DataGridViewRow row = new DataGridViewRow(); DataGridViewTextBoxCell txtBox1 = new DataGridViewTextBoxCell(); txtBox1.Value = answer.seq.ToString(); txtBox1.ToolTipText = "ID=" + answer.question.Id.ToString(); row.Cells.Add(txtBox1); txtBox1.ReadOnly = true; DataGridViewTextBoxCell txtBox2 = new DataGridViewTextBoxCell(); txtBox2.Value = answer.question.Tittle; txtBox2.ToolTipText = answer.question.Tittle; row.Cells.Add(txtBox2); txtBox2.ReadOnly = true; DataGridViewTextBoxCell txtBox4 = new DataGridViewTextBoxCell(); txtBox4.Value = Question._TypeInfo[answer.question.Type]; txtBox4.ToolTipText = "题目类型"; row.Cells.Add((DataGridViewTextBoxCell)txtBox4); txtBox4.ReadOnly = true; DataGridViewTextBoxCell txtBox5 = new DataGridViewTextBoxCell(); ChapterInfo model = new ChapterInfo(); txtBox5.Value = answer.AnswerString; txtBox5.ToolTipText = "您的答案"; row.Cells.Add((DataGridViewTextBoxCell)txtBox5); txtBox5.ReadOnly = true; DataGridViewTextBoxCell txtBox6 = new DataGridViewTextBoxCell(); txtBox6.Value = answer.CorrectString; txtBox6.ToolTipText = "正确答案"; row.Cells.Add((DataGridViewTextBoxCell)txtBox6); txtBox6.ReadOnly = true; DataGridViewTextBoxCell txtBox7 = new DataGridViewTextBoxCell(); if (0 == answer.RightStatus) { txtBox7.Value = "未回答"; } if (1 == answer.RightStatus) { txtBox7.Value = "回答正确"; } if (2 == answer.RightStatus) { txtBox7.Value = "回答错误"; } txtBox7.ToolTipText = answer.question.SkillNotice; row.Cells.Add((DataGridViewTextBoxCell)txtBox7); txtBox7.ReadOnly = true; row.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.Rows.Add(row); }
public AnswerStatusResponse Post(AnswerQuestionRequest request) { string answerId = IdGenerator.Generate(); var command = new AnswerQuestion { AggregateId = request.QuestionId, Body = request.Body, AuthorId = TypedSession.UserId, AnswerId = answerId }; SendCommand(command); return new AnswerStatusResponse() { AnswerId = answerId }; }
internal int SaveAnswer(AnswerQuestion aQuestion) { return(_qGateway.InsertAnswer(aQuestion)); }
void Start() { answerlist = new List <string>(); challengeRedMsg.gameObject.SetActive(false); challengeBlackMsg.gameObject.SetActive(false); newChallengeBtn.gameObject.SetActive(false); leaderBoardsBtn.gameObject.SetActive(false); imageRootURL = GameControl.instance.ImageRootURL; // cache counter text counterText = counter.GetComponent <Text>(); // cache question panel components imageQuestion = questionPanel.GetComponentInChildren <ImageQuestion>(); questionPanelText = questionPanel.GetComponentInChildren <Text>(); questionPanelImage = questionPanel.GetComponent <Image>(); // cache answer components answer1Text = answer1.GetComponentInChildren <Text>(); answer2Text = answer2.GetComponentInChildren <Text>(); answer3Text = answer3.GetComponentInChildren <Text>(); answer4Text = answer4.GetComponentInChildren <Text>(); answer1Image = answer1.GetComponentInChildren <Image>(); answer2Image = answer2.GetComponentInChildren <Image>(); answer3Image = answer3.GetComponentInChildren <Image>(); answer4Image = answer4.GetComponentInChildren <Image>(); answer1FadeMe = answer1.GetComponentInChildren <FadeMe>(); answer2FadeMe = answer2.GetComponentInChildren <FadeMe>(); answer3FadeMe = answer3.GetComponentInChildren <FadeMe>(); answer4FadeMe = answer4.GetComponentInChildren <FadeMe>(); answer1Question = answer1.GetComponent <AnswerQuestion>(); answer2Question = answer2.GetComponent <AnswerQuestion>(); answer3Question = answer3.GetComponent <AnswerQuestion>(); answer4Question = answer4.GetComponent <AnswerQuestion>(); // cache score, challenge name panels scorePanelText = ScorePanel.GetComponentInChildren <Text>(); scorePanelAnimator = ScorePanel.GetComponentInChildren <Animator>(); challengeNamePanelText = ChallengeNamePanel.GetComponentInChildren <Text>(); pointsTextAnimation = pointstext.GetComponent <Animation>(); if (GameControl.instance.isRandomized) { indicies = SeqUpTo(CSVreader.instance.grid.GetLength(1)).OrderBy(x => random.Next()).ToArray(); } else { indicies = SeqUpTo(CSVreader.instance.grid.GetLength(1)).ToArray(); } // cache game particles smallStarParticles = summaryfx.transform.Find("Small Stars").GetComponent <ParticleSystem>(); blobParticles = summaryfx.transform.Find("Blobs").GetComponent <ParticleSystem>(); faceHappyParticles = summaryfx.transform.Find("Face_happy").GetComponent <ParticleSystem>(); faceNeutralParticles = summaryfx.transform.Find("Face_neutral").GetComponent <ParticleSystem>(); faceSadParticles = summaryfx.transform.Find("Face_sad").GetComponent <ParticleSystem>(); tooSlowParticles = tooslowfx.GetComponentInChildren <ParticleSystem>(); rightAnswerParticles = rightfx.GetComponentInChildren <ParticleSystem>(); wrongAnswerParticles = wrongfx.GetComponentInChildren <ParticleSystem>(); // start countdown CountdowntoStart(); }