예제 #1
0
 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);
 }
예제 #2
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);
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        public static int DelEmployee(employeeInfo Employee)
        {
            string sql = string.Format("delete from EmployeeInfo where EmployeeId = {0}", Employee.Id);

            return(Dbhelper.ExecuteNonQuery(sql));
        }
예제 #5
0
        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));
        }