Example #1
0
        private void SendAlertSignalEmail(InternalSignal signal, NamedValueSet props)
        {
            try
            {
                var smtpHost = props.GetValue <string>(AlertRule.MailHost);
                IEnumerable <string> recipients = ResolveMultipleEmailAddresses(props.GetArray <string>(AlertRule.MailTo));
                string sender      = ResolveSingleEmailAddress(props.GetValue <string>(AlertRule.MailFrom));
                var    email       = new MailMessage();
                string instanceMsg = GetInstanceMsg(signal.ReminderCount);
                signal.ReminderCount += 1;
                email.Subject         =
                    $"QDS Alert {EnvHelper.EnvName(IntClient.Target.ClientInfo.ConfigEnv)}. {signal.RuleName}: {signal.Status}";

                if (signal.Status == AlertStatus.Alerted)
                {
                    email.Subject += $"({instanceMsg})";
                }
                var body = new StringBuilder(signal.SignalMessage);
                if (props.GetValue <bool>("rule.DebugEnabled", false))
                {
                    body.AppendLine();
                    body.AppendLine();
                    body.AppendLine("[debug-begin]");
                    props.LogValues(text => body.AppendLine("  " + text));
                    body.AppendLine("[debug-end]");
                }
                email.Body = body.ToString();
                SendEmail(smtpHost, email, sender, recipients);
            }
            catch (Exception excp)
            {
                ReportUncaughtError("EmailAlertSignal", signal.RuleName, excp, props);
            }
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="nameSpace"></param>
        /// <param name="properties"></param>
        /// <returns></returns>
        protected IBusinessCalendar ExtractPaymentCalendar(ICoreCache cache, string nameSpace, NamedValueSet properties)
        {
            string[]          paymentCalendars = properties.GetArray <string>("PaymentCenters");
            IBusinessCalendar paymentCalendar  = null;

            if (paymentCalendars != null)
            {
                paymentCalendar = BusinessCenterHelper.ToBusinessCalendar(cache, paymentCalendars, nameSpace);
            }
            return(paymentCalendar);
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="nameSpace"></param>
        /// <param name="properties"></param>
        /// <returns></returns>
        protected IBusinessCalendar ExtractFixingCalendar(ICoreCache cache, string nameSpace, NamedValueSet properties)
        {
            string[]          fixingCalendars = properties.GetArray <string>("FixingCenters");
            IBusinessCalendar fixingCalendar  = null;

            if (fixingCalendars != null)
            {
                fixingCalendar = BusinessCenterHelper.ToBusinessCalendar(cache, fixingCalendars, nameSpace);
            }
            return(fixingCalendar);
        }