private void btnLogin_Click(object sender, EventArgs e) { DatabaseHandle dbHandle = new DatabaseHandle(); _employee = new Employee(); _employee = dbHandle.CheckUser(txtPW.Text); if (_employee.Name != null) { lbStatus.Text = "Welcome " + _employee.Name; if (_employee.ClockInStatus == 2) { SetButtonClockIn(true); } else { SetButtonClockIn(false); } } else { lbStatus.Text = "Wrong Password!"; } }
private void InitializeData() { DataTable dt = new DataTable(); DatabaseHandle dbHandle = new DatabaseHandle(); dt = dbHandle.ListOfUser(); cbName.DisplayMember = "first_name"; cbName.ValueMember = "employee_id"; cbName.DataSource = dt; }
private void btnCreateUser_Click(object sender, EventArgs e) { DatabaseHandle dbHandle = new DatabaseHandle(); if (txtCreatePW.Text != txtCFPW.Text) { lbCreateStatus.Text = "PW not match"; } else { if (dbHandle.AddNewEmployee(txtCreateName.Text, txtCFPW.Text) > 0) { lbCreateStatus.Text = "Create Complete!"; } } }
private void btnClockIn_Click(object sender, EventArgs e) { DatabaseHandle dbHandle = new DatabaseHandle(); if (_employee != null) { if (dbHandle.AddEmployeeTime(_employee.Name) > 0) { if (dbHandle.UpdateUserStatus(_employee.EmployeeID, 1) > 0) { txtPW.Text = ""; btnClockIn.Enabled = false; btnClockOut.Enabled = false; _employee = null; } } } else { lbStatus.Text = "Please Login"; } }
private void btnClockOut_Click(object sender, EventArgs e) { DatabaseHandle dbHandle = new DatabaseHandle(); if (_employee.Name != null) { if (dbHandle.UpdateClockOut(_employee.Name) > 0) { if (dbHandle.UpdateUserStatus(_employee.EmployeeID, 2) > 0) { txtPW.Text = ""; lbStatus.Text = "Good Bye " + _employee.Name; _employee = null; btnClockIn.Enabled = false; btnClockOut.Enabled = false; } } } else { lbStatus.Text = "Pease Login"; } }