Beispiel #1
0
        }// end if

        #endregion

        #region//修改员工信息,返回值, 1表示成功,0表示失败
        public int tbEmployeeUpdate(tbEmployeeClass Customer)
        {
            int intFalg = 0;

            try
            {
                tbDai   = new tbDaiConnection();              //实例一个联接数据库对象
                oledCon = tbDai.OledCon();                    //打开数据库
                string strUpdate = "update tb_Employee set "; //创建添加字符串
                strUpdate += "EmpName ='" + Customer.strEmpName + "',EmpNation= '" + Customer.shEmpNation + "',EmpEngish='" + Customer.EmpEngish + "',EmpPasword='" + Customer.EmpPasword + "',";
                strUpdate += "EmpSex='" + Customer.shEmpSex + "',EmpIDcard='" + Customer.strEmpIDcard + "',fldEmpBirthday='" + Customer.strEmpSpecialty + "',EmpOfficeTel='" + Customer.strEmpOfficeTel + "',";
                strUpdate += "EmpOICQ='" + Customer.strEmpOICQ + "',EmpEmail='" + Customer.strEmpEmail + "',EmpState='" + Customer.shEmpState + "',";
                strUpdate += "EmpCity='" + Customer.shEmpCity + "',EmpWorkDate='" + Customer.EmpWorkDate + "',EmpDemissionDate='" + Customer.EmpDemissionDate + "',";
                strUpdate += "fldEmpRemark='" + Customer.strfldEmpRemark + "',fldEmpWorkFlag='" + Customer.byfldEmpWorkFlag + "',EmpRegDate='" + Customer.EmpRegDate + "'";
                strUpdate += " where EmployeeID='" + Customer.strEmployeeID + "'";
                oledCmd    = new OleDbCommand(strUpdate, oledCon); //实例OleDbCommand对象
                if (oledCmd.ExecuteNonQuery() != 0)                //调用方法执行添加操作,不等于0添加成功
                {
                    intFalg = 1;                                   //修改成功
                }
                return(intFalg);
            }
            catch (Exception ee)
            {
                return(intFalg);
            }
        }
Beispiel #2
0
        private void bntOK_Click(object sender, EventArgs e)
        {
            if (txtUser.Text == "")
            {
                MessageBox.Show("用户名不能为空!", "提示");
                txtUser.Focus();
                return;
            }
            if (txtPassword.Text == "")
            {
                MessageBox.Show("密码不能为空!", "提示");
                txtPassword.Focus();
                return;
            }
            tbEmployeeClass tbClass = new tbEmployeeClass();

            tbClass.EmpEngish  = txtUser.Text;
            tbClass.EmpPasword = txtPassword.Text;
            tbEmployeeMenthod tbMenhod = new tbEmployeeMenthod();

            if (tbMenhod.tbEmpLog(tbClass) == 1)
            {
                frmMain frman = new frmMain();
                frman.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("登录失败!", "提示");
                txtPassword.Text = "";
                txtUser.Text     = "";
            }
        }
Beispiel #3
0
        }// end if

        #endregion
        public int tbEmpSecarfInfo(tbEmployeeClass Customer)
        {
            string strSecarf = null;
            int    intFalg   = 0;

            try
            {
                tbDai     = new tbDaiConnection(); //实例方法类
                oledCon   = tbDai.OledCon();       //打开数据库联接
                strSecarf = "select * from tb_Employee where EmpEngish ='" + Customer.EmpEngish + "'";

                oledCmd = new OleDbCommand(strSecarf, oledCon); //实例OleDbCommand对象
                oledDr  = oledCmd.ExecuteReader();              //调用方法
                oledDr.Read();
                if (oledDr.HasRows)
                {
                    intFalg = 1;
                }
                oledDr.Close();
                return(intFalg);
            }
            catch (Exception ee)
            {
                return(intFalg);
            }
        }// end if
