• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Question类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Question的典型用法代码示例。如果您正苦于以下问题:C# Question类的具体用法?C# Question怎么用?C# Question使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Question类属于命名空间,在下文中一共展示了Question类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: InputQuestion

 public InputQuestion(int i, Question q, bool ip)
 {
     base.domain = q.Domain;
     base.id = i;
     isProgram = ip;
     t = new TextBox();
     t.TextMode = TextBoxMode.MultiLine;
     t.Rows = 4;
     base.l.Text = q.Domain + ") " + q.QuestionText;
     answer = q.Answer;
     if (q.Link.Length>0)
     {
         fh.Text = q.Link;
         fh.NavigateUrl = "~/Lectii.aspx#" + q.Link;
     }
     else
     {
         fh.Text = "Lectiile";
         fh.NavigateUrl = "~/Lectii.aspx";
     }
     if (isProgram)
     {
         t.Rows = 10;
         pcount++;
     }
     else
     {
         icount++;
     }
 }
开发者ID:vlad-,项目名称:InfoBac,代码行数:30,代码来源:InputQuestion.cs


示例2: GetQuestionaire

 public static List<Question> GetQuestionaire(int AssessmentID, int userid)
 {
     List<Question> lstQuestions = new List<Question>();
     Question Obj = new Question(1);
     lstQuestions = Obj.GetAssessmentQuestions(AssessmentID, 1);
     return lstQuestions;
 }
开发者ID:skgw,项目名称:GWHRA,代码行数:7,代码来源:MemberHRA.aspx.cs


示例3: TokenizeTheQuestion

        public void TokenizeTheQuestion(Question question)
        {
            var timezoneRegex = new StringBuilder();
            timezoneRegex.Append("(");
            var isFirstIteration = true;
            foreach (var timezone in Timezones.GetAllTimezones())
            {
                if (!isFirstIteration)
                    timezoneRegex.Append("|");
                if(timezone.TokenizeOnAbbreviation)
                    timezoneRegex.Append(String.Format("{0}|{1}", timezone.Name, timezone.Abbreviation));
                else
                    timezoneRegex.Append(timezone.Name);
                isFirstIteration = false;
            }

            timezoneRegex.Append(")");
            var matches = Regex.Matches(question.QuestionText, @"(^|\s)" + timezoneRegex.ToString() + @"(\s|$|,)", RegexOptions.IgnoreCase);
            foreach (Match match in matches)
            {
                Group group = match.Groups[0];
                var token = new TimezoneToken(group.Value, group.Index);
                question.AddToken(token);
            }
        }
开发者ID:darkosancanin,项目名称:naturaldatetime_web,代码行数:25,代码来源:TimezoneTokenizer.cs


示例4: GetNextQuestion

 public Question GetNextQuestion(Test test, Question prevQuestion, ITestLogic logic)
 {
     this.logic = logic;
     int qId = logic.GetQuestionId(test, prevQuestion, uow);
     Question q = uow.Questions.GetById(qId);
     return q;
 }
开发者ID:nemesek,项目名称:Care,代码行数:7,代码来源:QuestionGenerator.cs


示例5: GetAnswer

 public Answer GetAnswer(Question question)
 {
     var cityToken = question.GetToken<CityToken>();
     var dateToken = question.GetToken<DateToken>();
     int? year = null;
     if (dateToken != null) year = dateToken.Year;
     DaylightSavingInformation daylightSavingInfo;
     if (year.HasValue)
     {
         var firstDateInTheYear = new LocalDateTime(year.Value, 1, 1, 0, 0).InZone(DateTimeZoneProviders.Tzdb[cityToken.City.Timezone], Resolvers.LenientResolver);
         var firstZoneIntervalInTheYear = firstDateInTheYear.GetZoneInterval();
         if (firstZoneIntervalInTheYear.IsoLocalEnd.Year > 10000) {
             daylightSavingInfo = DaylightSavingInformation.CreateWithNoDaylightSavings();
         }
         else
         {
             var firstDateInTheNextZoneInterval = firstDateInTheYear.Plus(firstZoneIntervalInTheYear.Duration).Plus(Duration.FromMilliseconds(1));
             daylightSavingInfo = GetDaylightSavingInfo(firstDateInTheNextZoneInterval);
         }
     }
     else
     {
         daylightSavingInfo = GetDaylightSavingInfo(cityToken.GetCurrentTime());
     }
     var answerText = GetFormattedDaylightSavingInfo(daylightSavingInfo, cityToken.City);
     return new Answer(question, true, true, answerText);
 }
