private void ProcessManualAttendanceDaily(List <Emp> emps, DateTime dt) { using (var ctx = new TAS2013Entities()) { // check for is attendance processed if (ctx.AttProcesses.Where(aa => aa.ProcessDate == dt).Count() > 0) { //process manual attendance ManualProcess mp = new ManualProcess(); mp.ManualProcessAttendance(dt, emps); //////////////////////////// //Check for Job Card// ////////////////////////// try { ProcessJobCard jc = new ProcessJobCard(); jc.ProcessJobCards(dt); } catch (Exception ex) { _myHelperClass.WriteToLogFile("Error at Create Function Process Job Card " + dt.ToString()); } ////Process Edit Attendance Entries ProcessEditAttendanceEntries pe = new ProcessEditAttendanceEntries(); pe.ProcessManualEditAttendance(dt, dt); } else { //Process new attendance ProcessAttendance pa = new ProcessAttendance(); pa.ProcessDailyAttendance(); } } }
void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { try { timer.Stop(); using (var context = new TAS2013Entities()) { // If Service download data on specific times if (context.Options.FirstOrDefault().DownTime == true) { List <DownloadTime> _downloadTime = new List <DownloadTime>(); _downloadTime = context.DownloadTimes.ToList(); foreach (var item in _downloadTime) { // Add 2 minutes extra to download time TimeSpan _dwnTimeEnd = (TimeSpan)item.DownTime + new TimeSpan(0, 2, 0); if (DateTime.Now.TimeOfDay >= item.DownTime && DateTime.Now.TimeOfDay <= _dwnTimeEnd) { GlobalSettings._dateTime = Properties.Settings.Default.MyDateTime; //Download Data from Devices DownloadDataFromDevices(); //set Process = 1 where Date varies from ranges AdjustPollData(); //Prcoess PollData to Attendance Data ProcessAttendance pa = new ProcessAttendance(); pa.ProcessDailyAttendance(); DailySummaryClass dailysum = new DailySummaryClass(DateTime.Today.AddDays(-20), DateTime.Today); } /////////Process Monthly Attendance////////// TimeSpan monthlyTStart = new TimeSpan(18, 50, 0); TimeSpan monthlyTEnd = new TimeSpan(18, 52, 0); if (DateTime.Now.TimeOfDay >= monthlyTStart && DateTime.Now.TimeOfDay <= monthlyTEnd) { DailySummaryClass dailysum = new DailySummaryClass(DateTime.Today.AddDays(-20), DateTime.Today); //DailySummaryClass dailysum = new DailySummaryClass(new DateTime(2015, 07, 27), new DateTime(2015, 07, 27)); ////Correct Flags for monthly DateTime dtStart = DateTime.Today.AddDays(-2); DateTime dtend = DateTime.Today; CorrectAttEntriesWithWrongFlags(dtStart, dtend); ProcessMonthlyAttendance(); } } } else { } } } catch { } finally { timer.Start(); } }
void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { try { timer.Stop(); using (var context = new TAS2013Entities()) { // If Service download data on specific times if (context.Options.FirstOrDefault().DownTime == true) { List<DownloadTime> _downloadTime = new List<DownloadTime>(); _downloadTime = context.DownloadTimes.ToList(); foreach (var item in _downloadTime) { // Add 2 minutes extra to download time TimeSpan _dwnTimeEnd = (TimeSpan)item.DownTime + new TimeSpan(0, 2, 0); if (DateTime.Now.TimeOfDay >= item.DownTime && DateTime.Now.TimeOfDay <= _dwnTimeEnd) { GlobalSettings._dateTime = Properties.Settings.Default.MyDateTime; //Download Data from Devices DownloadDataFromDevices(); //set Process = 1 where Date varies from ranges AdjustPollData(); //Prcoess PollData to Attendance Data ProcessAttendance pa = new ProcessAttendance(); pa.ProcessDailyAttendance(); DailySummaryClass dailysum = new DailySummaryClass(DateTime.Today.AddDays(-20), DateTime.Today); } /////////Process Monthly Attendance////////// TimeSpan monthlyTStart = new TimeSpan(18, 50, 0); TimeSpan monthlyTEnd = new TimeSpan(18, 52, 0); if (DateTime.Now.TimeOfDay >= monthlyTStart && DateTime.Now.TimeOfDay <= monthlyTEnd) { DailySummaryClass dailysum = new DailySummaryClass(DateTime.Today.AddDays(-20),DateTime.Today ); //DailySummaryClass dailysum = new DailySummaryClass(new DateTime(2015, 07, 27), new DateTime(2015, 07, 27)); ////Correct Flags for monthly DateTime dtStart = DateTime.Today.AddDays(-2); DateTime dtend = DateTime.Today; CorrectAttEntriesWithWrongFlags(dtStart, dtend); ProcessMonthlyAttendance(); } } } else { } } } catch { } finally { timer.Start(); } }
///////////////---------TIMER CLICKED--------///////////////// void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { try { timer.Stop(); using (var context = new TAS2013Entities()) { // If Service run at specific times if (context.Options.FirstOrDefault().DownTime == true) { List <DownloadTime> _downloadTime = new List <DownloadTime>(); _downloadTime = context.DownloadTimes.ToList(); foreach (var item in _downloadTime) { // Add 2 minutes extra to download time TimeSpan _dwnTimeEnd = (TimeSpan)item.DownTime + new TimeSpan(0, 2, 0); if (DateTime.Now.TimeOfDay >= item.DownTime && DateTime.Now.TimeOfDay <= _dwnTimeEnd) { GlobalSettings._dateTime = Properties.Settings.Default.MyDateTime; //Download Data from Devices DownloadDataFromDevices(); //set Process = 1 in PollData where Date varies from Date ranges AdjustPollData(); //Prcoess PollData to Attendance Data ProcessAttendance pa = new ProcessAttendance(); pa.ProcessDailyAttendance(); } /////////--------Process Monthly Attendance-------////////// // Monthly Process will be run in between 11:50 PM to 11:51 PM TimeSpan monthlyTStart = new TimeSpan(23, 50, 0); TimeSpan monthlyTEnd = new TimeSpan(23, 51, 0); if (DateTime.Now.TimeOfDay >= monthlyTStart && DateTime.Now.TimeOfDay <= monthlyTEnd) { DateTime dtStart = DateTime.Today.AddDays(-2); DateTime dtend = DateTime.Today; //Correct Attendance Status for Monthly Process CorrectAttEntriesWithWrongFlags(dtStart, dtend); //Process Monthly Attendance for Permanent ProcessMonthlyAttForPermanentFF(); //Process Monthly Attendance for Contractuals ProcessMonthlyAttForContractualFF(); DateTime dateStart = DateTime.Today.AddDays(-10); DateTime dateEnd = DateTime.Today; // Process Attendance Data into Daily Summary DailySummaryClass ds = new DailySummaryClass(dateStart, dateEnd); //////////-------Set Device Data Time on Sundays Night------//////////// if (DateTime.Today.DayOfWeek == DayOfWeek.Sunday) { AdjustDateTimeOfDevices(); } } } ///-----------Process Manual Attendance Request--------//////////// ProcessManualAttendanceRequest(); } else { // if user wants to process the attendance without intervals } } } catch { } finally { timer.Start(); } }