本文整理汇总了C#中Question类的典型用法代码示例。如果您正苦于以下问题:C# Question类的具体用法?C# Question怎么用?C# Question使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Question类属于命名空间,在下文中一共展示了Question类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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++;
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例7: FillContents
internal void FillContents(Question question, QuestionContents contents, QuestionData data, int idx)
{
Question = question;
QuestionContents = contents;
QuestionData = data;
Index = idx;
}
示例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);
}
}
示例9: GetNextQuestion
public Question GetNextQuestion(Question prevQuestion, Answer prevAnswer)
{
int qId = logic.GetQuestionId(prevQuestion, prevAnswer);
Question q = new Question();
q.Id = qId;
return q;
}
示例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.");
}
}
}
示例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");
}
示例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, "Заполните капчу!"));
}
}
}
示例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;
}
示例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;
}
示例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));
}