开发者ID:darkosancanin,项目名称:naturaldatetime_web,代码行数:27,代码来源:WhenDaylightSavingsStartStopInCityQuestionHandler.cs


示例6: QuestionInQuestionnaireManagementContainer

 public QuestionInQuestionnaireManagementContainer(ProgressingQuestionnaireQuestion question, Question questionLevel, Visibility showLevelHeader)
     : this()
 {
     this.QuestionnaireQuestion = question;
     this.QuestionLevel = questionLevel;
     this.ShowLevelHeader = showLevelHeader;
 }
开发者ID:Attention,项目名称:NitpickHouseV2,代码行数:7,代码来源:QuestionInQuestionnaireManagementContainer.cs


示例7: FillContents

 internal void FillContents(Question question, QuestionContents contents, QuestionData data, int idx)
 {
     Question = question;
     QuestionContents = contents;
     QuestionData = data;
     Index = idx;
 }
开发者ID:lancelebanoff,项目名称:cognistudy_web,代码行数:7,代码来源:QuestionBlock.ascx.cs


示例8: Insert

 ///<summary>Inserts one Question into the database.  Returns the new priKey.</summary>
 internal static long Insert(Question question)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         question.QuestionNum=DbHelper.GetNextOracleKey("question","QuestionNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(question,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     question.QuestionNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(question,false);
     }
 }
开发者ID:nampn,项目名称:ODental,代码行数:26,代码来源:QuestionCrud.cs


示例9: GetNextQuestion

 public Question GetNextQuestion(Question prevQuestion, Answer prevAnswer)
 {
     int qId = logic.GetQuestionId(prevQuestion, prevAnswer);
     Question q = new Question();
     q.Id = qId;
     return q;
 }
开发者ID:nemesek,项目名称:Care,代码行数:7,代码来源:QuestionGenerator.cs


示例10: EditQuestion

        public void EditQuestion(Question question)
        {
            using (SqlConnection conn = CreateConnection())
            {
                try
                {
                    SqlCommand cmd = new SqlCommand("appSchema.usp_EditQuestion", conn);
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.Add("@QuestionID", SqlDbType.Int, 4).Value = question.QuestionID;
                    cmd.Parameters.Add("@Question", SqlDbType.VarChar, 100).Value = question.QuestionTitle;
                    cmd.Parameters.Add("@AnswerOption1", SqlDbType.VarChar, 50).Value = question.AnswerOption1;
                    cmd.Parameters.Add("@AnswerOption2", SqlDbType.VarChar, 50).Value = question.AnswerOption2;
                    cmd.Parameters.Add("@AnswerOption3", SqlDbType.VarChar, 50).Value = question.AnswerOption3;
                    cmd.Parameters.Add("@AnswerOption4", SqlDbType.VarChar, 50).Value = question.AnswerOption4;
                    cmd.Parameters.Add("@CorrectAnswer", SqlDbType.VarChar, 50).Value = question.CorrectAnswer;

                    conn.Open();

                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    throw new ApplicationException("An error occured in the data access layer.");
                }
            }
        }
开发者ID:je222ks,项目名称:IndividuelltMjukvaruutvecklingsprojekt,代码行数:27,代码来源:QuestionDAL.cs


示例11: deleteQuestion

        public void deleteQuestion(Question question)
        {
            logger.Debug("deleteQuestion()");

            MysqlConnector mysql = new MysqlConnector(CurrentUserInfo.USERNAME,
             CurrentUserInfo.PASSWORD,
             CurrentUserInfo.HOSTNAME,
             CurrentUserInfo.PORT,
             CurrentUserInfo.DATABASE);

            string query = "delete from question where id = " + question.Id + ";";
            string answersIDs = "";
            foreach (Answer answer in question.AnswerList)
                answersIDs += answer.Id.ToString() + ",";

            if (!String.IsNullOrEmpty(answersIDs))
                answersIDs = answersIDs.Substring(0, answersIDs.Length - 1);

            mysql.initializeConnection();
            mysql.openMysqlConnection();

            using (MySqlCommand cmd = new MySqlCommand(query, mysql.MysqlConnection))
                cmd.ExecuteNonQuery();

            query = "delete from answer where id in (" + answersIDs + ");";

            if (!String.IsNullOrEmpty(answersIDs))
                using (MySqlCommand cmd = new MySqlCommand(query, mysql.MysqlConnection))
                    cmd.ExecuteNonQuery();

            mysql.closeMysqlConnection();

            logger.Info("Question With ID " + question.Id + " Deleted");
        }
开发者ID:nmpountou,项目名称:Project154,代码行数:34,代码来源:QuestionDaoImpl.cs


示例12: Post

        public IHttpActionResult Post(JObject data)
        {
            dynamic json = data;
            var result = Captcha.Check((string)json.Captcha);

            Question question = new Question()
            {
                Author = json.Author,
                Email = json.Email,
                Message = json.Message,
                Topic = json.Topic
            };

            if (question.Author == "" || question.Email == "" || question.Message == "" || question.Topic == "")
            {
                return ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Заполните обязательные поля!"));
            }
            else
            {
                if (result == true)
                {
                    Emailer.QuestionNotificate(question);
                    return Ok("Спасибо! Ваш запрос успешно отправлен.");
                }
                else
                {
                    return ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Заполните капчу!"));
                }

            }
        }
开发者ID:ellestragoo,项目名称:new-cft,代码行数:31,代码来源:AskQuestionController.cs


