温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:某贸易公司项目管理系统源码
当前文件:
ProjectEva/App_Code/Employee.cs,打开代码结构图
ProjectEva/App_Code/Employee.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
/// <summary> 12
/// 黄建华(2007.9) 13
/// 员工实体类 14
/// </summary> 15
public class Employee 16
{ 17
public static SqlConnection MyConnection; 18
public static SqlCommand MyCommand; 19
public Employee() 20
{ 21
// 22
// TODO: 在此处添加构造函数逻辑 23
// 24
} 25
/// <summary> 26
/// 执行插入员工信息操作存储过程 27
/// </summary> 28
/// <param name="name"></param> 29
/// <param name="password"></param> 30
/// <returns></returns> 31
/* public static bool InsertEmployeeInfo(string name, string password) 32
{ 33
MyConnection = DB.createCon(); 34
MyCommand = new SqlCommand("Insert_Employee_Info", MyConnection); 35
MyCommand.CommandType = CommandType.StoredProcedure; 36
37
SqlParameter EmployeeName = new SqlParameter("@Emp_Name", SqlDbType.VarChar, 8); 38
EmployeeName.Value = name; 39
MyCommand.Parameters.Add(EmployeeName); 40
41
SqlParameter EmployeePassword = new SqlParameter("@Password", SqlDbType.VarChar, 50); 42
EmployeePassword.Value = JS.MD5(password); 43
MyCommand.Parameters.Add(EmployeePassword); 44
45
MyConnection.Open(); 46
int result; 47
result = MyCommand.ExecuteNonQuery(); 48
MyConnection.Close(); 49
if (result > 0) 50
{ 51
return true; 52
} 53
else 54
{ 55
return false; 56
} 57
}*/ 58
/// <summary> 59
/// 判断用户登陆信息是否正确 60
/// </summary> 61
/// <param name="name"></param> 62
/// <param name="password"></param> 63
/// <returns></returns> 64
public static bool CheckLoginInfo(string name,string password) 65
{ 66
MyConnection = DB.createCon(); 67
MyCommand = new SqlCommand("Get_Login_Info", MyConnection); 68
MyCommand.CommandType = CommandType.StoredProcedure; 69
70
SqlParameter Emp_Name = new SqlParameter("@Emp_Name", SqlDbType.VarChar); 71
Emp_Name.Value = name; 72
MyCommand.Parameters.Add(Emp_Name); 73
74
SqlParameter Emp_Pwd = new SqlParameter("@Emp_Pwd", SqlDbType.VarChar); 75
Emp_Pwd.Value = password; 76
MyCommand.Parameters.Add(Emp_Pwd); 77
78
MyConnection.Open(); 79
SqlDataReader dr = MyCommand.ExecuteReader(CommandBehavior.CloseConnection); 80
if (dr.Read()) 81
{ 82
return true; 83
} 84
else 85
{ 86
return false; 87
} 88
} 89
/// <summary> 90
/// 执行更新管理员信息存储过程 91
/// </summary> 92
/// <param name="name"></param> 93
/// <param name="password"></param> 94
/// <returns></returns> 95
public static bool UpdatePwdInfo(string name,string password) 96
{ 97
MyConnection = DB.createCon(); 98
MyCommand = new SqlCommand("Update_Pwd_Info", MyConnection); 99
MyCommand.CommandType = CommandType.StoredProcedure; 100
101
SqlParameter Emp_Name = new SqlParameter("@Emp_Name", SqlDbType.VarChar); 102
Emp_Name.Value = name; 103
MyCommand.Parameters.Add(Emp_Name); 104
105
SqlParameter Emp_Pwd = new SqlParameter("@Emp_Pwd", SqlDbType.VarChar); 106
Emp_Pwd.Value = password; 107
MyCommand.Parameters.Add(Emp_Pwd); 108
109
MyConnection.Open(); 110
int result = MyCommand.ExecuteNonQuery(); 111
if (result > 0) 112
{ 113
return true; 114
} 115
else 116
{ 117
return false; 118
} 119
120
} 121
122
123
124
} 125








