当前文件路径:MyLibary/App_Code/BusinessLogicLayer/Borrow.cs 
1
using System;
2
using System.Data;
3
using System.Collections;
4
using System.Data.SqlClient;
5
using MyLibrary.DataAccessLayer;
6
using MyLibrary.DataAccessHelper;
7
8
9
namespace MyLibrary.BusinessLogicLayer
10
...{
11
//用户类
12
public class Borrow
13
...{
14
私有成员#region 私有成员
15
private int _borrowID; //借书号
16
private string _userID; //用户编号
17
private int _bookID; //书号
18
private DateTime _borrowBeginDate; //借书时间
19
private DateTime _borrowEndDate; //还书时间
20
private int _borrowState; //借书状态:0表示不在馆,1表示在馆
21
22
#endregion 私有成员
23
24
属性#region 属性
25
26
public int BorrowID
27
...{
28
set
29
...{
30
this._borrowID = value;
31
}
32
get
33
...{
34
return this._borrowID;
35
}
36
}
37
public string UserID
38
...{
39
set
40
...{
41
this._userID = value;
42
}
43
get
44
...{
45
return this._userID;
46
}
47
}
48
public int BookID
49
...{
50
set
51
...{
52
this._bookID = value;
53
}
54
get
55
...{
56
return this._bookID;
57
}
58
}
59
public DateTime BorrowBeginDate
60
...{
61
set
62
...{
63
this._borrowBeginDate = value;
64
}
65
get
66
...{
67
return this._borrowBeginDate;
68
}
69
}
70
public DateTime BorrowEndDate
71
...{
72
set
73
...{
74
this._borrowEndDate = value;
75
}
76
get
77
...{
78
return this._borrowEndDate;
79
}
80
}
81
public int BorrowState
82
...{
83
set
84
...{
85
this._borrowState = value;
86
}
87
get
88
...{
89
return this._borrowState;
90
}
91
}
92
93
#endregion 属性
94
95
方法#region 方法
96
97
//向Borrow表中添加借阅信息(借书)
98
//输出:
99
// 插入成功:返回True;
100
// 插入失败:返回False;
101
public bool InsertByProc()
102
...{
103
SqlParameter[] Params = new SqlParameter[5];
104
105
DataBase DB = new DataBase();
106
107
Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, UserID); //用户编号
108
Params[1] = DB.MakeInParam("@BookID", SqlDbType.Int , 4, BookID); //书号
109
Params[2] = DB.MakeInParam("@BorrowBeginDate", SqlDbType.DateTime, 8, BorrowBeginDate); //借阅时间
110
Params[3] = DB.MakeInParam("@BorrowEndDate", SqlDbType.DateTime, 8, BorrowEndDate); //还书时间
111
Params[4] = DB.MakeInParam("@BorrowState", SqlDbType.Int, 4, BorrowState); //借书状态
112
113
int Count = -1;
114
Count = DB.RunProc("Proc_BorrowAdd", Params);
115
if (Count > 0)
116
return true;
117
else return false;
118
}
119
120
//还书
121
public bool UpdateByProc(int XBookID)
122
...{
123
SqlParameter[] Params = new SqlParameter[2];
124
DataBase DB = new DataBase();
125
Params[0] = DB.MakeInParam("@BookID", SqlDbType.Int, 4, BookID); //书号
126
Params[1] = DB.MakeInParam("@BorrowState", SqlDbType.Int, 4, BorrowState); //借书状态
127
128
int Count = -1;
129
Count = DB.RunProc("Proc_ReturnBook", Params);
130
if (Count > 0)
131
return true;
132
else return false;
133
}
134
135
//查询借阅历史
136
public DataSet QueryBorrowHistory(string XUserID)
137
...{
138
SqlParameter[] Params = new SqlParameter[1];
139
DataBase DB = new DataBase();
140
Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, XUserID); //书号
141
return DB.GetDataSet("Proc_ReaderBorrowHistory",Params);
142
}
143
144
//查询目前借阅图书
145
public DataSet QueryCurrentBorrow(string XUserID)
146
...{
147
SqlParameter[] Params = new SqlParameter[1];
148
DataBase DB = new DataBase();
149
Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, XUserID); //书号
150
return DB.GetDataSet("Proc_ReaderCurrentBorrow", Params);
151
}
152
153
//查询超期该还图书
154
public DataSet QueryExpireBorrow(string XUserID)
155
...{
156
SqlParameter[] Params = new SqlParameter[1];
157
DataBase DB = new DataBase();
158
Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, XUserID); //书号
159
return DB.GetDataSet("Proc_ReaderExpireCuiHuan", Params);
160
}
161
162
//查询目前借阅图书数量
163
public int QueryCurrentBorrowCount(string XUserID)
164
...{
165
SqlParameter[] Params = new SqlParameter[1];
166
DataBase DB = new DataBase();
167
Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, XUserID); //书号
168
return DB.RunProcGetCount("Proc_ReaderCurrentBorrowCount", Params);
169
}
170
171
#endregion 方法
172
}
173
}
174