public static int AddEmployee(employeeInfo Employee) { if (Employee.Name != "" && Employee.Password != "" && LoginEmployee(Employee.Name, Employee.Password).Name == null) { string sql = string.Format("insert into EmployeeInfo (EmployeeName,EmployeePassword,CreateTime,EmployeeType) values('{0}','{1}','{2}','{3}')", Employee.Name, Employee.Password, System.DateTime.Now.ToString(), Employee.Type); return(Dbhelper.ExecuteNonQuery(sql)); } return(0); }
public static List <employeeInfo> GetALLEmployee() { string sql = "select * from EmployeeInfo"; OleDbDataReader dr = Dbhelper.ExecuteReader(sql); List <employeeInfo> list = new List <employeeInfo>(); while (dr.Read()) { employeeInfo Employee = new employeeInfo(); Employee.Id = uint.Parse(dr[0].ToString()); Employee.Name = dr[1].ToString(); Employee.Password = dr[2].ToString(); //使用控件显示所有数据 list.Add(Employee); } dr.Close(); return(list); }
public static employeeInfo LoginEmployee(string username, string userpwd, AdminType LogType) { string sql = string.Format("select * from EmployeeInfo where EmployeeName='{0}' and EmployeePassword='******' and EmployeeType='{2}'", username, userpwd, LogType); OleDbDataReader dr = Dbhelper.ExecuteReader(sql); employeeInfo Employee = new employeeInfo(); if (dr != null) { if (dr.Read()) { Employee.Id = uint.Parse(dr[0].ToString()); Employee.Name = dr[1].ToString(); Employee.Password = dr[2].ToString(); } return(Employee); } else { return(null); } }
public static int DelEmployee(employeeInfo Employee) { string sql = string.Format("delete from EmployeeInfo where EmployeeId = {0}", Employee.Id); return(Dbhelper.ExecuteNonQuery(sql)); }
public static int UpdataEmployee(employeeInfo Employee) { string sql = string.Format("update EmployeeInfo set EmployeePassword='******' where EmployeeName='{0}'", Employee.Name, Employee.Password); return(Dbhelper.ExecuteNonQuery(sql)); }