Beispiel #1
0
        public void Send(MessageSend message)
        {
            CSBMessage objMail = new CSBMessage();

            foreach (string strAddress in message.Address)
            {
                objMail.Send(strAddress, message.Subject, message.Body);
                // TODO: Check if the user wants an email for every csbooster message
                //       Send an email
            }
        }
Beispiel #2
0
        public void Send(MessageSend message)
        {
            MailMessage objMail = new MailMessage();

            objMail.IsBodyHtml = true;
            objMail.Subject    = message.Subject;
            objMail.Body       = message.Body;
            foreach (string strAddress in message.Address)
            {
                objMail.To.Add(strAddress);
            }

            SmtpClient client = new SmtpClient();

            client.Send(objMail);
        }
Beispiel #3
0
        public void Send(MessageSend message)
        {
            string strTestFolder = ConfigSetting.TestModeFolder() + @"\";

            foreach (string addr in message.Address)
            {
                string       strFile = string.Format("{0}_{1}_{2}.html", message.CarrierType, addr, DateTime.Now.Ticks);
                FileStream   FS      = new FileStream(string.Concat(strTestFolder, strFile), FileMode.CreateNew);
                StreamWriter W       = new StreamWriter(FS, Encoding.UTF8);
                //W.WriteLine(message.Subject);
                //W.WriteLine();
                W.WriteLine(message.Body);

                W.Flush();
                W.Close();
                FS.Close();
            }
        }
Beispiel #4
0
        /// <summary>
        /// Liest alle Messages die noch nicht gesendet wurden und sendet diese mit dem richtigen Carrier
        /// </summary>
        /// <returns>Anzahl der Messages die versendet wurden</returns>
        public int SendNotification()
        {
            bool blnTestMode = ConfigSetting.TestMode();
            int  intCount    = 0;

            SqlConnection Conn = new SqlConnection(Helper.GetSiemeConnectionString());

            try
            {
                SqlCommand GetData = new SqlCommand();

                GetData.Connection     = Conn;
                GetData.CommandType    = CommandType.StoredProcedure;
                GetData.CommandTimeout = 300;
                GetData.CommandText    = "hisp_Notification_NotificationSend_GetPending";

                SqlDataAdapter da = new SqlDataAdapter(GetData);
                DataSet        ds = new DataSet();
                da.Fill(ds);

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    MessageSend objMessageSend = new MessageSend(dr, blnTestMode, Helper.GetSiemeConnectionString());
                    if (objMessageSend.Send())
                    {
                        intCount++;
                    }
                }
            }
            finally
            {
                if (Conn != null && Conn.State != ConnectionState.Closed)
                {
                    Conn.Close();
                }
            }

            return(intCount);
        }