Пример #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)
            {
            }
        }
Пример #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)
            {
            }
        }
Пример #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("Замовлення виконано!");
        }
Пример #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)
            {
            }
        }
Пример #5
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);
        }