Exemple #1
0
        private void scan_FormClosedOut(object sender, FormClosedEventArgs e)
        {
            String employeeID   = employeeId;
            String EmployeeName = null;
            {
                DBConnect       d     = new DBConnect();
                String          query = "Select name from employee where employeeNo = '" + employeeID + "'";
                MySqlCommand    c     = new MySqlCommand(query, d.con);
                MySqlDataReader r     = c.ExecuteReader();

                while (r.Read())
                {
                    EmployeeName = r[0].ToString();
                }
            }

            DBConnect db   = new DBConnect();
            String    date = DateTime.Now.ToString("yyyy-MM-dd");
            String    time = DateTime.Now.ToString("HH:mm");

            String       q   = "update employee_attendance SET outTime = '" + time + "' where employeeNo = '" + employeeID + "' and date = '" + date + "'";
            MySqlCommand cmd = new MySqlCommand(q, db.con);

            cmd.ExecuteNonQuery();

            AutoClosingMessageBoxes.Show(EmployeeName + " OUT " + date + " " + time, "Done", 2000);
        }
Exemple #2
0
        private void AttendanceScanBarcodeClosedIN(object sender, FormClosedEventArgs e)
        {
            try
            {
                String          q   = "SELECT name FROM employee WHERE employeeNo='" + employeeID + "'";
                MySqlCommand    cmd = new MySqlCommand(q, db.con);
                MySqlDataReader r   = cmd.ExecuteReader();

                while (r.Read())
                {
                    employeeName = r["name"].ToString();
                }
                this.date = DateTime.Now.ToString("yyyy-MM-dd");
                this.time = DateTime.Now.ToString("HH:MM:ss");
                //MessageBox.Show(time);
                AutoClosingMessageBoxes.Show("User : "******"-IN- On " + date + " At " + time, scanType, 5000);
                String qu = "INSERT INTO employee_attendance(employeeNo,name,date,inTime) VALUES('" + employeeID + "','" + employeeName + "','" + date + "','" + time + "')";

                //String qu = "INSERT INTO `employee_attendance`( `employeeNo`, `name`, `date`, `inTime`, `outTime`, `timeWorked`)VALUES('x','xx','xxx','xxxx','xxxxx','xxxxxx')";
                //MessageBox.Show(qu);
                MySqlCommand cmd1 = new MySqlCommand(qu, db.con);
                cmd1.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }