Пример #1
0
        public override void Send(MailEntity entity, Dictionary <string, string> parameters)
        {
            if (entity == null)
            {
                return;
            }
            string url;

            if (!parameters.TryGetValue("url", out url) || url == null || url.Trim().Length <= 0)
            {
                throw new ConfigurationErrorsException("Not config 'url' for restful mail sender.");
            }
            string method;

            if (!parameters.TryGetValue("method", out method) || method == null || method.Trim().Length <= 0)
            {
                throw new ConfigurationErrorsException("Not config 'method' for restful mail sender.");
            }

            SoapEntityMapping.Add <MailEntity>();
            SoapEntityMapping.Add <MailTemplateEntity>();
            SoapEntityMapping.Add <VariableTable>();
            SoapEntityMapping.Add <Variable>();
            SoapClient.Invoke(url, method, entity);
        }
Пример #2
0
 public void EmitLog(LogEntry log)
 {
     SoapEntityMapping.Add <LogEntry>();
     SoapEntityMapping.Add <ExtendedPropertyData>();
     SoapClient.InvokeAsync(m_Url, m_MethodName, null, ex =>
     {
         string message = string.Format("Write log failed.\r\n\r\n Error Info: {0}. \r\n\r\n Log Type: {1}. \r\n\r\n Log Info: {2}", ex.ToString(), this.GetType().AssemblyQualifiedName, log.SerializationWithoutException());
         Logger.WriteEventLog(message, System.Diagnostics.EventLogEntryType.Error);
     }, log);
 }