当前文件路径:OnLineExam/App_Code/BusinessLogicLayer/Paper.cs 
1
using System;
2
using System.Data;
3
using System.Collections;
4
using System.Data.SqlClient;
5
using MyOnLineExam.DataAccessLayer;
6
using MyOnLineExam.DataAccessHelper;
7
8
//该源码下载自www.51aspx.com(51aspx.com)
9
10
namespace MyOnLineExam.BusinessLogicLayer
11
...{
12
//用户类
13
public class Paper
14
...{
15
私有成员#region 私有成员
16
private int _paperID; //试卷编号
17
private int _courseID; //科目编号
18
private string _paperName; //试卷名称
19
private bool _paperState; //试卷状态
20
21
#endregion 私有成员
22
23
属性#region 属性
24
25
public int PaperID
26
...{
27
set
28
...{
29
this._paperID = value;
30
}
31
get
32
...{
33
return this._paperID;
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 PaperName
48
...{
49
set
50
...{
51
this._paperName = value;
52
}
53
get
54
...{
55
return this._paperName;
56
}
57
}
58
public bool PaperState
59
...{
60
set
61
...{
62
this._paperState = value;
63
}
64
get
65
...{
66
return this._paperState;
67
}
68
}
69
70
71
#endregion 属性
72
73
方法#region 方法
74
75
//向Paper表中添加试卷信息(采用存储过程)
76
//输出:
77
// 插入成功:返回True;
78
// 插入失败:返回False;
79
public bool InsertByProc()
80
...{
81
SqlParameter[] Params = new SqlParameter[3];
82
DataBase DB = new DataBase();
83
84
Params[0] = DB.MakeInParam("@CourseID", SqlDbType.Int, 4, CourseID); //科目编号
85
Params[1] = DB.MakeInParam("@PaperName", SqlDbType.VarChar, 200, PaperName); //试卷名称
86
Params[2] = DB.MakeInParam("@PaperState", SqlDbType.Bit,1, PaperState); //试卷状态
87
88
int Count = -1;
89
Count = DB.RunProc("Proc_PaperAdd", Params);
90
if (Count > 0)
91
return true;
92
else return false;
93
}
94
95
//更新试卷信息
96
public bool UpdateByProc(int PID)
97
...{
98
SqlParameter[] Params = new SqlParameter[2];
99
100
DataBase DB = new DataBase();
101
102
Params[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, PID); //试卷编号
103
Params[1] = DB.MakeInParam("@PaperState", SqlDbType.Bit, 1, PaperState); //试卷状态
104
105
int Count = -1;
106
Count = DB.RunProc("Proc_PaperModify", Params);
107
if (Count > 0)
108
return true;
109
else return false;
110
}
111
112
113
//删除题目
114
//输入:
115
// TID - 题目编号;
116
//输出:
117
// 删除成功:返回True;
118
// 删除失败:返回False;
119
public bool DeleteByProc(int PID)
120
...{
121
SqlParameter[] Params = new SqlParameter[1];
122
123
DataBase DB = new DataBase();
124
125
Params[0] = DB.MakeInParam("@ID", SqlDbType.Int, 4, PID); //题目编号
126
127
int Count = -1;
128
Count = DB.RunProc("Proc_PaperDelete", Params);
129
if (Count > 0)
130
return true;
131
else return false;
132
}
133
134
//查询所用试卷
135
//不需要参数
136
public DataSet QueryAllPaper()
137
...{
138
DataBase DB = new DataBase();
139
return DB.GetDataSet("Proc_PaperList");
140
}
141
142
//查询所用可用试卷
143
//不需要参数
144
public DataSet QueryPaper()
145
...{
146
DataBase DB = new DataBase();
147
SqlParameter[] Params = new SqlParameter[1];
148
Params[0] = DB.MakeInParam("@PaperState", SqlDbType.Bit,1, "true"); //题目编号
149
return DB.GetDataSet("Proc_PaperUseList",Params);
150
}
151
#endregion 方法
152
}
153
}