Esempio n. 1
0
        public void SendProcess(int id, string recipient, string message, string status)
        {
            string sent  = "";
            bool   reply = false;

            if (status == "Pending")
            {
                RichTextboxUpdate2("Sending to " + recipient + "...");

                int retry = 0;

                do
                {
                    reply = sendMessage(recipient, message);
                    if (reply == false)
                    {
                        RichTextboxUpdate2("Retry Sending to " + recipient + "...");
                        retry++;
                    }
                } while (reply == false && retry < 5);


                if (reply)
                {
                    Class.Message m = new Class.Message();
                    Database.DBMessages.DBOutbox temp = DBOutbox.GetDataId(id);

                    Database.DBMessages.DBOutboxLog obj = new Database.DBMessages.DBOutboxLog();
                    obj.Add(temp.Date, temp.Recipient, temp.Message, "Sent"); // add to log



                    DBOutbox.Delete(id.ToString()); // delete from table outbox

                    messageSent++;
                    LabelUpdate();
                    sent = "Sent";
                }
                else
                {
                    DBOutbox.Update(id.ToString(), "status", "Unsuccessful");
                    sent = "Unsuccessful";
                }

                RichTextboxUpdate(sent);
            }
        }
Esempio n. 2
0
        private void metroTextButtonDelete_Click(object sender, EventArgs e)
        {
            try
            {
                string value = this.dataGridViewUnsent.SelectedCells[0].Value.ToString();

                DialogResult dialogResult = MessageBox.Show(" Are You Sure ? ", "Warning !", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                if (dialogResult == DialogResult.Yes)
                {
                    Database.DBMessages.DBOutbox del = new Database.DBMessages.DBOutbox();
                    del.Delete(value);

                    load_UnsuccessfullMessageGrid();
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
        }