protected void SaveQuestion() { App.Domain.Questions.QuestionsManager manager = new App.Domain.Questions.QuestionsManager(); App.Models.Questions.Questions question = null; if (_QuestionID > 0) { question = manager.Get(_QuestionID); } else { question = new App.Models.Questions.Questions(); } PopulateObject(question); manager.SaveOrUpdate(question); }
private void BindQuestionData(int questionID) { App.Domain.Questions.QuestionsManager manager = new App.Domain.Questions.QuestionsManager(); App.Models.Questions.Questions question = null; question = manager.Get(_QuestionID); if (question != null) { txtQuestion.Text = question.Question; txtAnswerA.Text = question.AnswerA; txtAnswerB.Text = question.AnswerB; txtAnswerC.Text = question.AnswerC; txtAnswerD.Text = question.AnswerD; txtExplanation.Text = question.Explanation; ddlCorrectAnswer.SelectedValue = question.CorrectAnswer; chkIsFunctionalTopics.Checked = question.FunctionalTopics; chkIsHistoryTheoryLaw.Checked = question.HistoryTheoryLaw; chkIsEthics.Checked = question.Ethics; chkIsPlanMaking.Checked = question.PlanMaking; chkIsPlanImplementation.Checked = question.PlanImplementation; } }
protected void BindQuestionData() { int.TryParse(Request[AppConstants.QueryString.QUESTION_ID], out _QuestionID); App.Domain.Questions.QuestionsManager manager = new App.Domain.Questions.QuestionsManager(); App.Models.Questions.Questions question = manager.Get(_QuestionID); if (question != null) { ucChart.QuestionID = question.QuestionID; ucCommenting.QuestionID = question.QuestionID; ltrQuestion.Text = question.Question; String answer = Request[AppConstants.QueryString.ANSWER]; if (String.Compare(question.CorrectAnswer, answer, true) == 0) ltrAnswer.Text = String.Format("Right, the correct answer is {0}", question.CorrectAnswer); else ltrAnswer.Text = String.Format("Wrong, the correct answer is {0}", question.CorrectAnswer); if (question.CorrectAnswer == "A") ltrAnswer.Text = String.Format("{0} ({1})", ltrAnswer.Text, question.AnswerA); else if (question.CorrectAnswer == "B") ltrAnswer.Text = String.Format("{0} ({1})", ltrAnswer.Text, question.AnswerB); else if (question.CorrectAnswer == "C") ltrAnswer.Text = String.Format("{0} ({1})", ltrAnswer.Text, question.AnswerC); else if (question.CorrectAnswer == "D") ltrAnswer.Text = String.Format("{0} ({1})", ltrAnswer.Text, question.AnswerD); ltrExplanation.Text = question.Explanation; App.Domain.Links.LinkManager linkManager = new App.Domain.Links.LinkManager(); IList<App.Models.Links.Link> links = linkManager.GetLinksForQuestion(question.QuestionID); //BuildHtmlForLinks(links); } else { ucChart.Visible = false; ucCommenting.Visible = false; } }
//private void ValidateFaceBookUser() //{ // FBConnectAuth.FBConnectAuthentication auth = new FBConnectAuth.FBConnectAuthentication(ConfigReader.FaceBookAPIKey, ConfigReader.FaceBookSecretPhrase); // if (auth.Validate() != FBConnectAuth.ValidationState.Valid) // { // // The request does not contain the details of a valid Facebook connect session - you'll probably want to throw an error here. // } // else // { // FBConnectAuth.FBConnectSession faceBookSession = auth.GetSession(); // String userId = faceBookSession.UserID; // String sessionKey = faceBookSession.SessionKey; // } //} private void SetInitialValues() { App.Domain.Questions.QuestionsManager manager = new App.Domain.Questions.QuestionsManager(); _NumberOfQuestions = manager.GetPagedList(1, int.MaxValue).Count; _LastQuestionDate = manager.LastQuestionDate().ToString(AppConstants.ValueOf.DATE_FROMAT_DISPLAY_WITH_TIME); _QuestionOfTheWeek = manager.Get(ConfigReader.QuestionOfTheWeekID); if (_QuestionOfTheWeek != null) { ViewState[QUESTION_OF_THE_WEEK_USERID] = 2; ViewState[CORRECT_ANSWER] = _QuestionOfTheWeek.CorrectAnswer; } }