本文整理汇总了C#中Question.GetQuestionBySectionOID方法的典型用法代码示例。如果您正苦于以下问题:C# Question.GetQuestionBySectionOID方法的具体用法?C# Question.GetQuestionBySectionOID怎么用?C# Question.GetQuestionBySectionOID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Question
的用法示例。
在下文中一共展示了Question.GetQuestionBySectionOID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSectionByOID
public Section GetSectionByOID(int SOID)
{
Section section = null;
using (OdbcConnection connection = new OdbcConnection(connectionString))
{
using (OdbcCommand command = new OdbcCommand())
{
command.Connection = connection;
command.CommandText = "{CALL Section_BySectionOID(?)}";
command.CommandType = CommandType.StoredProcedure;
//Set Parameter Value
command.Parameters.AddWithValue("@SOID", SOID);
//Open connection
connection.Open();
//Read using reader
using (OdbcDataReader dataReader = command.ExecuteReader())
{
Question q = new Question();
//Section section;
if (dataReader.Read())
{
section = new Section();
section.SectionOID = Convert.ToInt32(dataReader["SectionOID"]);
section.AssessmentOID = Convert.ToInt32(dataReader["AssessmentOID"]);
section.CreatedBy = Convert.ToInt32(dataReader["CreatedBy"]);
section.CreatedDate = Convert.ToDateTime(dataReader["CreatedDate"]);
section.FlagPointTotal = Convert.ToInt32(dataReader["FlagPointTotal"]);
section.LastModifiedBy = Convert.ToInt32(dataReader["LastModifiedBy"]);
section.LastModifiedDate = Convert.ToDateTime(dataReader["LastModifiedDate"]);
section.PassingTotal = Convert.ToInt32(dataReader["PassingTotal"]);
section.SectionName = Convert.ToString(dataReader["SectionName"]);
section.TotalFlag = Convert.ToInt32(dataReader["TotalFlag"]);
section.TotalQuestion = Convert.ToInt32(dataReader["TotalQuestion"]);
section.Flag = (dataReader["Flag"]==null)?0:Convert.ToInt32(dataReader["Flag"]);
section.Low = (dataReader["Low"] == null) ? 0 : Convert.ToInt32(dataReader["Low"]);
section.Medium = (dataReader["Medium"] == null) ? 0 : Convert.ToInt32(dataReader["Medium"]);
section.High = (dataReader["High"] == null) ? 0 : Convert.ToInt32(dataReader["High"]);
//Get Question By SectionOID
section.QuestionList = q.GetQuestionBySectionOID(section.SectionOID);
}
}
}
}
return section;
}