Example #1
0
        private void Send()
        {
            try
            {
                string       userMail = "";
                MySqlCommand cmd1     = new MySqlCommand
                {
                    Connection  = conn,
                    CommandText = string.Format("SELECT Users.Email FROM Orders INNER JOIN Users on(Orders.User_id=Users.User_id) WHERE Orders.Order_id='" + dataGridView1.CurrentRow.Cells[0].Value + "';")
                };
                MySqlDataReader reader = cmd1.ExecuteReader();
                while (reader.Read())
                {
                    userMail = reader.GetString(0);
                }
                reader.Close();

                Mailer.Generator generator = new Mailer.Generator();
                string           body      = generator.GenerateCompleteOrderBody((int)dataGridView1.CurrentRow.Cells[0].Value, "SunComp");
                string           subject   = generator.GenerateSubject("SunComp", (int)dataGridView1.CurrentRow.Cells[0].Value);
                Mailer.Mailer    mailer    = new Mailer.Mailer();
                mailer.SendMail(userMail, "*****@*****.**", "", subject, body);
            }
            catch (Exception ex)
            {
            }
        }
Example #2
0
        private void Send(string detail)
        {
            try
            {
                string       userMail = "";
                MySqlCommand cmd1     = new MySqlCommand
                {
                    Connection  = conn,
                    CommandText = string.Format("SELECT Users.Email FROM Orders INNER JOIN Users on(Orders.User_id=Users.User_id) WHERE Orders.Order_id='" + OrderId + "';")
                };
                MySqlDataReader reader = cmd1.ExecuteReader();
                while (reader.Read())
                {
                    userMail = reader.GetString(0);
                }
                reader.Close();

                Mailer.Generator generator = new Mailer.Generator();
                string           body      = generator.GenerateActiveBody(detail, OrderId, "SunComp");
                string           subject   = generator.GenerateSubject("SunComp", OrderId);
                Mailer.Mailer    mailer    = new Mailer.Mailer();
                mailer.SendMail(userMail, "*****@*****.**", "", subject, body);
            }
            catch (Exception ex)
            {
            }
        }
Example #3
0
        private void Send()
        {
            string       userMail = "";
            MySqlCommand cmd1     = new MySqlCommand
            {
                Connection  = conn,
                CommandText = string.Format("SELECT Users.Email FROM Users INNER JOIN Orders on(Orders.User_id=Users.User_id) WHERE Orders.Order_id='" + Index + "';")
            };
            MySqlDataReader reader = cmd1.ExecuteReader();

            while (reader.Read())
            {
                userMail = reader.GetString(0);
            }
            reader.Close();

            Mailer.Generator generator = new Mailer.Generator();
            string           body      = generator.GenerateCompleteBody(Login, Index, "ServiCEntre");
            string           subject   = generator.GenerateSubject("ServiCEntre", Index);

            Mailer.Mailer mailer = new Mailer.Mailer();
            mailer.SendMail(userMail, "*****@*****.**", "", subject, body);

            MessageBox.Show("Замовлення виконано!");
        }
Example #4
0
        private void Send()
        {
            try
            {
                //////////////////get_orderID
                int          orderId = 0;
                MySqlCommand cmd1    = new MySqlCommand
                {
                    Connection  = conn,
                    CommandText = string.Format("SELECT MAX(Order_id) FROM Orders;")
                };
                MySqlDataReader reader = cmd1.ExecuteReader();
                while (reader.Read())
                {
                    orderId = reader.GetInt32(0);
                }
                reader.Close();
                /////////////////////USer Email
                string userMail = "";
                cmd1 = new MySqlCommand
                {
                    Connection  = conn,
                    CommandText = string.Format("SELECT Users.Email FROM Orders INNER JOIN Users on(Orders.User_id=Users.User_id) WHERE Orders.Order_id='" + orderId + "';")
                };
                reader = cmd1.ExecuteReader();
                while (reader.Read())
                {
                    userMail = reader.GetString(0);
                }
                reader.Close();

                Mailer.Generator generator = new Mailer.Generator();
                string           body      = generator.GenerateNewOrderBody(orderId, "SunComp");
                string           subject   = generator.GenerateSubject("SunComp", orderId);
                Mailer.Mailer    mailer    = new Mailer.Mailer();
                mailer.SendMail(userMail, "*****@*****.**", "", subject, body);
            }
            catch (Exception ex)
            {
            }
        }
Example #5
0
        public static void RemoteMessage(LoggingSource loggingSource,
                                         LoggingType loggingType,
                                         string message,
                                         params object[] args)
        {
            string formattedMessage = string.Format(message, args);
            bool   isSuccess;

            if ((loggingSource & LoggingSource.Mail) == LoggingSource.Mail)
            {
                string subject      = loggingType + " логирование с сайта";
                var    mailerConfig = new MailerConfig {
                    IsHtmlBody   = false,
                    DisplayName  = subject,
                    SendToAdmins = true
                };

                var    mailer      = new Mailer.Mailer();
                string mailAddress = loggingType.HasFlag(LoggingType.Error) ? MailAddresses.EXCEPTIONS : MailAddresses.SUPPORT;
                isSuccess = mailer.SendMail(mailAddress, mailAddress, subject, formattedMessage, mailerConfig);

                if (!isSuccess)
                {
                    LogTo(LoggerName.Errors).ErrorFormat(
                        "LoggerWrapper.RemoteMessage не удалось отправить сообщение по почте: {0}",
                        formattedMessage);
                }
            }

            /*if ((loggingSource & LoggingSource.Db) == LoggingSource.Db) {
             *  isSuccess = _loggerQuery.Create(loggingType, formattedMessage);
             *
             *  if (!isSuccess) {
             *      LogTo(LoggerName.Errors).ErrorFormat(
             *          "LoggerWrapper.RemoteMessage не удалось записать сообщение в БД: {0}",
             *          formattedMessage);
             *  }
             * }*/
        }
Example #6
0
        private void Send()
        {
            //////////////////get_orderID
            int          orderId = 0;
            MySqlCommand cmd1    = new MySqlCommand
            {
                Connection  = conn,
                CommandText = string.Format("SELECT MAX(Order_id) FROM Orders;")
            };
            MySqlDataReader reader = cmd1.ExecuteReader();

            while (reader.Read())
            {
                orderId = reader.GetInt32(0);
            }
            reader.Close();
            /////////////////////USer Email
            string userMail = "";

            cmd1 = new MySqlCommand
            {
                Connection  = conn,
                CommandText = string.Format("SELECT Email FROM Users WHERE Login='******';")
            };
            reader = cmd1.ExecuteReader();
            while (reader.Read())
            {
                userMail = reader.GetString(0);
            }
            reader.Close();

            Mailer.Generator generator = new Mailer.Generator();
            string           body      = generator.GenerateBody(Login, orderId, "ServiCEntre");
            string           subject   = generator.GenerateSubject("ServiCEntre", orderId);

            Mailer.Mailer mailer = new Mailer.Mailer();
            mailer.SendMail(userMail, "*****@*****.**", "", subject, body);
        }