示例13: Create

        public static FireAnswer Create(
            FireRiskAssessmentChecklist fireRiskAssessmentChecklist,
            Question question,
            YesNoNotApplicableEnum? yesNoNotApplicableResponse,
            string additionalInfo,
            UserForAuditing user)
        {
            var fireAnswer = new FireAnswer
                                 {
                                     FireRiskAssessmentChecklist = fireRiskAssessmentChecklist,
                                     Question = question,
                                     YesNoNotApplicableResponse = yesNoNotApplicableResponse,
                                     AdditionalInfo = additionalInfo,
                                     CreatedOn = DateTime.Now,
                                     CreatedBy = user
                                 };

            if (yesNoNotApplicableResponse == YesNoNotApplicableEnum.No)
            {
                var significantFinding = SignificantFinding.Create(fireAnswer, user);
                fireAnswer.SignificantFinding = significantFinding;
            }

            return fireAnswer;
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:25,代码来源:FireAnswer.cs


示例14: createSimpleQuiz

 public Quiz createSimpleQuiz(String question, String[] answers, int[] correctAnswers)
 {
     string tmp = question;
     string[] answ = answers;
     Question tmpQuestion = new Question();
     tmpQuestion.Value = tmp;
     tmpQuestion.ID = 0;
     tmpQuestion.Type = QuestionType.ONLY_TEXT;
     writeQuestion(tmpQuestion);
     Quiz tmpQuiz = new Quiz();
     tmpQuiz.ID = 0;
     tmpQuiz.LevelID = 0;
     tmpQuiz.QuestionID = 0;
     tmpQuiz.QuestionType = QuestionType.ONLY_TEXT;
     tmpQuiz.TipType = TipType.ONLY_TEXT;
     tmpQuiz.AnswerType = AnswerType.ONLY_TEXT;
     int tmpId = 0;
     foreach (string tmpString in answ)
     {
         tmpQuiz.Answers.Add(tmpId);
         Answer answer = new Answer(tmpId, tmpString, AnswerType.ONLY_TEXT);
         writeAnswer(answer);
         tmpId++;
     }
     foreach (int tmpC in correctAnswers)
     {
         tmpQuiz.CorrectAnswers.Add(tmpC);
     }
     writeQuiz(tmpQuiz);
     return tmpQuiz;
 }
开发者ID:Lebby,项目名称:Develia,代码行数:31,代码来源:TestQuestions.cs


示例15: UserForAuditing

        public void Given_a_existing_yes_answer_but_update_no_and_have_a_deleted_significant_finding_When_answer_updated_Then_should_set_properties_as_expected()
        {
            // Given
            var user = new UserForAuditing();
            var fireRiskAssessmentChecklist = new FireRiskAssessmentChecklist();
            var question = new Question();

            var target = FireAnswer.Create(fireRiskAssessmentChecklist, question, YesNoNotApplicableEnum.Yes, "Additional Info", user);
            target.SignificantFinding = new SignificantFinding()
                                            {
                                                Deleted = true
                                            };
            
            // When
            target.Update(YesNoNotApplicableEnum.No, "Additional Info", user);

            // Then
            Assert.That(target.SignificantFinding, Is.Not.Null);
            Assert.That(target.SignificantFinding.Deleted, Is.False);
            Assert.That(target.FireRiskAssessmentChecklist, Is.EqualTo(fireRiskAssessmentChecklist));
            Assert.That(target.YesNoNotApplicableResponse, Is.EqualTo(YesNoNotApplicableEnum.No));
            Assert.That(target.AdditionalInfo, Is.EqualTo("Additional Info"));
            Assert.That(target.LastModifiedOn.Value.ToShortDateString(), Is.EqualTo(DateTime.Now.ToShortDateString()));
            Assert.That(target.LastModifiedBy, Is.EqualTo(user));
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:25,代码来源:UpdateTests.cs


示例16: Given_employee_is_assignee_then__dont_return__task_due_in_2days

        public void Given_employee_is_assignee_then__dont_return__task_due_in_2days()
        {
            //GIVEN

            var employee = new Employee() { Id = Guid.NewGuid(), NotificationType = NotificationType.Daily };
            var furthcontrolmersuretasks = new FireRiskAssessmentFurtherControlMeasureTask() { TaskAssignedTo = employee, TaskStatus = TaskStatus.Outstanding, TaskCompletionDueDate = DateTime.Now.AddDays(2) };
            var significantFinding = new SignificantFinding() { };
            significantFinding.FurtherControlMeasureTasks.Add(furthcontrolmersuretasks);
            furthcontrolmersuretasks.SignificantFinding = significantFinding;
            var riskAssessement = FireRiskAssessment.Create("this is the title", "the ref", 1312, null, new UserForAuditing { Id = Guid.NewGuid() });

            var user = new UserForAuditing();
            var fireRiskAssessmentChecklist = riskAssessement.FireRiskAssessmentChecklists[0];
            var question = new Question();

            var fireAnswer = FireAnswer.Create(fireRiskAssessmentChecklist, question, YesNoNotApplicableEnum.No, "Additional Info", user);
            fireAnswer.SignificantFinding = significantFinding;
            significantFinding.FireAnswer = fireAnswer;

            riskAssessement.FireRiskAssessmentChecklists[0].Answers = new List<FireAnswer>() { fireAnswer };

            _fireRiskAssessments.Add(riskAssessement);

            var target =
                new GetDueFireRiskAssessmentFurtherControlMeasureTasksForEmployeeQuery(
                    _queryableWrapper.Object);

            //WHEN
            var result = target.Execute(employee.Id, null);

            //THEN
            Assert.That(result.Count, Is.EqualTo(0));

        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:34,代码来源:GetDueTaskFireRiskAssessmentFurtherControlMeasureTaskTest.cs


示例17: QueueManager

 public QueueManager(Stack<Question> next, Stack<Question> previous, Question startItem)
 {
     Controller = new Stack<Question>();
     Controller.Push(startItem);
     NextQueue = next;
     PreviousQueue = previous;
 }
开发者ID:lanreisee,项目名称:ExamPrep,代码行数:7,代码来源:QueueManager.cs


示例18: TokenizeTheQuestion

        public void TokenizeTheQuestion(Question question)
        {
            var matches = Regex.Matches(question.QuestionText, @"(^|\s)(in|at)\s(the\s)?", RegexOptions.IgnoreCase);

            foreach (Match match in matches)
            {
                Group group = match.Groups[0];
                var startPosition = (group.Index + group.Length );
                var cityName = question.QuestionText.Substring(startPosition);
                var endPosition = question.QuestionText.Length;

                var possibleEarlierTerminations = Regex.Matches(cityName, @"(^|\s)(when|what('?s?)|\d|(on|in|at|a|right|now|if|then|\?)(\s|$))", RegexOptions.IgnoreCase);
                if(possibleEarlierTerminations.Count > 0)
                {
                    Group terminationGroup = GetEarlierOccurrenceOfGroup(possibleEarlierTerminations);
                    endPosition = startPosition + terminationGroup.Index;
                }

                cityName = question.QuestionText.Substring(startPosition, endPosition - startPosition);
                if(cityName.Replace(" ","").Length == 0) continue;

                var tokenResult = new CityToken(cityName, startPosition);
                question.AddToken(tokenResult);
            }
        }
开发者ID:darkosancanin,项目名称:naturaldatetime_web,代码行数:25,代码来源:CityTokenizer.cs


示例19: AnswerQuestion

        /// <summary>
        /// Answers the question with the score provided. Also saves the question.
        /// </summary>
        /// <param name="question"></param>
        /// <param name="score"></param>
        public static void AnswerQuestion(Question question, int score)
        {
            // Calculate the dates
            question.AskCount++;
            question.ResponseQuality = score;
            SetEasinessFactor(question);
            SetInterval(question);

            // If the quality response was lower than 3 then start repetitions for the item from the beginning
            // without changing the E-Factor (i.e. use intervals I(1), I(2) etc. as if the item was memorized anew).
            if (question.ResponseQuality < 3)
            {
                question.Interval = 1;
            }

            // If it's the first ask use Today. Otherwise use the LastAsked, which may not necessarily be today.
            if (question.LastAsked == DateTime.MinValue)
                question.NextAskOn = DateTime.Today.AddDays(question.Interval);
            else
                question.NextAskOn = question.LastAsked.AddDays(question.Interval);

            question.LastAsked = DateTime.Today;
            //question.LastAsked = question.NextAskOn; // for debugging

            string format = "[{0}][{1}]\tScore:{2}\tEF:{3}\tNext ask: {4}\tLast ask:{5}\tPrevious interval: {6}\tNew interval: {7}";
            Logger.Info(format, question.Category,
                                        DateTime.Now.ToString(),
                                        question.ResponseQuality,
                                        question.EasinessFactor,
                                        question.NextAskOn.ToShortDateString(),
                                        question.LastAsked.ToShortDateString(),
                                        question.PreviousInterval,
                                        question.Interval);
        }
开发者ID:yetanotherchris,项目名称:flashback,代码行数:39,代码来源:QuestionManager.cs


示例20: SetInterval

        /// <summary>
        /// Calculates how long the interval should be until the next ask.
        /// </summary>
        private static void SetInterval(Question question)
        {
            /// [1] = 1 day
            /// [2] = 6 days later
            /// for n>2 I(n):=I(n-1)*EF
            ///
            /// In C#:
            /// interval[n] = interval[n-1] * EF

            int newPreviousInterval = question.Interval;

            // Zero is where it hasn't been asked yet, just added
            if (question.PreviousInterval < 1)
            {
                question.Interval = 1;	// first ask
            }
            else if (question.PreviousInterval == 1)
            {
                question.Interval = 6;	// 2nd ask
            }
            else if (question.PreviousInterval >= 6)
            {
                question.Interval = (int)Math.Round(question.PreviousInterval * question.EasinessFactor, MidpointRounding.AwayFromZero); // school rounding
            }

            question.PreviousInterval = newPreviousInterval;
        }
开发者ID:yetanotherchris,项目名称:flashback,代码行数:30,代码来源:QuestionManager.cs



注:本文中的Question类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Queue类代码示例发布时间:2022-05-24
下一篇:
C# QuestRace类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap