//constructor public Question(Form form, Form bigMessageBox, GlobalStore gs, GlobalStore specialDataStore, QuestionManager qm) { this.form = form; this.bigMessageBox = bigMessageBox; this.PageSeen = false; this.gs= gs; this.specialDataStore = specialDataStore; this.qm = qm; processedData = null; }
//constructor public QuestionTextDate(Form form, Form bigMessageBox, GlobalStore gs, GlobalStore specialDataStore, QuestionManager qm) : base(form, bigMessageBox, gs, specialDataStore, qm) { //mapping from month as int to month as string monthMap = new Dictionary<string, int>(); for (int i = 0; i <= 12; i++) { monthMap.Add(months[i], i); } }
void Awake() { questionManager = GameObject.FindGameObjectWithTag("QuestionManager").GetComponent <QuestionManager>(); if (!questionManager.GetCurrentSubject().Equals("")) { subjectList.Add(questionManager.GetCurrentSubject()); } else { string[] subjects = { "francais", "anglais", "maths", "histoire", "geographie" }; subjectList.AddRange(subjects); } }
public async Task <ActionResult> Delete(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Question question = QuestionManager.GetById(id.Value); if (question == null) { return(HttpNotFound()); } return(View(question)); }
void RPC_LoadQuestion(int ID, int[] order, bool multiple) { Question question = QuestionManager.GetQuestion(ID, multiple); List <string> answers = new List <string>(); if (multiple) { answers.Add(question.correctAnswer); answers.Add(question.incorrectAnswer1); answers.Add(question.incorrectAnswer2); answers.Add(question.incorrectAnswer3); } else { answers.Add(question.correctAnswer); answers.Add(question.falseAnswer); } currentCorrectAnswerID = order[0]; UIManager.SetQuestionText(question.question); if (Player.Me) { //Debug.Log($"{Player.Me.Username} cont?: {Player.Me.IsDead}"); if (!Player.Me.IsDead) { Debug.Log("Showing the screen"); UIManager.ShowNextRoundScreen(question.question, 3f); } } else { Debug.Log("Showing the screen"); UIManager.ShowNextRoundScreen(question.question, 3f); } string[] finalAnswers = new string[answers.Count]; for (int i = 0; i < order.Length; i++) { finalAnswers[order[i]] = answers[i]; //answerOptions[order[i]].text = answers[i]; } FindObjectOfType <AnswersManager>().SetAnswers(finalAnswers, order); }
public void InsertTest() { List <Question> questions = QuestionManager.Load(); Question ques = questions.FirstOrDefault(q => q.Text == "What color is #DFFF52"); Activation activation = new Activation(); activation.Id = Guid.NewGuid(); activation.QuestionId = ques.Id; activation.StartDate = DateTime.Now; activation.EndDate = DateTime.Now; activation.ActivationCode = "eeeee"; int results = ActivationManager.Insert(activation, true); Assert.IsTrue(results > 0); }
public IHttpActionResult DeleteQuestion([FromBody] QuestionDTO RequestQuestion) { QuestionManager questionM = new QuestionManager(); if (questionM.ExistingQuestion(RequestQuestion.QuestionString) == true) { Question q = questionM.GetQuestion(RequestQuestion.QuestionString); questionM.DeleteQuestion(q); return(Ok("Successful")); } else { return(Content(HttpStatusCode.Conflict, "Question not in database.")); } }
public IHttpActionResult AddQuestion([FromBody] QuestionDTO Request) { QuestionManager questionM = new QuestionManager(); bool isExist = questionM.ExistingQuestion(Request.QuestionString); if (isExist == false) { questionM.CreateQuestion(Request.QuestionString); return(Ok("Succesfully Added")); } else { return(Content(HttpStatusCode.Conflict, "Question already exists")); } }
private void PopulateListBoxQuestion() { questionManager = new QuestionManager(); Questions = questionManager.GetAllQuestions().ToArray(); if (Questions.Length > 0) { listBoxQuestions.SelectedIndex = 0; } QuestionsView = CollectionViewSource.GetDefaultView(Questions); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(QuestionsView))); SubscribeCheckBoxEvents(); }
// Update is called once per frame void Update() { if (question.IsAnswered && curQuestion < numberOfQuestions - 1) { activeQuestion(curQuestion, false); curQuestion++; activeQuestion(curQuestion, true); question = getQuestion(curQuestion); } else if (question.IsAnswered && curQuestion == numberOfQuestions - 1) // is the last question { activeQuestion(curQuestion, false); transform.Find("gameover").gameObject.SetActive(true); } }
/************************************************************************************** * Public Constructor * **************************************************************************************/ /// <summary>Public constructor.</summary> public QuestionManager() { if (instance != null) { throw new System.Exception("Cannot create a new instance of QuestionManager because there's one"); } else { instance = this; oldQuestions = new List <QuestionKeeper>(); questionBuffer = new QuestionKeeper(); } }
private void Awake() { QuestionManager.QuestionSet questionSet; clearSetButton?.onClick.AddListener(() => { PromptClearCurrent(); }); removeSetButton?.onClick.AddListener(PromptRemoveCurrent); questionSetDropdown.onValueChanged.AddListener(OnDropDownChanged); setNameButton.onClick.AddListener(PromptNameChange); saveButton?.onClick.AddListener(SaveCurrent); sceneButtonHandler.OnSceneChanged = SaveCurrent; UpdateDropdown(); questionSet = QuestionManager.GetSet(QuestionManager.GetAllSetNames()[0]); SetCurrent(questionSet, 0); }
// Use this for initialization void Start() { Debug.Log("Chay start statusdialogscript"); backButtonSelectable = backButton.GetComponent <Selectable> (); applyButtonSelectable = applyButton.GetComponent <Selectable> (); cancelButtonSelectable = cancelButton.GetComponent <Selectable> (); addHpButtonSelectable = addHpButton.GetComponent <Selectable>(); addAtkButtonSelectable = addAtkButton.GetComponent <Selectable>(); addDefButtonSelectable = addDefButton.GetComponent <Selectable>(); addAgiButtonSelectable = addAgiButton.GetComponent <Selectable>(); addLukButtonSelectable = addLukButton.GetComponent <Selectable>(); questionManagerScript = questionManager.GetComponent <QuestionManager> (); applyButtonSelectable.interactable = false; }
// Use this for initialization void Start() { // Debug.Log ("VI TRI HIEN TAI CUA THANH THOI GIAN: " + timeBarTransform.position); questionFadeScript = questionPanel.GetComponent <QuestionFadeScript>(); monsterFadeScript = monsterPanel.GetComponent <MonsterFadeScript>(); playerHealthBarScript = playerHealthBar.GetComponent <PlayerHealthBar> (); questionManagerScript = quesManager.GetComponent <QuestionManager>(); statusDialogScript = statusDialog.GetComponent <StatusDialogScript> (); buttonControllerScript = buttonController.GetComponent <ButtonController> (); cachedY = timeBarTransform.position.y; maxXValue = timeBarTransform.position.x; minXValue = timeBarTransform.position.x - timeBarTransform.rect.width; currentTime = maxTime; oldPos = timeBarTransform.position; }
public void Get_Questions_Returns_AllQuestions() { // Arrange InitQuestions(repository); var questionManager = new QuestionManager(null, repository.Object); //// Act var pagedQuestions = questionManager.GetAll(page: 1, pageSize: 3); //// Assert Assert.IsNotNull(pagedQuestions, "Result is null"); Assert.IsInstanceOfType(pagedQuestions, typeof(PagedEntity <Question>), "Wrong Model"); Assert.AreEqual(4, pagedQuestions.TotalRecords, "Wrong number of record count"); Assert.AreEqual(4, pagedQuestions.PagedData.Count, "Got wrong number of Questions"); }
/// <summary> /// Edits an existing question /// </summary> /// <param name="questionViewModel">The edited question</param> public void EditQuestion(QuestionViewModel questionViewModel) { try { if (questionViewModel != null) { Question question = ObjectMapper.Map <QuestionViewModel, Model.Entities.Question>(questionViewModel); QuestionManager.Update(question); } } catch (Exception ex) { ExceptionManager.HandleException(ex, PolicyNameType.ExceptionReplacing); } }
private bool CheckNoWhereField(OleDbConnection connection) { var reader = ADOSQLHelper.ExecuteReader(connection, LocationFields == null? string.Format("Select {0} from {1}", CheckFieldName, TableName) :string.Format("Select {0},{1} from {2}", CheckFieldName, string.Join(",", LocationFields), TableName) ); if (reader != null) { var temp = new List <string>(); var str = string.Empty; var info = string.Empty; while (reader.Read()) { str = string.Format("{0}:{1}", CheckFieldName, reader[0].ToString()); if (temp.Contains(str)) { info = string.Format("{0} 存在重复", str); Messages.Add(info); _questions.Add( new Question { Code = Code, Name = Name, Project = CheckProject.属性正确性, TableName = TableName, BSM = CheckFieldName, Description = info, RelationClassName = RelationName, ShowType = ShowType.Space, WhereClause = LocationFields == null ? string.Empty : ADOSQLHelper.GetWhereClause(LocationFields, ADOSQLHelper.GetValues(reader, 1, LocationFields.Length)) }); } else { temp.Add(str); } } QuestionManager.AddRange(_questions); return(true); } return(false); }
/// <summary> /// Edit questions /// </summary> /// <param name="id">Id</param> /// <returns></returns> public ActionResult EditQuestion(string actId) { int actualId = Int32.Parse(actId); //Get the actual question var model = QuestionManager.GetQuestion(actualId); if (model.UserId == WebSecurity.CurrentUserId) { return(View(model)); } //If the user not eligble to edit the question, we returns to home page else { return(RedirectToAction("Index", "Home")); } }
protected void But_Search_Click(object sender, EventArgs e) { string strWhere = "categoryID='" + DropDownList_Category.SelectedValue + "'"; BLL.QuestionManager questionManager = new QuestionManager(); DataSet ds = questionManager.GetList(strWhere); if (ds.Tables[0].Rows.Count > 0) { GridView3.DataSource = ds; GridView3.DataBind(); GridView1.Visible = false; GridView3.Visible = true; Btn_All.Visible = true; } }
public IHttpActionResult AddQuestion(QuestionDTO question) { try { if (BL.QuestionManager.IsExist(question.Question_userId, question.QuestionTitle)) { return(BadRequest("this question been already")); } QuestionManager.AddQuestion(question); return(Ok()); } catch (Exception e) { return(BadRequest("system error" + e)); } }
private bool CheckNoWhere(OleDbConnection connection) { var reader = ADOSQLHelper.ExecuteReader(connection, LocationFields == null ? string.Format("select {0},{1} from {2}", CheckFieldName, Key, TableName) : string.Format("select {0},{1},{2} from {3}", CheckFieldName, Key, string.Join(",", LocationFields), TableName) ); if (reader != null) { var str = string.Empty; var error = string.Empty; Messages = new List <string>(); while (reader.Read()) { str = reader[0].ToString().Trim(); if (Values.Contains(str)) { continue; } else { error = string.Format("{0}对应的‘{1}’值不正确", reader[1].ToString(), str); Messages.Add(error); _questions.Add( new Question() { Code = "3201", Name = Name, Project = CheckProject.值符合性, TableName = TableName, BSM = reader[1].ToString(), Description = error, ShowType = ShowType.Space, RelationClassName = RelationName, WhereClause = LocationFields == null ? string.Format("[{0}] ='{1}'", Key, reader[1].ToString()) : ADOSQLHelper.GetWhereClause(LocationFields, ADOSQLHelper.GetValues(reader, 2, LocationFields.Length)) }); } } QuestionManager.AddRange(_questions); return(true); } return(false); }
/// <summary> /// Shows the asked questions by a user /// </summary> /// <param name="id">User id</param> /// <param name="askedquestionpage">Asked questions page number</param> /// <param name="answeredquestionpage">Answered questions page number</param> /// <returns></returns> public ActionResult GetAskedQuestionsByUser(int id, int askedquestionpage, int answeredquestionpage) { //Get the questions for the actual page int totalquestions; var retrievedQuestions = QuestionManager.AllQuestionToOneUserToPagedList(id, askedquestionpage, 10, out totalquestions); //Convert it to a StaticPagedList for the pager var actualQuestions = new StaticPagedList <Question>(retrievedQuestions, askedquestionpage, 10, totalquestions); var questionIndexModels = MyHelpers.ToQuestionIndexModel(actualQuestions); ViewBag.QuestionsForPager = actualQuestions; ViewBag.AskedQuestionPage = askedquestionpage; ViewBag.AnsweredQuestionPage = answeredquestionpage; ViewBag.UserId = id; return(PartialView("_ShowAskedQuestions", questionIndexModels)); }
public QuestionManagerTest() { questionResponse = new QuestionResponseModel { DifficultyLevelId = "ce705f44-07e0-45c6-b51d-3b1af6256848", ShuffleOptions = true, ScoreValue = 10, SubjectId = "f4eb2f0a-ef7f-4d16-abc2-dfabf6b660c0", QuestionType = "", Text = "Test Question", Id = "ce705f44-07e0-45c6-b51d-3b1af6256848", Options = new List <QuestionOption> { new QuestionOption { IsAnswer = true, Text = "Option text" }, new QuestionOption { IsAnswer = true, Text = "Option text" } }, DifficultyLevel = "Easy", Subject = "Mathematics", }; _questionRepoMock = new Mock <IQuestionRepository>(MockBehavior.Strict); _questionValidator = new Mock <IQuestionValidator>(MockBehavior.Strict); validatorMessage = "Is Valid"; _questionValidator.Setup(u => u.ValidateNumberOfOptions(It.IsAny <QuestionRequestModel>(), out validatorMessage)) .Returns(true); _questionValidator.Setup(u => u.ValidateQuestion(It.IsAny <QuestionRequestModel>(), out validatorMessage)) .Returns(true); _questionValidator.Setup(u => u.ValidateQuestionOptions(It.IsAny <QuestionRequestModel>(), out validatorMessage)) .Returns(true); _questionValidator.Setup(u => u.ValidateQuestionType(It.IsAny <QuestionRequestModel>(), out validatorMessage)) .Returns(true); _questionRepoMock.Setup(u => u.GetQuestionAsync(questionResponse.Id)) .Returns(Task.FromResult(questionResponse)); _questionManager = new QuestionManager(_questionRepoMock.Object, _questionValidator.Object); }
private Session CreatePaymentSession(string transactionid, string questionId, string subID, string SubChapID, string exerciseId, string isPastPaper, string variant) { var StripeSecretkey = ConfigurationManager.AppSettings["StripeSecretkey"].ToString(); StripeConfiguration.ApiKey = StripeSecretkey; QuestionManager questionManager = new QuestionManager(); var question = questionManager.GetQuestionByID(int.Parse(questionId)); var successUrl = ""; if (isPastPaper != null && isPastPaper == "1") { TempData["paymentTransactionId"] = transactionid; successUrl = string.Format("{0}/Home/ChapterQuestions?sub={1}&questionYearId={2}&variant={3}&scfp=true", GetBaseUrl(), subID, questionId, variant); } else { successUrl = string.Format("{0}/Home/ShowVideo?SubChapID={1}&questionId={2}&exerciseId={3}&transactionid={4}", GetBaseUrl(), SubChapID, questionId, exerciseId, transactionid); } successUrl += "&session_id={ CHECKOUT_SESSION_ID}"; var options = new SessionCreateOptions { PaymentMethodTypes = new List <string> { "card", }, LineItems = new List <SessionLineItemOptions> { new SessionLineItemOptions { Name = "Year: " + question.PaperYear, Description = "Student Care Solutions Questions", Amount = 100, Currency = "usd", Quantity = 1, }, }, SuccessUrl = successUrl,// "https://example.com/success?session_id={CHECKOUT_SESSION_ID}", CancelUrl = string.Format("{0}/Home/Index", GetBaseUrl()), }; var service = new SessionService(); Session session = service.Create(options); return(session); }
private void OnDropDownChanged(int newIndex) { QuestionManager.QuestionSet questionSet; if (questionSetDropdown.value >= questionSetDropdown.options.Count - 1) { // Picked the last option. questionSet = AddSet(); UpdateDropdown(); SetCurrent(questionSet, questionSetDropdown.options.Count - 2); } else { questionSet = QuestionManager.GetSet(QuestionManager.GetAllSetNames()[questionSetDropdown.value]); SetCurrent(questionSet, questionSetDropdown.value); } }
public bool checkIfQuestion() { Question q = Board.GetStepFromIndex(Startingstep).Question; if (q != null) { // TODO: get question window ready QuestionManager qm = questionWindow.GetComponent <QuestionManager>(); qm.SetQuestion(q); qm.questionText.GetComponent <TextMeshProUGUI>().text = qm.Question.question; questionWindow.SetActive(true); Dice.isRolling = true; return(true); } return(false); }
/// <summary> /// Start is callled at the very beginning, to intialize all required parameters and setup the first quesiton. /// </summary> private void Start() { // Color Setup originalColor = background.color; // Player Information player = GameSetUp.GS.player; playerIndex = GameSetUp.GS.playerIndex; PV = player.GetComponent <PlayerController>().PV; // Setup Question Manager; QM = GameObject.FindWithTag("GameController").GetComponent <QuestionManager>(); timeLimit = QM.getTimeLimit(); // setup first question setupNewQuestion(); }
/// <summary> /// Shows the answered questions by a user /// </summary> /// <param name="id">User id</param> /// <param name="askedquestionpage">Asked questions page number</param> /// <param name="answeredquestionpage">Answered questions page number</param> public ActionResult GetAnsweredQuestionsByUser(int id, int askedquestionpage, int answeredquestionpage) { //Get the questions for the actual page int totalquestions; var retrievedQuestions = QuestionManager.AnsweredQuestionsToPagedList(id, answeredquestionpage, 5, out totalquestions); //Convert it to a StaticPagedList for the pager var actualQuestions = new StaticPagedList <Question>(retrievedQuestions, answeredquestionpage, 5, totalquestions); var model = MyHelpers.ToGetQuestionModels(actualQuestions, id); ViewBag.QuestionsForPager = actualQuestions; ViewBag.AskedQuestionPage = askedquestionpage; ViewBag.AnsweredQuestionPage = answeredquestionpage; ViewBag.UserId = id; return(PartialView("_ShowAnsweredQuestions", model)); }
public static void CheckCoordinate(string className, string ruleName) { var info = string.Empty; var featureClass = ParameterManager.Workspace.GetFeatureClass(className); if (featureClass != null)//本工具只对存在的要素类进行坐标系核对,不存在不做坐标系核对操作 { var spatialReference = SpatialReferenceManager.GetSpatialReference(featureClass); if (spatialReference.Name.Trim() != ParameterManager.CurrentSpatialReference.Name.Trim()) { info = string.Format("图层:{0}不符合2201(平面坐标系是否采用‘1980 西安坐标系’、3度带、带带号,检查高程系统是否采用‘1985 国家高程基准’,检查投影方式是否采用高斯-克吕格投影)", className); QuestionManager.Add(new Question { Code = "2201", Name = ruleName, Project = CheckProject.数学基础, TableName = className, Description = info }); } } }
public void ComputeScore() { QuestionManager questionManagement = FindObjectOfType <QuestionManager>(); questionManagement.QuestionHide(); for (int i = 0; i < 12; i++) { Destroy(GameObject.Find("input" + i)); } for (int i = 0; i < 12; i++) { Destroy(GameObject.Find("output" + i)); } onResult.Invoke(correctAnswers, timeLeft); correctAnswers = 0; }
// Start is called before the first frame update void Start() { question = new Question(); parseText(questionIndex); question.hint = hint; playerControl = GameObject.Find("Player").GetComponent <PlayerController>(); questionManager = GameObject.Find("QuestionManager").GetComponent <QuestionManager>(); myAnimator = GetComponentInChildren <Animator>(); questionRange = gameObject.AddComponent(typeof(CircleCollider2D)) as CircleCollider2D; questionRange.radius = AssertionRange; questionRange.isTrigger = true; textQuestion = questionManager.dialogQuestion; textAnswer = questionManager.dialogAnswers; }
void Awake() { //Our singleton pattern if (instance != null && instance != this) { // destroy the gameobject if an instance of this exist already Destroy(gameObject); } else { //Set our instance to this object/instance instance = this; } generator = GetComponent <MathGenerator>(); questionGO.SetActive(false); }
// Use this for initialization void Start() { buttonText = new Text[4]; playerAttacks = GameObject.Find ("PlayerAttacks"); lightBeam = GameObject.Find ("LightBeam"); combo = GameObject.Find("Combo"); hpGuage = GameObject.Find("HpGuage"); panel = GameObject.Find("Panel"); startButton = GameObject.Find("StartButton"); startButton.SetActive(false); myPv = this.GetComponent<PhotonView>(); GameManager.instance.Score = 0; rtChargeGuage = playerAttacks.transform.GetChild (0).GetComponent<RectTransform> (); playerAttacks.SetActive(false); lightBeam.SetActive (false); questionManager = this.GetComponent<QuestionManager> (); questionManager.LoadQuestion (GameManager.instance.SelectLevel); questionText = GameObject.Find ("QuestionText").GetComponent<Text> (); questionText.text = "みんなの じゅんびが\nできるまで まってね"; answerText1 = GameObject.Find ("AnswerText1").GetComponent<Text> (); answerText2 = GameObject.Find ("AnswerText2").GetComponent<Text> (); answerText3 = GameObject.Find ("AnswerText3").GetComponent<Text> (); answerText4 = GameObject.Find ("AnswerText4").GetComponent<Text> (); answerButtons = new Button[4]; answerButtons [0] = GameObject.Find ("AnswerButton1").GetComponent<Button> (); answerButtons [1] = GameObject.Find ("AnswerButton2").GetComponent<Button> (); answerButtons [2] = GameObject.Find ("AnswerButton3").GetComponent<Button> (); answerButtons [3] = GameObject.Find ("AnswerButton4").GetComponent<Button> (); BUTTON_DEFAULT_COLOR = new Color (255.0f/255, 190.0f/255, 120.0f/255); foreach (Button button in answerButtons) { button.gameObject.SetActive(false); } questionIndex = 1; answerNum = -1; remainTurn = 10; remainTime = 10.0f; isAnswering = false; difficulty = GameManager.instance.difficulty; difficultyText = GameObject.Find ("DifficultyText").GetComponent<Text>(); switch (difficulty) { case 1: difficultyText.text = "レベル\nかんたん"; break; case 2: difficultyText.text = "レベル\nふつう"; break; case 3: difficultyText.text = "レベル\nむずかしい"; break; default: difficultyText.text = "レベル\nかんたん"; break; } turnText = GameObject.Find ("TurnText").GetComponent<Text> (); turnText.text = "のこり10ターン"; timeText = GameObject.Find ("TimeText").GetComponent<Text> (); timeText.text = "のこり10びょう"; joinedPlayers = GameObject.Find ("JoinedPlayers"); joinedPlayerObjectList = new List<GameObject> (); for (int i = 0; i < joinedPlayers.transform.childCount; i++) { GameObject targetObject = joinedPlayers.transform.GetChild (i).gameObject; joinedPlayerObjectList.Add (targetObject); targetObject.transform.GetChild(0).gameObject.SetActive(false); targetObject.SetActive(false); } GameManager.instance.Score = 0; enemyImage = GameObject.Find ("Enemy").GetComponent<Image>(); enemyImage.sprite = enemySprites [GameManager.instance.SelectLevel]; }
//constructor public QuestionRadioDynamicLabel(Form form, Form bigMessageBox, GlobalStore gs, GlobalStore specialDataStore, QuestionManager qm) : base(form, bigMessageBox, gs, specialDataStore, qm) { }
//constructor public QuestionSelect(Form form, Form bigMessageBox, GlobalStore gs, GlobalStore specialDataStore, QuestionManager qm) : base(form, bigMessageBox, gs, specialDataStore, qm) { //init the optionslist optionList = new List<Option>(); }
//constructor public QuestionTextOneCheck(Form form, Form bigMessageBox, GlobalStore gs, GlobalStore specialDataStore, QuestionManager qm) : base(form, bigMessageBox, gs, specialDataStore, qm) { }