Beispiel #4
0
        }// end fi

        #endregion
        #region//登录信息
        public int tbEmpLog(tbEmployeeClass Customer)
        {
            string strSecarf = null;
            int    intFalg   = 0;

            try
            {
                tbDai   = new tbDaiConnection();
                oledCon = tbDai.OledCon();

                strSecarf = "select * from tb_Employee where EmpEngish='" + Customer.EmpEngish + "' and EmpPasword='" + Customer.EmpPasword + "'";

                oledCmd = new OleDbCommand(strSecarf, oledCon);
                oledDr  = oledCmd.ExecuteReader();//
                oledDr.Read();
                if (oledDr.HasRows)
                {
                    intFalg = 1;
                }
                return(intFalg);
            }
            catch (Exception ee)
            {
                return(intFalg);
            }
        }// end if
Beispiel #5
0
        public int tbEmployeeAdd(tbEmployeeClass Customer)
        {
            int intFalg = 0;

            try
            {
                tbDai = new tbDaiConnection();               //实例一个联接数据库对象
                       oledCon = tbDai.OledCon();            //打开数据库
                string strAdd  = "insert into tb_Employee "; //创建添加字符串
                strAdd += "values('" + Customer.strEmployeeID + "','" + Customer.strEmpName + "','" + Customer.EmpEngish + "','" + Customer.EmpPasword + "','" + Customer.shEmpNation + "',";
                strAdd += "'" + Customer.shEmpSex + "','" + Customer.strEmpIDcard + "','" + Customer.strEmpSpecialty + "','" + Customer.strEmpOfficeTel + "',";
                strAdd += "'" + Customer.strEmpOICQ + "','" + Customer.strEmpEmail + "','" + Customer.shEmpState + "',";
                strAdd += "'" + Customer.shEmpCity + "','" + Customer.EmpWorkDate + "','" + Customer.EmpDemissionDate + "',";
                strAdd += "'" + Customer.strfldEmpRemark + "','" + Customer.byfldEmpWorkFlag + "','" + Customer.EmpRegDate + "')";
                oledCmd = new OleDbCommand(strAdd, oledCon);   //实例OleDbCommand对象
                if (oledCmd.ExecuteNonQuery() != 0)            //调用方法执行添加操作,不等于0添加成功
                {
                    intFalg = 1;                               //添加成功
                }
                return(intFalg);
            }
            catch (Exception ee)
            {
                return(intFalg);
            }
        }// end if
Beispiel #6
0
        }// end if

        #endregion
        #region//查询员工信息,返回,OleDbDataReader对象
        public OleDbDataReader tbEmpSecarf(tbEmployeeClass Customer)
        {
            string strSecarf = null;

            try
            {
                tbDai   = new tbDaiConnection(); //实例方法类
                oledCon = tbDai.OledCon();       //打开数据库联接
                if (Customer.strEmployeeID != "")
                {
                    strSecarf = "select * from tb_Employee where EmployeeID='" + Customer.strEmployeeID + "'";
                }
                else
                {
                    strSecarf = "select * from tb_Employee where fldEmpWorkFlag = false";
                }
                oledCmd = new OleDbCommand(strSecarf, oledCon); //实例OleDbCommand对象
                oledDr  = oledCmd.ExecuteReader();              //调用方法
                return(oledDr);
            }
            catch (Exception ee)
            {
                return(oledDr);
            }
        }// end if
Beispiel #7
0
        public int tbEmployeeDelete(tbEmployeeClass Customer)
        {
            int intFalg = 0;

            try
            {
                tbDai   = new tbDaiConnection();                  //实例一个联接数据库对象
                oledCon = tbDai.OledCon();                        //联接数据库
                string strUpdate = "update tb_Employee set ";     //创建删除字符串
                strUpdate += "fldEmpWorkFlag='" + Customer.byfldEmpWorkFlag + "'";
                strUpdate += " where EmployeeID='" + Customer.strEmployeeID + "'";
                oledCmd    = new OleDbCommand(strUpdate, oledCon);
                if (oledCmd.ExecuteNonQuery() != 0)
                {
                    intFalg = 1;//添加成功
                }
                return(intFalg);
            }
            catch (Exception ee)
            {
                return(intFalg);
            }
        }// end if