protected void btnClearData_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); HROne.Import.ImportAttendancePreparationProcess m_importProcess = new HROne.Import.ImportAttendancePreparationProcess(dbConn, Session.SessionID, WebUtils.GetCurUser(Session).UserID, CurID); if (m_importProcess.ClearUploadedData(errors, CurID)) { errors.addError("Uploaded records cleared"); } loadObject(); }
protected void btnConfirmProcess_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); HROne.Import.ImportAttendancePreparationProcess m_importProcess = new HROne.Import.ImportAttendancePreparationProcess(dbConn, Session.SessionID, WebUtils.GetCurUser(Session).UserID, CurID); if (!m_importProcess.ConfirmAttendanceProcess(errors)) { errors.addError("Confirm failed, please note that Attendance Process must be " + EAttendancePreparationProcess.STATUS_NORMAL_DESC + " to be confirmed"); } else { errors.addError("Attendance Process confirmed! It is locked and not allow for further operations"); } loadObject(); }
protected void btnGenerateCND_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); EAttendancePreparationProcess m_process = EAttendancePreparationProcess.GetObject(dbConn, CurID); if (m_process != null) { DBFilter m_rpFilter = new DBFilter(); OR m_or = new OR(); m_or.add(new NullTerm("EmpRPEffTo")); m_or.add(new Match("EmpRPEffTo", ">=", HROne.CommonLib.Utility.LastDateOfMonth(AppUtils.ServerDateTime()))); m_rpFilter.add(m_or); m_rpFilter.add(new Match("EmpRPEffFr", "<=", HROne.CommonLib.Utility.LastDateOfMonth(AppUtils.ServerDateTime()))); DBFilter m_isRPWinsonFilter = new DBFilter(); m_rpFilter.add(new IN("EmpRPID", "SELECT EmpRPID FROM EmpRPWinson", m_isRPWinsonFilter)); DBFilter m_EmpPersonalFilter = new DBFilter(); m_EmpPersonalFilter.add(new IN("EmpID", "SELECT EmpID FROM EmpRecurringPayment", m_rpFilter)); ArrayList empList = EEmpPersonalInfo.db.select(dbConn, m_EmpPersonalFilter); HROne.Import.ImportAttendancePreparationProcess m_import = new HROne.Import.ImportAttendancePreparationProcess(dbConn, Session.SessionID, WebUtils.GetCurUser(Session).UserID, CurID); string exportFileName = System.IO.Path.GetTempFileName(); System.IO.File.Delete(exportFileName); exportFileName += ".xls"; HROne.Export.ExcelExport export = new HROne.Export.ExcelExport(exportFileName); DataSet dataSet = m_import.GenerateCND(dbConn, empList, exportFileName, CurID); export.Update(dataSet); WebUtils.TransmitFile(Response, exportFileName, "CND_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xls", true); } else { errors.addError("Failed to open batch"); } }