private void dispatcherTimerClock_Tick(object sender, EventArgs e) { Time = DateTime.Now.ToLongTimeString(); var dTimeNow = DateTime.Now.ToString("yyyyMM"); if ((Int32.Parse(dTimeNow) > Int32.Parse(_connCfg.CurrYearMont))) { if (DataProcessor.flgStart != true && DataProcessor.dBStatus == true) { Console.WriteLine("New Month is coming"); //TODO Save last month to csv In the future DataProcessor.DeleteOldRecordsAsyn(3); //Cleaning up old than 3 months from SQL Server _connCfg.SaveCurrentMonth(dTimeNow); } } }