private void chkbtnOutdoor_Click(object sender, EventArgs e) { try { if (chkbtnOutdoor.Checked) { frmAddEditLeaveApplication frm = new frmAddEditLeaveApplication(); frm.EmployeeID = _selectedAttendanceRecord.EmployeeID; frm.SelectedLeavFormTypeID = (new ServiceLeaveApplication()).LEAVE_TYPE_OUTDOOR_ID; frm.dtLeaveApplicationDate.Value = _selectedAttendanceRecord.AttendanceDate; frm.dtFromDate.Value = frm.dtFromTime.Value = frm.dtToDate.Value = frm.dtToTime.Value = _selectedAttendanceRecord.AttendanceDate; if (frm.ShowDialog() == DialogResult.OK) { _selectedAttendanceRecord.LeaveApplicationID = frm.LeaveApplicationID; vLeaveApplication leave = (new ServiceLeaveApplication()).GetLeaveApplicationInfoViewRecord(_selectedAttendanceRecord.LeaveApplicationID); txtRemarks.Text = string.Format("{0} ({1})", leave.LeaveFormTypeName, leave.LeaveTypeName); dtOnSiteInTime.Value = leave.FromTime.Value; dtOnSiteOutTime.Value = leave.ToTime.Value; } } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "PageDailyAttendance::chkbtnOutdoor_Click", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void chkbtnLeave_Click(object sender, EventArgs e) { chkbtnPresent.Checked = false; chkbtnAbsent.Checked = false; chkbtnOutdoor.Checked = false; try { frmAddEditLeaveApplication frm = null; if (chkbtnLeave.Checked) { selectedLeaveType = true; if (_selectedAttendanceRecord.LeaveApplicationID == 0) { frm = new frmAddEditLeaveApplication(); frm.EmployeeID = _selectedAttendanceRecord.EmployeeID; frm.SelectedLeavFormTypeID = (new ServiceLeaveApplication()).LEAVE_TYPE_LEAVE_ID; frm.dtLeaveApplicationDate.Value = _selectedAttendanceRecord.AttendanceDate; frm.dtFromDate.Value = frm.dtFromTime.Value = frm.dtToDate.Value = frm.dtToTime.Value = _selectedAttendanceRecord.AttendanceDate; if (frm.ShowDialog() == DialogResult.OK) { _selectedAttendanceRecord.LeaveApplicationID = frm.LeaveApplicationID; vLeaveApplication leave = (new ServiceLeaveApplication()).GetLeaveApplicationInfoViewRecord(_selectedAttendanceRecord.LeaveApplicationID); txtRemarks.Text = string.Format("{0} ({1})", leave.LeaveFormTypeName, leave.LeaveTypeName); _selectedAttendanceRecord.AttendanceType = ATTENDANCE_TYPE.LEAVE; dtOnSiteInTime.Value = leave.FromTime.Value; dtOnSiteOutTime.Value = leave.ToTime.Value; } } else { //frm = new frmAddEditLeaveApplication(_selectedAttendanceRecord.LeaveApplicationID); MessageBox.Show("LEAVE is already entered...", "Caution", MessageBoxButtons.OK); } } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "PageManualAttendance::chkbtnLeave_CheckedChanged", MessageBoxButtons.OK, MessageBoxIcon.Error); } }