温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:多功能在线考试系统改进版源码
当前文件:
OnLineExamUpdate/App_Code/BusinessLogicLayer/Paper.cs,打开代码结构图
OnLineExamUpdate/App_Code/BusinessLogicLayer/Paper.cs,打开代码结构图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 Paper 13
...{ 14
私有成员#region 私有成员 15
private int _paperID; //试卷编号 16
private int _courseID; //科目编号 17
private string _paperName; //试卷名称 18
private byte _paperState; //试卷状态 19
private string _type; 20
private string _userid; 21
private string _state; 22
23
#endregion 私有成员 24
25
属性#region 属性 26
27
public int PaperID 28
...{ 29
set 30
...{ 31
this._paperID = value; 32
} 33
get 34
...{ 35
return this._paperID; 36
} 37
} 38
public int CourseID 39
...{ 40
set 41
...{ 42
this._courseID = value; 43
} 44
get 45
...{ 46
return this._courseID; 47
} 48
} 49
public string PaperName 50
...{ 51
set 52
...{ 53
this._paperName = value; 54
} 55
get 56
...{ 57
return this._paperName; 58
} 59
} 60
public byte PaperState 61
...{ 62
set 63
...{ 64
this._paperState = value; 65
} 66
get 67
...{ 68
return this._paperState; 69
} 70
} 71
public string Type 72
...{ 73
set 74
...{ 75
this._type = value; 76
} 77
get 78
...{ 79
return this._type; 80
} 81
} 82
public string UserID 83
...{ 84
set 85
...{ 86
this._userid = value; 87
} 88
get 89
...{ 90
return this._userid; 91
} 92
} 93
public string state 94
...{ 95
set 96
...{ 97
this._state = value; 98
} 99
get 100
...{ 101
return this._state; 102
} 103
} 104
105
#endregion 属性 106
107
方法#region 方法 108
109
//向Paper表中添加试卷信息(采用存储过程) 110
//输出: 111
// 插入成功:返回True; 112
// 插入失败:返回False; 113
public bool InsertByProc() 114
...{ 115
SqlParameter[] Params = new SqlParameter[3]; 116
DataBase DB = new DataBase(); 117
118
Params[0] = DB.MakeInParam("@CourseID", SqlDbType.Int, 4, CourseID); //科目编号 119
Params[1] = DB.MakeInParam("@PaperName", SqlDbType.VarChar, 200, PaperName); //试卷名称 120
Params[2] = DB.MakeInParam("@PaperState", SqlDbType.Bit,1, PaperState); //试卷状态 121
122
int Count = -1; 123
Count = DB.RunProc("Proc_PaperAdd", Params); 124
if (Count > 0) 125
return true; 126
else return false; 127
} 128
129
//更新试卷信息 130
public bool UpdateByProc(int PID) 131
...{ 132
SqlParameter[] Params = new SqlParameter[2]; 133
134
DataBase DB = new DataBase(); 135
136
Params[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, PID); //试卷编号 137
Params[1] = DB.MakeInParam("@PaperState", SqlDbType.Bit, 1, PaperState); //试卷状态 138
139
int Count = -1; 140
Count = DB.RunProc("Proc_PaperModify", Params); 141
if (Count > 0) 142
return true; 143
else return false; 144
} 145
//更新试卷是否评阅的状态 146
public bool UpdateByProc(string XUserID,int XPaperID,string Xstate) 147
...{ 148
SqlParameter[] Params = new SqlParameter[3]; 149
150
DataBase DB = new DataBase(); 151
152
Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, XUserID); 153
Params[1] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, XPaperID); 154
Params[2] = DB.MakeInParam("@state", SqlDbType.VarChar, 50,Xstate); 155
156
int Count = -1; 157
Count = DB.RunProc("Proc_UserAnswerStateModify", Params); 158
if (Count > 0) 159
return true; 160
else return false; 161
} 162
163
//删除题目 164
//输入: 165
// TID - 题目编号; 166
//输出: 167
// 删除成功:返回True; 168
// 删除失败:返回False; 169
public bool DeleteByProc(int PID) 170
...{ 171
SqlParameter[] Params = new SqlParameter[1]; 172
173
DataBase DB = new DataBase(); 174
175
Params[0] = DB.MakeInParam("@ID", SqlDbType.Int, 4, PID); //题目编号 176
177
int Count = -1; 178
Count = DB.RunProc("Proc_PaperDelete", Params); 179
if (Count > 0) 180
return true; 181
else return false; 182
} 183
// 删除某位用户的试卷 184
public bool DeleteByProc(string userid,int paperid) 185
...{ 186
SqlParameter[] Params = new SqlParameter[2]; 187
188
DataBase DB = new DataBase(); 189
190
Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid); //用户ID 191
Params[1] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid); //试卷ID 192
193
int Count = -1; 194
Count = DB.RunProc("Proc_UserPaperDelete", Params); 195
if (Count > 0) 196
return true; 197
else return false; 198
} 199
200
//查询所用试卷 201
//不需要参数 202
public DataSet QueryAllPaper() 203
...{ 204
DataBase DB = new DataBase(); 205
return DB.GetDataSet("Proc_PaperList"); 206
} 207
208
//查询所用可用试卷 209
//不需要参数 210
public DataSet QueryPaper() 211
...{ 212
DataBase DB = new DataBase(); 213
SqlParameter[] Params = new SqlParameter[1]; 214
Params[0] = DB.MakeInParam("@PaperState", SqlDbType.Bit,1, "true"); //题目编号 215
return DB.GetDataSet("Proc_PaperUseList",Params); 216
} 217
//查询所有用户考试的试卷 218
public DataSet QueryUserPaperList() 219
...{ 220
DataBase DB = new DataBase(); 221
return DB.GetDataSet("Proc_UserPaperList"); 222
} 223
//查询某个用户考试的试卷 224
public DataSet QueryUserPaper(string type,string userid) 225
...{ 226
DataBase DB = new DataBase(); 227
SqlParameter[] Params = new SqlParameter[2]; 228
//Params[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid); //试卷编号 229
Params[0] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, type); //题目类型 230
Params[1] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid); //用户ID 231
232
return DB.GetDataSet("Proc_UserAnswer", Params); 233
} 234
#endregion 方法 235
} 236
}





}