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 10:59:31 +02:00
parent 267236a177
commit cafb59c9b0
4 changed files with 52 additions and 41 deletions

View File

@ -87,25 +87,28 @@ namespace TBF.BenchControl.Elde.FlowMeter
DateTime calibrationDue = flowMeterCfg.CalibValidDate;
IList<Config.CalendarEvent.ICalendarEvent> calendarEvents = new List<Config.CalendarEvent.ICalendarEvent>();
/// Calibration due date calendar event
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)))
if (calibrationDue > DateTime.MinValue.AddDays(36))
{
/// Weekly reminders (last 5 weeks)
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name,
string.Format(Strings.Calibration_due_date_is_0,
calibrationDue.Date.ToString("dd.MM.yyyy")),
false));
}
if ((calibrationDue != DateTime.MinValue) && (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("dd.MM.yyyy")),
true));
/// Calibration due date calendar event
calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name,
string.Format(Strings.Calibration_due_date_is_0,
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat))));
if (DateTime.Now.Date <= calibrationDue.AddDays(-7))
{
/// Weekly reminders (last 5 weeks)
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name,
string.Format(Strings.Calibration_due_date_is_0,
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
false));
}
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;
}

View File

@ -135,25 +135,28 @@ namespace TBF.BenchControl.MettlerToledo.Standard
DateTime calibrationDue = balanceCfg.CalibValidDate;
IList<Config.CalendarEvent.ICalendarEvent> calendarEvents = new List<Config.CalendarEvent.ICalendarEvent>();
/// Calibration due date calendar event
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)))
if (calibrationDue > DateTime.MinValue.AddDays(36))
{
/// Weekly reminders (last 5 weeks)
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name,
string.Format(Strings.Calibration_due_date_is_0,
calibrationDue.Date.ToString("dd.MM.yyyy")),
false));
}
if ((calibrationDue != DateTime.MinValue) && (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("dd.MM.yyyy")),
true));
/// Calibration due date calendar event
calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name,
string.Format(Strings.Calibration_due_date_is_0,
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat))));
if (DateTime.Now.Date <= calibrationDue.AddDays(-7))
{
/// Weekly reminders (last 5 weeks)
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name,
string.Format(Strings.Calibration_due_date_is_0,
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
false));
}
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;
}

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.26.1447.0")]
[assembly: AssemblyFileVersion("2.26.1447.0")]
[assembly: AssemblyVersion("2.26.1450.0")]
[assembly: AssemblyFileVersion("2.26.1450.0")]

View File

@ -126,8 +126,10 @@ namespace TBF.UI.Calendar
{
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;
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 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;
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);
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))
{
parametersList.Add(calEvent.Parameters);