private DateTime? CalculateNextRunTime(OrderNotificationType notificationType, DateTime startPoint) { var orderPeriodSettings = _referenceManagement.GetOrderNotificationPeriodSettings(); var periodSettings = orderPeriodSettings.Single(ops => ops.OrderNotificationType == notificationType); if (!periodSettings.Period.HasValue) return null; DateTime? result = null; switch (periodSettings.OrderNotificationPeriodType) { case OrderNotificationPeriodType.BusinessDay: result = _businessDaysCalc.GetNextBusinessDay(startPoint, periodSettings.Period.Value); break; case OrderNotificationPeriodType.Hours: result = _businessDaysCalc.GetNextBusinessDateTime(startPoint, periodSettings.Period.Value); break; default: throw new ArgumentOutOfRangeException("Unknown OrderNotificationPeriodType. Current value: " + periodSettings.OrderNotificationPeriodType.ToString()); } return result; }
/// <summary> /// Argument Constructor /// </summary> /// <param name="notificationType"></param> /// <param name="orderNotificationType"></param> public OrderNotification(NotificationType notificationType, OrderNotificationType orderNotificationType) { _notificationType = notificationType; _orderNotificationType = orderNotificationType; }
/// <summary> /// Creates email subject text depending on the notification message /// </summary> /// <returns></returns> private string CreateSubject(OrderNotificationType orderNotificationType) { string subject = "TradeSharp " + orderNotificationType.ToString() + " Order"; return(subject); }