61 lines
2.1 KiB
C#
61 lines
2.1 KiB
C#
using Dapper;
|
|
using dccdc.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace dccdc.DAL
|
|
{
|
|
public class InfectionDaysignQuestionOptionsDal
|
|
{
|
|
public List<InfectionDaysignQuestionOptionsModel> getOptionList(int question_id)
|
|
{
|
|
try {
|
|
string sql = "Select * from infection_daysign_question_options where question_id=" + question_id;
|
|
using (IDbConnection conn = CommHelper.GetSqlConnection())
|
|
{
|
|
//InfectionDaysignQuestionOptionsModel op = conn.QueryFirst<InfectionDaysignQuestionOptionsModel>(sql);
|
|
//if (op != null)
|
|
//{
|
|
return conn.Query<InfectionDaysignQuestionOptionsModel>(sql).ToList();
|
|
//}
|
|
//else {
|
|
// return new List<InfectionDaysignQuestionOptionsModel>();
|
|
//}
|
|
}
|
|
|
|
}
|
|
catch (Exception ex) {
|
|
return new List<InfectionDaysignQuestionOptionsModel>();
|
|
}
|
|
}
|
|
|
|
public List<InfectionDaysignQuestionOptionsModel> getRandomOption(int question_id)
|
|
{
|
|
try
|
|
{
|
|
string sql = "Select top 1 * from infection_daysign_question_options where question_id=" + question_id + " order by newID()";
|
|
using (IDbConnection conn = CommHelper.GetSqlConnection())
|
|
{
|
|
//InfectionDaysignQuestionOptionsModel op = conn.QueryFirst<InfectionDaysignQuestionOptionsModel>(sql);
|
|
//if (op != null)
|
|
//{
|
|
return conn.Query<InfectionDaysignQuestionOptionsModel>(sql).ToList();
|
|
//}
|
|
//else {
|
|
// return new List<InfectionDaysignQuestionOptionsModel>();
|
|
//}
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return new List<InfectionDaysignQuestionOptionsModel>();
|
|
}
|
|
}
|
|
}
|
|
}
|