private void NextQuestion() { if (answered >= 10 - 1) { Question.Text = "Вы справились с темой!"; /*Answer1.Text = "Ответ 1"; * Answer2.Text = "Ответ 2"; * Answer3.Text = "Ответ 3"; * Answer4.Text = "Ответ 4";*/ Answer1.Hide(); Answer2.Hide(); Answer3.Hide(); Answer4.Hide(); button2.Hide(); ClearRecord(); return; } answered++; GetQuestion(cur_theme - 1); if (cur_theme != 0 && (cur_question != null && cur_isAnswered == true)) { Question.Text = cur_question; cur_isAnswered = false; } }
protected void UserIDCode_Or_BillingCode_TextChanged(object sender, EventArgs e) { var provider = Master.DataProvider; var user = new BRBUser { UserCode = UserIDCode.Text, BillingCode = BillingCode.Text }; if (provider.GetUserProfile(ref user)) { Master.UpdateSession(user); EnableInputFields(); if (string.IsNullOrEmpty(Master.User.Question1) || string.IsNullOrEmpty(Master.User.Question2)) { Master.ShowErrorModal("Your profile does not have security questions assigned. Please contact the system administrator.", "Profile Error", 250); return; } Quest1.Text = Master.User.Question1; Quest2.Text = Master.User.Question2; Answer1.Focus(); } else { EnableInputFields(); Master.ShowErrorModal("Error: Invalid User ID or Billing Code.", "Reset Password"); } }
private void New_question_withanswer_click(object sender, RoutedEventArgs e) { Question.Clear(); Answer1.Clear(); Answer2.Clear(); Answer3.Clear(); Answer4.Clear(); }
private bool IsValid() { if (For == Guid.Empty || Statement.IsNullOrWhiteSpace() || Answer1.IsNullOrWhiteSpace() || Answer2.IsNullOrWhiteSpace() || Answer3.IsNullOrWhiteSpace() || CorrectAnswer.IsNullOrWhiteSpace()) { return(false); } return(true); }
private void Test_diff_color_Load(object sender, EventArgs e) { label2.Hide(); Answer1.Hide(); Answer2.Hide(); Answer3.Hide(); Answer4.Hide(); button1.Hide(); richTextBox1.Hide(); timer1.Tick += timer1_Tick; timer1.Start(); }
public Training() { InitializeComponent(); Answer1.Hide(); Answer2.Hide(); Answer3.Hide(); Answer4.Hide(); button2.Hide(); Question.Text = ""; }
public void hide() { label1.Hide(); Red_test.Hide(); Blue_test.Hide(); Green_test.Hide(); label2.Show(); Answer1.Show(); Answer2.Show(); Answer3.Show(); Answer4.Show(); button1.Show(); richTextBox1.Show(); }
public string Sum(ComplexNum complexNum1, ComplexNum complexNum2) { if (IChecker() == 0) { Answer = complexNum1.Real + complexNum2.Real; Answer1 = complexNum1.Fake + complexNum2.Fake; SAnswer = Answer.ToString() + " + " + Answer1.ToString() + "i"; return(SAnswer); } else { Answer = (complexNum1.Real + complexNum2.Real) + (complexNum1.Fake + complexNum2.Fake) * I; return(Answer.ToString()); } }
static void Main(string[] args) { string Answer1; Course SaveCourse; Answer1 = Question.AskForString("create a new course? :"); while (Answer1.ToLower().StartsWith("y")) { Course _course = new Course(); _course.CourseCreation(); _course.CreationOfStudent(); SaveCourse = _course; Answer1 = Question.AskForString("do you whant to create a new course or fix a mistake?"); } System.Console.WriteLine("press any key"); System.Console.ReadKey(); }
public override bool Equals(object obj) { var response = obj as Response; if (response != null) { return(ResponseID.ToString().Equals(response.ResponseID.ToString(), StringComparison.Ordinal) && RespondentID.Equals(response.RespondentID) && SurveyDate.Equals(response.SurveyDate) && Answer1.Equals(response.Answer1) && Answer2.Equals(response.Answer2) && Answer3.Equals(response.Answer3) && Answer4.Equals(response.Answer4) && Answer5.Equals(response.Answer5) && Answer6.Equals(response.Answer6)); } return(false); }
public string Multiplication(ComplexNum complexNum1, ComplexNum complexNum2) { if (IChecker() == 0) { int Answer1 = complexNum1.Real * complexNum2.Real; int Answer2 = complexNum1.Real * complexNum2.Fake + complexNum1.Fake * complexNum2.Real; Answer = complexNum1.Fake * complexNum2.Fake * -1; SAnswer = Answer1.ToString() + " + " + Answer2.ToString() + "i" + " + " + Answer.ToString(); return(SAnswer); } if (IChecker() == -1) { Answer1 = complexNum1.Real * complexNum2.Real; int Answer2 = complexNum1.Real * complexNum2.Fake + complexNum1.Fake * complexNum2.Real; Answer = complexNum1.Fake * complexNum2.Fake; SAnswer = Answer1.ToString() + " + " + Answer2.ToString() + "i^2" + " + " + Answer.ToString(); return(SAnswer); } return(SAnswer); }
// Use this for initialization void Start() { ans = gameObject.AddComponent <Answer1>(); time = timer.GetComponent <Timer>(); for (a = 0; a < 3; a++) { for (b = 0; b < 3; b++) { var aaa = Instantiate(panel); aaa.transform.position = new Vector3(a * 10 - 55, b * 10 - 30, 82); panels [a, b] = aaa; pk [a, b] = aaa.GetComponent <panel_kaiten> (); pk [a, b].x = a; pk [a, b].y = b; States [a, b] = false; //Debug.Log (States [0, 0]); } } }
public async Task <bool> HandleAsync(Answer1 e, CancellationToken ct) { return(true); }
public bool VerifyAnswers(string answer1, string answer2) { return(Answer1.Trim().ToLower() == answer1.Trim().ToLower() && Answer2.Trim().ToLower() == answer2.Trim().ToLower()); }
public void NavigationImmediatelyLoadTest() { Question1 question; Guid answerID; // 添加数据记录 using (var repo = RepositoryContext.GetRepository()) { question = new Question1() {Name = "question1123", CreatedOn = DateTime.Now, UpdatedOn = DateTime.Now}; var addAnswer1 = new Answer1() { Name = "answer1", CreatedOn = DateTime.Now, UpdatedOn = DateTime.Now, Question = question }; var addAnswer2 = new Answer1() { Name = "answer2", CreatedOn = DateTime.Now, UpdatedOn = DateTime.Now, Question = question }; answerID = addAnswer1.ID; question.Answers.Add(addAnswer1); question.Answers.Add(addAnswer2); repo.Add(question); repo.SaveChanges(); } // 由Question到Answer using (var repo = RepositoryContext.GetRepository()) { // SELECT * FROM [Question] question0_ WHERE question0_.ID = '806B63F5-6B89-47E8-B47B-E05DC6B67AF3'; // SELECT answers0_.Question_ID as Question8_1_, * FROM [Answer] answers0_ WHERE answers0_.Question_ID = '806B63F5-6B89-47E8-B47B-E05DC6B67AF3'; var testQuestion = repo.GetByID<Question1>(question.ID); // 导航属性SQL测试 // SELECT * FROM [Answer] this_ WHERE this_.Question_ID = '806B63F5-6B89-47E8-B47B-E05DC6B67AF3'; var answer = repo.GetAll<Answer1>(p => p.Question_ID == testQuestion.Answers.FirstOrDefault().Question.ID); // 单元测试插入了两条answer数据 Assert.AreEqual(answer[0].Question_ID, testQuestion.ID); Assert.AreEqual(answer[1].Question_ID, testQuestion.ID); } // 由Answer到Question using (var repo = RepositoryContext.GetRepository()) { // SELECT * FROM [Answer] answer0_ WHERE answer0_.ID='304438EC-30E1-4172-BA5B-25DF2F4D3019'; // SELECT * FROM [Question] this_ WHERE this_.ID = '3EA33462-6E2F-4CF5-BD40-7B479010B572'; var testAnswer = repo.GetByID<Answer1>(answerID); // 导航属性SQL测试 // SELECT answers0_.Question_ID as Question8_1_, * FROM [Answer] answers0_ WHERE answers0_.Question_ID='3EA33462-6E2F-4CF5-BD40-7B479010B572'; var testQuestion = repo.GetAll<Question1>(p => p.ID == testAnswer.Question.ID); Assert.AreEqual(testQuestion[0].ID, testAnswer.Question_ID); } }
// get (Number of theme - 1) // return Number of question // or -1 if question list is empty private void GetQuestion(int theme) { string questNodeName = ""; switch (theme) { case 0: questNodeName = "cycles"; break; case 1: questNodeName = "arrays"; break; case 2: questNodeName = "lines"; break; case 3: questNodeName = "recursion"; break; case 4: questNodeName = "struct"; break; case 5: questNodeName = "file"; break; case 6: questNodeName = "addresses_and_pointers"; break; case 7: questNodeName = "dynamic_memory"; break; default: return; } if (amount == 0) { for (int i = 0; i < MAX_QUESTIONS_TRAIN; i++) { isOpened[i] = -1; } } XmlDocument doc = new XmlDocument(); doc.Load("testing.xml"); XmlNode rootNode = doc.DocumentElement; // <testing> foreach (XmlNode themeNode in rootNode) { if (themeNode.Name == questNodeName) { Random rnd = new Random(); int question = rnd.Next() % themeNode.ChildNodes.Count; bool exit = false; while (!exit) { int i; for (i = 0; i < amount; i++) { if (isOpened[i] == question) { question = rnd.Next() % themeNode.ChildNodes.Count; break; } } if (i == amount) { exit = true; } } isOpened[amount] = question; amount++; foreach (XmlNode questionNode in themeNode.ChildNodes[question]) { if (questionNode.Name == "quest") { cur_question = questionNode.InnerText; } else if (questionNode.Name == "true") { cur_answer = questionNode.InnerText; } else if (questionNode.Name == "answer1") { Answer1.Show(); Answer1.Text = questionNode.InnerText; } else if (questionNode.Name == "answer2") { Answer2.Show(); Answer2.Text = questionNode.InnerText; } else if (questionNode.Name == "answer3") { Answer3.Show(); Answer3.Text = questionNode.InnerText; } else if (questionNode.Name == "answer4") { Answer4.Show(); Answer4.Text = questionNode.InnerText; } } button2.Show(); } } }
public ActionResult AddQuestionnaire(QuestionnairesViewModel Model, string[] BlankOptions, string[] AnswerOptions) { try { VTSDBEntities objDB = new VTSDBEntities(); if (Model.QuestionType == DAL.Model.QuestionType.SingleLine) { Question1 question1 = new Question1(); question1.QuestionSentence = Model.QuestionText; question1.OriginalSentence = ""; List <Option1> QuesOptions = new List <Option1>(); foreach (string OptionText in BlankOptions) { Option1 EachOption = new Option1(); EachOption.OptionText = OptionText; EachOption.Question1 = question1; QuesOptions.Add(EachOption); } List <Answer1> AllAnswers = new List <Answer1>(); foreach (string AnswerText in AnswerOptions) { Answer1 EachAnswer = new Answer1(); EachAnswer.AnswerText = AnswerText; EachAnswer.Question1 = question1; AllAnswers.Add(EachAnswer); } question1.Answer1 = AllAnswers; question1.Option1 = QuesOptions; objDB.Question1.Add(question1); objDB.SaveChanges(); ViewBag.SuccessMsg = "Questionnaire added successfully."; } else if (Model.QuestionType == DAL.Model.QuestionType.MultiLine) { Question2 question2 = new Question2(); question2.QuestionText = Model.QuestionText; List <Option2> QuesOptions = new List <Option2>(); foreach (string OptionText in BlankOptions) { Option2 EachOption = new Option2(); EachOption.OptionText = OptionText; EachOption.Question2 = question2; QuesOptions.Add(EachOption); } List <Answer2> AllAnswers = new List <Answer2>(); Answer2 EachAnswer = new Answer2(); EachAnswer.Answer = Model.AnswerText; EachAnswer.Question2 = question2; AllAnswers.Add(EachAnswer); question2.Answer2 = AllAnswers; question2.Option2 = QuesOptions; objDB.Question2.Add(question2); objDB.SaveChanges(); ViewBag.SuccessMsg = "Questionnaire added successfully."; } else if (Model.QuestionType == DAL.Model.QuestionType.SingleOption) { Question3 question3 = new Question3(); question3.QuestionText = Model.QuestionText; List <Answer3> AllAnswers = new List <Answer3>(); foreach (string AnswerText in AnswerOptions) { Answer3 EachAnswer = new Answer3(); EachAnswer.Answer = AnswerText; EachAnswer.Question3 = question3; AllAnswers.Add(EachAnswer); } question3.Answer3 = AllAnswers; objDB.Question3.Add(question3); objDB.SaveChanges(); ViewBag.SuccessMsg = "Questionnaire added successfully."; } else if (Model.QuestionType == DAL.Model.QuestionType.MultiOption) { Question4 question4 = new Question4(); question4.QuestionText = Model.QuestionText; List <Answer4> AllAnswers = new List <Answer4>(); foreach (string AnswerText in AnswerOptions) { Answer4 EachAnswer = new Answer4(); EachAnswer.Answer = AnswerText; EachAnswer.Question4 = question4; AllAnswers.Add(EachAnswer); } question4.Answer4 = AllAnswers; objDB.Question4.Add(question4); objDB.SaveChanges(); ViewBag.SuccessMsg = "Questionnaire added successfully."; } else if (Model.QuestionType == DAL.Model.QuestionType.Date) { Question5 question5 = new Question5(); question5.QuestionText = Model.QuestionText; List <Answer5> AllAnswers = new List <Answer5>(); foreach (string AnswerText in AnswerOptions) { Answer5 EachAnswer = new Answer5(); EachAnswer.Answer = AnswerText; EachAnswer.Question5 = question5; AllAnswers.Add(EachAnswer); } question5.Answer5 = AllAnswers; objDB.Question5.Add(question5); objDB.SaveChanges(); ViewBag.SuccessMsg = "Questionnaire added successfully."; } } catch (System.Data.Entity.Validation.DbEntityValidationException dbEx) { Exception raise = dbEx; foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { string message = string.Format("{0}:{1}", validationErrors.Entry.Entity.ToString(), validationError.ErrorMessage); // raise a new exception nesting // the current instance as InnerException raise = new InvalidOperationException(message, raise); } } //throw raise; ViewBag.ErrorMsg = "An error occurred while saving the questionnaire."; } ModelState.Clear(); return(View()); }