Bug fix : Serving events from components, FlowMeter a BalanceDev calibration due date, ver. 2.26.1450

This commit is contained in:
Milan Hanajik
2020-04-21 13:34:18 +02:00
parent 267236a177
commit cafb59c9b0
4 changed files with 52 additions and 41 deletions
+21 -18
View File
@@ -87,25 +87,28 @@ namespace TBF.BenchControl.Elde.FlowMeter
DateTime calibrationDue = flowMeterCfg.CalibValidDate; DateTime calibrationDue = flowMeterCfg.CalibValidDate;
IList<Config.CalendarEvent.ICalendarEvent> calendarEvents = new List<Config.CalendarEvent.ICalendarEvent>(); IList<Config.CalendarEvent.ICalendarEvent> calendarEvents = new List<Config.CalendarEvent.ICalendarEvent>();
/// Calibration due date calendar event if (calibrationDue > DateTime.MinValue.AddDays(36))
calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name,
string.Format(Strings.Calibration_due_date_is_0,
calibrationDue.Date.ToString("dd.MM.yyyy"))));
if ((calibrationDue != DateTime.MinValue) && (DateTime.Now.Date <= calibrationDue.AddDays(-7)))
{ {
/// Weekly reminders (last 5 weeks) /// Calibration due date calendar event
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name, calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name,
string.Format(Strings.Calibration_due_date_is_0, string.Format(Strings.Calibration_due_date_is_0,
calibrationDue.Date.ToString("dd.MM.yyyy")), calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat))));
false)); if (DateTime.Now.Date <= calibrationDue.AddDays(-7))
} {
if ((calibrationDue != DateTime.MinValue) && (DateTime.Now.Date <= calibrationDue.Date)) /// Weekly reminders (last 5 weeks)
{ calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name,
/// Daily reminders (last 5 days) string.Format(Strings.Calibration_due_date_is_0,
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name, calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
string.Format(Strings.Calibration_due_date_is_0, false));
calibrationDue.Date.ToString("dd.MM.yyyy")), }
true)); if (DateTime.Now.Date <= calibrationDue.Date)
{
/// Daily reminders (last 5 days)
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name,
string.Format(Strings.Calibration_due_date_is_0,
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
true));
}
} }
return calendarEvents; return calendarEvents;
} }
@@ -135,25 +135,28 @@ namespace TBF.BenchControl.MettlerToledo.Standard
DateTime calibrationDue = balanceCfg.CalibValidDate; DateTime calibrationDue = balanceCfg.CalibValidDate;
IList<Config.CalendarEvent.ICalendarEvent> calendarEvents = new List<Config.CalendarEvent.ICalendarEvent>(); IList<Config.CalendarEvent.ICalendarEvent> calendarEvents = new List<Config.CalendarEvent.ICalendarEvent>();
/// Calibration due date calendar event if (calibrationDue > DateTime.MinValue.AddDays(36))
calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name,
string.Format(Strings.Calibration_due_date_is_0,
calibrationDue.Date.ToString("dd.MM.yyyy"))));
if ((calibrationDue != DateTime.MinValue) && (DateTime.Now.Date <= calibrationDue.AddDays(-7)))
{ {
/// Weekly reminders (last 5 weeks) /// Calibration due date calendar event
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name, calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name,
string.Format(Strings.Calibration_due_date_is_0, string.Format(Strings.Calibration_due_date_is_0,
calibrationDue.Date.ToString("dd.MM.yyyy")), calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat))));
false)); if (DateTime.Now.Date <= calibrationDue.AddDays(-7))
} {
if ((calibrationDue != DateTime.MinValue) && (DateTime.Now.Date <= calibrationDue.Date)) /// Weekly reminders (last 5 weeks)
{ calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name,
/// Daily reminders (last 5 days) string.Format(Strings.Calibration_due_date_is_0,
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name, calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
string.Format(Strings.Calibration_due_date_is_0, false));
calibrationDue.Date.ToString("dd.MM.yyyy")), }
true)); if (DateTime.Now.Date <= calibrationDue.Date)
{
/// Daily reminders (last 5 days)
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name,
string.Format(Strings.Calibration_due_date_is_0,
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
true));
}
} }
return calendarEvents; return calendarEvents;
} }
+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("2.26.1447.0")] [assembly: AssemblyVersion("2.26.1450.0")]
[assembly: AssemblyFileVersion("2.26.1447.0")] [assembly: AssemblyFileVersion("2.26.1450.0")]
+8 -3
View File
@@ -126,8 +126,10 @@ namespace TBF.UI.Calendar
{ {
IList<Events.Entities.Event> eventsToTrigger = new List<Events.Entities.Event>(); IList<Events.Entities.Event> eventsToTrigger = new List<Events.Entities.Event>();
foreach (var calEvent in eventsFromComponents) for (int i = eventsFromComponents.Count - 1; i >= 0; i--)
{ {
ICalendarEvent calEvent = eventsFromComponents[i];
AutoAction a = calEvent.AutoAction; AutoAction a = calEvent.AutoAction;
if (a == AutoAction.Notification || a == AutoAction.Warning || a == AutoAction.Error || a == AutoAction.FatalErr) if (a == AutoAction.Notification || a == AutoAction.Warning || a == AutoAction.Error || a == AutoAction.FatalErr)
{ {
@@ -160,8 +162,10 @@ namespace TBF.UI.Calendar
var session = (parentSession != null) ? parentSession : Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); var session = (parentSession != null) ? parentSession : Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
var customEvents = (customEventsFromDB != null) ? customEventsFromDB : session.QueryOver<CustomEvent>() .List(); var customEvents = (customEventsFromDB != null) ? customEventsFromDB : session.QueryOver<CustomEvent>() .List();
foreach (var calEvent in customEvents) for (int i = customEvents.Count - 1; i >= 0; i--)
{ {
CustomEvent calEvent = customEvents[i];
AutoAction a = calEvent.AutoAction; AutoAction a = calEvent.AutoAction;
if (a == AutoAction.Notification || a == AutoAction.Warning || a == AutoAction.Error || a == AutoAction.FatalErr) if (a == AutoAction.Notification || a == AutoAction.Warning || a == AutoAction.Error || a == AutoAction.FatalErr)
{ {
@@ -234,8 +238,9 @@ namespace TBF.UI.Calendar
ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
var customEventsFromDB = session.QueryOver<CustomEvent>().List(); var customEventsFromDB = session.QueryOver<CustomEvent>().List();
foreach (var calEvent in customEventsFromDB) for (int i = customEventsFromDB.Count - 1; i >= 0; i--)
{ {
CustomEvent calEvent = customEventsFromDB[i];
if (calEvent.AutoAction == selectedAction && Config.CalendarEvent.Utils.IsCalendarEventTrigerred(calEvent, currentTime)) if (calEvent.AutoAction == selectedAction && Config.CalendarEvent.Utils.IsCalendarEventTrigerred(calEvent, currentTime))
{ {
parametersList.Add(calEvent.Parameters); parametersList.Add(calEvent.Parameters);