温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:高校教师档案管理系统项目源码
当前文件:
TeacherFileProject/App_Code/ManagerClass.cs,打开代码结构图
TeacherFileProject/App_Code/ManagerClass.cs,打开代码结构图1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Web; 5
using System.Web.Security; 6
using System.Web.UI; 7
using System.Web.UI.WebControls; 8
using System.Web.UI.WebControls.WebParts; 9
using System.Web.UI.HtmlControls; 10
using System.Data.SqlClient; 11
//该源码下载自www.51aspx.com(51aspx.com) 12
/// <summary> 13
/// ManagerClass 的摘要说明 14
/// </summary> 15
public class ManagerClass 16
{ 17
DBClass dbObj = new DBClass(); 18
public ManagerClass() 19
{ 20
// 21
// TODO: 在此处添加构造函数逻辑 22
// 23
} 24
//============================================================= 25
// 方 法 名: GetALCmd() 26
// 功能描述: 获取SqlCommand 27
// 输入参数: 无 28
// 返 回 值: 返回SqlCommand 29
// ============================================================== 30
public SqlCommand GetALCmd() 31
{ 32
SqlConnection myConn = dbObj.GetConnection(); 33
SqlCommand myCmd = new SqlCommand("Proc_GetALInfo", myConn); 34
myCmd.CommandType = CommandType.StoredProcedure; 35
//执行过程 36
myConn.Open(); 37
try 38
{ 39
myCmd.ExecuteNonQuery(); 40
} 41
catch 42
{ 43
myCmd.Dispose(); 44
myConn.Close(); 45
46
} 47
myCmd.Dispose(); 48
myConn.Close(); 49
return myCmd; 50
51
} 52
//============================================================= 53
// 方 法 名: DeleteResumeInfo() 54
// 功能描述: 删除教师的登录资料 55
// 输入参数: 资料的唯一编号 56
// 返 回 值: 无 57
// ============================================================== 58
public void DeleteResumeInfo(int P_Int_id) 59
{ 60
SqlConnection myConn = dbObj.GetConnection(); 61
SqlCommand myCmd = new SqlCommand("Proc_DeleteTL", myConn); 62
myCmd.CommandType = CommandType.StoredProcedure; 63
//添加参数 64
SqlParameter id = new SqlParameter("@id", SqlDbType.Int, 4); 65
id.Value = P_Int_id; 66
myCmd.Parameters.Add(id); 67
//执行过程 68
myConn.Open(); 69
try 70
{ 71
myCmd.ExecuteNonQuery(); 72
} 73
catch 74
{ 75
myCmd.Dispose(); 76
myConn.Close(); 77
78
} 79
myCmd.Dispose(); 80
myConn.Close(); 81
82
} 83
//============================================================= 84
// 方 法 名: ReturnTLDs() 85
// 功能描述: 获取教师登录资料的数据集Dataset 86
// 输入参数: 资料的唯一编号 87
// 返 回 值: 无 88
// ============================================================== 89
public DataSet ReturnTLDs(int P_Int_id, string P_Str_srcTable) 90
{ 91
SqlConnection myConn = dbObj.GetConnection(); 92
SqlCommand myCmd = new SqlCommand("Proc_GetULInfo", myConn); 93
myCmd.CommandType = CommandType.StoredProcedure; 94
//添加参数 95
SqlParameter id = new SqlParameter("@id", SqlDbType.Int, 4); 96
id.Value = P_Int_id; 97
myCmd.Parameters.Add(id); 98
//执行过程 99
myConn.Open(); 100
try 101
{ 102
myCmd.ExecuteNonQuery(); 103
} 104
catch 105
{ 106
myCmd.Dispose(); 107
myConn.Close(); 108
109
} 110
SqlDataAdapter da = new SqlDataAdapter(myCmd); 111
DataSet ds = new DataSet(); 112
da.Fill(ds, P_Str_srcTable); 113
myCmd.Dispose(); 114
myConn.Close(); 115
return ds; 116
117
} 118
//============================================================= 119
// 方 法 名: AddTLInfo() 120
// 功能描述: 在表tb_userInfo中添加教师的登录资料 121
// 输入参数: 122
// 返 回 值: 无 123
// ============================================================== 124
public void AddTLInfo(string P_Str_userid, string P_Str_userpass, bool P_BL_sex ,int P_Int_age,string P_Str_college, string P_Str_class) 125
{ 126
SqlConnection myConn = dbObj.GetConnection(); 127
SqlCommand myCmd = new SqlCommand("Proc_InsertTL", myConn); 128
myCmd.CommandType = CommandType.StoredProcedure; 129
//添加参数 130
SqlParameter userid = new SqlParameter("@userid", SqlDbType.NVarChar, 50); 131
userid.Value = P_Str_userid; 132
myCmd.Parameters.Add(userid); 133
//添加参数 134
SqlParameter userpass = new SqlParameter("@userpass", SqlDbType.NVarChar, 50); 135
userpass.Value = P_Str_userpass; 136
myCmd.Parameters.Add(userpass); 137
//添加参数 138
SqlParameter sex = new SqlParameter("@sex", SqlDbType.Bit, 1); 139
sex.Value = P_BL_sex; 140
myCmd.Parameters.Add(sex); 141
//添加参数 142
SqlParameter age = new SqlParameter("@age", SqlDbType.Int, 4); 143
age.Value = P_Int_age; 144
myCmd.Parameters.Add(age); 145
//添加参数 146
SqlParameter college = new SqlParameter("@college", SqlDbType.NVarChar, 50); 147
college.Value = P_Str_college; 148
myCmd.Parameters.Add(college); 149
//添加参数 150
SqlParameter className = new SqlParameter("@class", SqlDbType.NVarChar,50); 151
className.Value = P_Str_class; 152
myCmd.Parameters.Add(className); 153
//执行过程 154
myConn.Open(); 155
try 156
{ 157
myCmd.ExecuteNonQuery(); 158
} 159
catch 160
{ 161
myCmd.Dispose(); 162
myConn.Close(); 163
164
} 165
myCmd.Dispose(); 166
myConn.Close(); 167
168
} 169
//============================================================= 170
// 方 法 名: UpdateTLInfo() 171
// 功能描述: 在表tb_userInfo中修改教师的登录资料 172
// 输入参数: 173
// 返 回 值: 无 174
// ============================================================== 175
public void UpdateTLInfo(int P_Int_id,string P_Str_userid, string P_Str_userpass, bool P_BL_sex, int P_Int_age, string P_Str_college, string P_Str_class) 176
{ 177
SqlConnection myConn = dbObj.GetConnection(); 178
SqlCommand myCmd = new SqlCommand("Proc_updateTL", myConn); 179
myCmd.CommandType = CommandType.StoredProcedure; 180
//添加参数 181
SqlParameter id = new SqlParameter("@id", SqlDbType.Int,4); 182
id.Value = P_Int_id; 183
myCmd.Parameters.Add(id); 184
//添加参数 185
SqlParameter userid = new SqlParameter("@userid", SqlDbType.NVarChar, 50); 186
userid.Value = P_Str_userid; 187
myCmd.Parameters.Add(userid); 188
//添加参数 189
SqlParameter userpass = new SqlParameter("@userpass", SqlDbType.NVarChar, 50); 190
userpass.Value = P_Str_userpass; 191
myCmd.Parameters.Add(userpass); 192
//添加参数 193
SqlParameter sex = new SqlParameter("@sex", SqlDbType.Bit, 1); 194
sex.Value = P_BL_sex; 195
myCmd.Parameters.Add(sex); 196
//添加参数 197
SqlParameter age = new SqlParameter("@age", SqlDbType.Int, 4); 198
age.Value = P_Int_age; 199
myCmd.Parameters.Add(age); 200
//添加参数 201
SqlParameter college = new SqlParameter("@college", SqlDbType.NVarChar, 50); 202
college.Value = P_Str_college; 203
myCmd.Parameters.Add(college); 204
//添加参数 205
SqlParameter className = new SqlParameter("@class", SqlDbType.NVarChar, 50); 206
className.Value = P_Str_class; 207
myCmd.Parameters.Add(className); 208
//执行过程 209
myConn.Open(); 210
try 211
{ 212
myCmd.ExecuteNonQuery(); 213
} 214
catch 215
{ 216
myCmd.Dispose(); 217
myConn.Close(); 218
219
} 220
myCmd.Dispose(); 221
myConn.Close(); 222
223
} 224
//********************************系统设置******************************************************** 225
/// <summary> 226
/// 获取系统表中的信息 227
/// </summary> 228
/// <returns>返回SqlCommand对象</returns> 229
public SqlCommand GetConfigCmd() 230
{ 231
SqlConnection myConn = dbObj.GetConnection(); 232
SqlCommand myCmd = new SqlCommand("Proc_GetConfig", myConn); 233
myCmd.CommandType = CommandType.StoredProcedure; 234
//执行过程 235
myConn.Open(); 236
try 237
{ 238
myCmd.ExecuteNonQuery(); 239
} 240
catch 241
{ 242
myCmd.Dispose(); 243
myConn.Close(); 244
245
} 246
myCmd.Dispose(); 247
myConn.Close(); 248
return myCmd; 249
250
} 251
/// <summary> 252
/// 修改表tb_config中的信息 253
/// </summary> 254
/// <param name="P_Int_id">唯一编号</param> 255
/// <param name="P_BL_isOpen">系统是否对教师开放</param> 256
/// <param name="P_BL_isSearch">搜索功能是否对教师开放</param> 257
public void UpdateConfig(int P_Int_id,bool P_BL_isOpen,bool P_BL_isSearch) 258
{ 259
SqlConnection myConn = dbObj.GetConnection(); 260
SqlCommand myCmd = new SqlCommand("Proc_UpdateConfigInfo", myConn); 261
myCmd.CommandType = CommandType.StoredProcedure; 262
//添加参数 263
SqlParameter id = new SqlParameter("@id", SqlDbType.Int, 4); 264
id.Value = P_Int_id; 265
myCmd.Parameters.Add(id); 266
//添加参数 267
SqlParameter isOpen = new SqlParameter("@isOpen", SqlDbType.Bit,1); 268
isOpen.Value = P_BL_isOpen; 269
myCmd.Parameters.Add(isOpen); 270
//添加参数 271
SqlParameter isSearch = new SqlParameter("@isSearch", SqlDbType.Bit, 1); 272
isSearch.Value = P_BL_isSearch; 273
myCmd.Parameters.Add(isSearch); 274
//执行过程 275
myConn.Open(); 276
try 277
{ 278
myCmd.ExecuteNonQuery(); 279
} 280
catch 281
{ 282
myCmd.Dispose(); 283
myConn.Close(); 284
285
} 286
myCmd.Dispose(); 287
myConn.Close(); 288
289
} 290
//********************************搜索功能******************************************************** 291
//============================================================= 292
// 方 法 名: GetTClassCmd() 293
// 功能描述: 获取SqlCommand 294
// 输入参数: 295
// 返 回 值: 返回SqlCommand 296
// ============================================================== 297
public SqlCommand GetTClassCmd() 298
{ 299
SqlConnection myConn = dbObj.GetConnection(); 300
SqlCommand myCmd = new SqlCommand("Proc_GetTClass", myConn); 301
myCmd.CommandType = CommandType.StoredProcedure; 302
//执行过程 303
myConn.Open(); 304
try 305
{ 306
myCmd.ExecuteNonQuery(); 307
} 308
catch 309
{ 310
myCmd.Dispose(); 311
myConn.Close(); 312
313
} 314
myCmd.Dispose(); 315
myConn.Close(); 316
return myCmd; 317
318
} 319
//============================================================= 320
// 方 法 名: GetATSCmd() 321
// 功能描述: 获取SqlCommand 322
// 输入参数: 323
// 返 回 值: 返回SqlCommand 324
// ============================================================== 325
public SqlCommand GetATSCmd(int P_Int_type,int P_Int_keyId,int P_Int_FCId,string P_Str_keyworks,string P_Str_class) 326
{ 327
SqlConnection myConn = dbObj.GetConnection(); 328
SqlCommand myCmd = new SqlCommand(); 329
330
//SqlCommand myCmd = new SqlCommand("Proc_GetAJYInfo", myConn); 331
myCmd.CommandText = "Proc_GetAJYInfo"; 332
myCmd.Connection = myConn; 333
myCmd.CommandType = CommandType.StoredProcedure; 334
335
//添加参数 336
SqlParameter keyId = new SqlParameter("@keyId", SqlDbType.Int, 4); 337
keyId.Value = P_Int_keyId; 338
myCmd.Parameters.Add(keyId); 339
//添加参数 340
SqlParameter type = new SqlParameter("@type", SqlDbType.Int, 4); 341
type.Value = P_Int_type; 342
myCmd.Parameters.Add(type); 343
//添加参数 344
SqlParameter FCId = new SqlParameter("@FCId", SqlDbType.Int, 4); 345
FCId.Value = P_Int_FCId; 346
myCmd.Parameters.Add(FCId); 347
//添加参数 348
SqlParameter keywords = new SqlParameter("@keywords", SqlDbType.NVarChar, 50); 349
keywords.Value = P_Str_keyworks; 350
myCmd.Parameters.Add(keywords); 351
//添加参数 352
SqlParameter className = new SqlParameter("@class", SqlDbType.NVarChar, 50); 353
className.Value = P_Str_class; 354
myCmd.Parameters.Add(className); 355
//执行过程 356
myConn.Open(); 357
try 358
![]()







