/// <summary> /// This function add data of attendence to the attendence record /// </summary> private void btnLogout_Click(object sender, EventArgs e) { //Loop through every employee in employee list foreach (Employee employee in Payroll.getInstance.EmployeeList) { //it checks that employee id is equal to textbox text. if (employee.EmployeeId == txtEmployeeId.Text) { //Form object of attendence //set attendence data members to textboxes text //Add them to attendence record //And show them to the Data Grid View attendence = new Attendence(); attendence.AttendenceId = id; attendence.LoginTime = loginTime; attendence.LogoutTime = DateTime.Now; attendence.AttendenceDate = DateTime.Now; Employee.AttendenceRecord.Add(attendence); BindingSource source = new BindingSource(); source.DataSource = Employee.AttendenceRecord; dgvAttendence.DataSource = source; } } btnLogout.Enabled = false; }
/// <summary> /// Mark the attendence of Employees /// </summary> /// <param name="attendence">Attendence class object</param> public void MarkAttendence(Attendence attendence) { AttendenceRecord.Add(attendence); }