温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:多功能在线考试系统改进版源码
1using System; 2
using System.Data; 3
using System.Collections; 4
using System.Data.SqlClient; 5
using OnLineExam.DataAccessLayer; 6
using OnLineExam.DataAccessHelper; 7
8
9
namespace OnLineExam.BusinessLogicLayer 10
...{ 11
//填空题类 12
public class FillBlankProblem 13
...{ 14
私有成员#region 私有成员 15
private int _ID; //题目编号 16
private int _CourseID; //所属科目 17
private string _FrontTitle; //题目前部分 18
private string _BackTitle; //题目后部分 19
private string _Answer; //答案 20
21
#endregion 私有成员 22
23
属性#region 属性 24
25
public int ID 26
...{ 27
set 28
...{ 29
this._ID = value; 30
} 31
get 32
...{ 33
return this._ID; 34
} 35
} 36
public int CourseID 37
...{ 38
set 39
...{ 40
this._CourseID = value; 41
} 42
get 43
...{ 44
return this._CourseID; 45
} 46
} 47
public string FrontTitle 48
...{ 49
set 50
...{ 51
this._FrontTitle = value; 52
} 53
get 54
...{ 55
return this._FrontTitle; 56
} 57
} 58
public string BackTitle 59
...{ 60
set 61
...{ 62
this._BackTitle = value; 63
} 64
get 65
...{ 66
return this._BackTitle; 67
} 68
} 69
public string Answer 70
...{ 71
set 72
...{ 73
this._Answer = value; 74
} 75
get 76
...{ 77
return this._Answer; 78
} 79
} 80
81
#endregion 属性 82
83
方法#region 方法 84
85
//根据题目ID 初始化题目 86
//输入: 87
// TID - 题目编号; 88
//输出: 89
// 题目存在:返回True; 90
// 题目不在:返回False; 91
public bool LoadData(int TID) 92
...{ 93
SqlParameter[] Params = new SqlParameter[1]; 94
DataBase DB = new DataBase(); 95
96
Params[0] = DB.MakeInParam("@ID", SqlDbType.Int, 4, TID); //用户编号 97
98
DataSet ds = DB.GetDataSet("Proc_FillBlankProblemDetail", Params); 99
ds.CaseSensitive = false; 100
DataRow DR; 101
if (ds.Tables[0].Rows.Count > 0) 102
...{ 103
DR = ds.Tables[0].Rows[0]; 104
this._CourseID = GetSafeData.ValidateDataRow_N(DR, "CourseID"); //科目编号 105
this._FrontTitle = GetSafeData.ValidateDataRow_S(DR, "FrontTitle"); //题目前部分 106
this._BackTitle = GetSafeData.ValidateDataRow_S(DR, "BackTitle"); //题目后部分 107
this._Answer = GetSafeData.ValidateDataRow_S(DR, "Answer"); //答案 108
return true; 109
} 110
else 111
...{ 112
return false; 113
} 114
} 115
116
117
//向FillBlankProblem表中添加题目信息(采用存储过程) 118
//输出: 119
// 插入成功:返回True; 120
// 插入失败:返回False; 121
public bool InsertByProc() 122
...{ 123
SqlParameter[] Params = new SqlParameter[4]; 124
125
DataBase DB = new DataBase(); 126
127
Params[0] = DB.MakeInParam("@CourseID", SqlDbType.Int, 4, CourseID); //科目编号 128
Params[1] = DB.MakeInParam("@FrontTitle", SqlDbType.VarChar, 500, FrontTitle); //题目前部分 129
Params[2] = DB.MakeInParam("@BackTitle", SqlDbType.VarChar, 500, BackTitle); //题名后部分 130
Params[3] = DB.MakeInParam("@Answer", SqlDbType.VarChar, 200, Answer); //答案 131
132
int Count = -1; 133
Count = DB.RunProc("Proc_FillBlankProblemAdd", Params); 134
if (Count > 0) 135
return true; 136
else return false; 137
} 138
139
//更新填空题的信息 140
public bool UpdateByProc(int TID) 141
...{ 142
SqlParameter[] Params = new SqlParameter[5]; 143
144
DataBase DB = new DataBase(); 145
146
Params[0] = DB.MakeInParam("@ID", SqlDbType.Int, 4, TID); //题目编号 147
Params[1] = DB.MakeInParam("@CourseID", SqlDbType.Int, 4, CourseID); //科目编号 148
Params[2] = DB.MakeInParam("@FrontTitle", SqlDbType.VarChar, 500, FrontTitle); //题目前部分 149
Params[3] = DB.MakeInParam("@BackTitle", SqlDbType.VarChar, 500, BackTitle); //题名后部分 150
Params[4] = DB.MakeInParam("@Answer", SqlDbType.VarChar, 200, Answer); //答案 151
152
int Count = -1; 153
Count = DB.RunProc("Proc_FillBlankProblemModify", Params); 154
if (Count > 0) 155
return true; 156
else return false; 157
} 158
159
160
//删除题目 161
//输入: 162
// TID - 题目编号; 163
//输出: 164
// 删除成功:返回True; 165
// 删除失败:返回False; 166
public bool DeleteByProc(int TID) 167
...{ 168
SqlParameter[] Params = new SqlParameter[1]; 169
170
DataBase DB = new DataBase(); 171
172
Params[0] = DB.MakeInParam("@ID", SqlDbType.Int, 4, TID); //题目编号 173
174
int Count = -1; 175
Count = DB.RunProc("Proc_FillBlankProblemDelete", Params); 176
if (Count > 0) 177
return true; 178
else return false; 179
} 180
181
//查询单选题 182
//课程编号 183
public DataSet QueryFillBlankProblem(int TCourseID) 184
...{ 185
SqlParameter[] Params = new SqlParameter[1]; 186
187
DataBase DB = new DataBase(); 188
189
Params[0] = DB.MakeInParam("@CourseID", SqlDbType.Int, 4, TCourseID); //题目编号 190
return DB.GetDataSet("Proc_FillBlankProblemList", Params); 191
} 192
193
#endregion 方法 194
} 195
}





}