📄 employee.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
/// <summary>
/// 黄建华(2007.9)
/// 员工实体类
/// </summary>
public class Employee
{
public static SqlConnection MyConnection;
public static SqlCommand MyCommand;
public Employee()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
/// <summary>
/// 执行插入员工信息操作存储过程
/// </summary>
/// <param name="name"></param>
/// <param name="password"></param>
/// <returns></returns>
/* public static bool InsertEmployeeInfo(string name, string password)
{
MyConnection = DB.createCon();
MyCommand = new SqlCommand("Insert_Employee_Info", MyConnection);
MyCommand.CommandType = CommandType.StoredProcedure;
SqlParameter EmployeeName = new SqlParameter("@Emp_Name", SqlDbType.VarChar, 8);
EmployeeName.Value = name;
MyCommand.Parameters.Add(EmployeeName);
SqlParameter EmployeePassword = new SqlParameter("@Password", SqlDbType.VarChar, 50);
EmployeePassword.Value = JS.MD5(password);
MyCommand.Parameters.Add(EmployeePassword);
MyConnection.Open();
int result;
result = MyCommand.ExecuteNonQuery();
MyConnection.Close();
if (result > 0)
{
return true;
}
else
{
return false;
}
}*/
/// <summary>
/// 判断用户登陆信息是否正确
/// </summary>
/// <param name="name"></param>
/// <param name="password"></param>
/// <returns></returns>
public static bool CheckLoginInfo(string name,string password)
{
MyConnection = DB.createCon();
MyCommand = new SqlCommand("Get_Login_Info", MyConnection);
MyCommand.CommandType = CommandType.StoredProcedure;
SqlParameter Emp_Name = new SqlParameter("@Emp_Name", SqlDbType.VarChar);
Emp_Name.Value = name;
MyCommand.Parameters.Add(Emp_Name);
SqlParameter Emp_Pwd = new SqlParameter("@Emp_Pwd", SqlDbType.VarChar);
Emp_Pwd.Value = password;
MyCommand.Parameters.Add(Emp_Pwd);
MyConnection.Open();
SqlDataReader dr = MyCommand.ExecuteReader(CommandBehavior.CloseConnection);
if (dr.Read())
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// 执行更新管理员信息存储过程
/// </summary>
/// <param name="name"></param>
/// <param name="password"></param>
/// <returns></returns>
public static bool UpdatePwdInfo(string name,string password)
{
MyConnection = DB.createCon();
MyCommand = new SqlCommand("Update_Pwd_Info", MyConnection);
MyCommand.CommandType = CommandType.StoredProcedure;
SqlParameter Emp_Name = new SqlParameter("@Emp_Name", SqlDbType.VarChar);
Emp_Name.Value = name;
MyCommand.Parameters.Add(Emp_Name);
SqlParameter Emp_Pwd = new SqlParameter("@Emp_Pwd", SqlDbType.VarChar);
Emp_Pwd.Value = password;
MyCommand.Parameters.Add(Emp_Pwd);
MyConnection.Open();
int result = MyCommand.ExecuteNonQuery();
if (result > 0)
{
return true;
}
else
{
return false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -