Punch Timing Processor
The AttendancePostService is a Windows Service that runs as a background job, processing mobile punch timing records into the daily attendance system. It uses Quartz.NET for scheduling and runs every 30 seconds during working hours.
Processing Flow
Quartz.NET Configuration
| Setting | Value | Description |
|---|---|---|
| Job Name | job1 | Job identity |
| Job Group | PunchTimingsJob | Job group name |
| Trigger Name | trigger1 | Trigger identity |
| Cron Expression | 0/30 * 7-23 * * ? | Every 30 seconds, 7 AM to 11 PM |
Cron Expression Breakdown
| Field | Value | Meaning |
|---|---|---|
| Seconds | 0/30 | Every 30 seconds |
| Minutes | * | Every minute |
| Hours | 7-23 | 7 AM to 11 PM |
| Day of Month | * | Every day |
| Month | * | Every month |
| Day of Week | ? | Any day of week |
The service is dormant from 11 PM to 7 AM, reducing unnecessary processing during non-working hours.
Service Lifecycle
The service performs a graceful shutdown with sched.Shutdown(true), waiting for any in-progress jobs to complete before stopping.
Logging
The service logs key events:
| Event | Log Message |
|---|---|
| Startup | "Punctime processor job : Successfully started." |
| Shutdown | "Punchtime processor Job : Successfully stopped." |
| Start Error | "Punchtime processor job : Error while initiating scheduler." |
| Stop Error | "Punchtime processor Job : Error while shutting down the scheduler." |
| Job Error | Exception logged via Scheduler.Logger.WriteLog(ex) |
Logs are written to the Log\Scheduler directory.
Source Files
| File | Purpose |
|---|---|
AttendancePostService.cs | Windows service entry point |
Models/Scheduler.cs | Quartz.NET scheduler + PunchTimingsJob |
Models/AttendanceDataManager.cs | PostRecords business logic |
Models/EmployeePunchTimings.cs | Punch timing data model |