Beispiel #1
0
        private void ListDestination(string tgroupType)
        {
            List <ClientEmail> listOfClientEmail;

            if (groupType == "ISS" || groupType == "WSP")
            {
                listOfClientEmail = RepClientEmail.ListCertificates(tgroupType);
            }
            else
            {
                listOfClientEmail = RepClientEmail.List(tgroupType);
            }

            txtTotalEmail.Text = listOfClientEmail.Count.ToString();

            listBox1.Items.Clear();

            foreach (var clientEmail in listOfClientEmail)
            {
                listBox1.Items.Add(clientEmail.FirstName + " " + clientEmail.EmailAddress + " == " + clientEmail.Type);
            }
        }
Beispiel #2
0
        private void btnEmailCertificates_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            emailCount = Convert.ToInt32(txtEmailCount.Text);
            int numberOfEmailsSent = 0;

            string emailSubject = "";
            string emailBody    = webBrowser1.DocumentText;

            var listOfClientEmail = RepClientEmail.ListCertificates(groupType); // "Cert"

            foreach (var clientEmail in listOfClientEmail)
            {
                if (numberOfEmailsSent >= emailCount)
                {
                    break;
                }

                if (string.IsNullOrEmpty(clientEmail.EmailAddress))
                {
                    LogFile.WriteToTodaysLogFile("Email NOT sent to : " + clientEmail.FirstName + " Empty email address ", "DM0001");
                    continue;
                }
                string finalemailBody = "";



                if (clientEmail.CertificateType == "WSP")
                {
                    emailSubject = "Working Safely With Plant 2013 Certificate and Question and Answers";
                }
                else
                {
                    emailSubject = "FCM 2014 Final Construction Safety Workshop Presentations";
                }


                finalemailBody = "<html><body>" +
                                 " Dear " + clientEmail.FirstName + " " + emailBody;

                string emailinlineAttachment = txtinlineAttachment.Text;

                // iAttachmentLocation: @"C:\I_Daniel\Dropbox\I_Projects\FCM_Projects\Workshops\Dec2014\FullPresentation.pdf",

                var resp1 = FCMEmail.SendEmailSimple(
                    iRecipient: clientEmail.EmailAddress,
                    iSubject: emailSubject,
                    iBody: finalemailBody,
                    iAttachmentLocation: "",
                    iAttachmentLocation2: "",
                    inlineAttachment: emailinlineAttachment);

                LogFile.WriteToTodaysLogFile("Email sent to : " + clientEmail.EmailAddress + " " + clientEmail.FirstName, "DM0001");

                RepClientEmail.UpdateToEmailSent(clientEmail.UID);

                numberOfEmailsSent++;
            }
            Cursor.Current = Cursors.Arrow;
        }
Beispiel #3
0
        private void SendEmailToGroup(string tgroupType)
        {
            emailCount = Convert.ToInt32(txtEmailCount.Text);
            int numberOfEmailsSent = 0;

            // Client
            string emailSubject = "Construction Outcomes (former Federal Construction Management)";

            // string emailSubject = "Construction Safety Workshop ";

            string emailBody = webBrowser1.DocumentText;

            var listOfClientEmail = RepClientEmail.List(tgroupType);

            foreach (var clientEmail in listOfClientEmail)
            {
                if (numberOfEmailsSent >= emailCount)
                {
                    break;
                }

                if (string.IsNullOrEmpty(clientEmail.EmailAddress))
                {
                    LogFile.WriteToTodaysLogFile("Email NOT sent to : " + clientEmail.FirstName + " Empty email address ", "DM0001");
                    continue;
                }
                string finalemailBody = "";

                switch (tgroupType)
                {
                case "Client":
                    emailSubject   = "Construction Outcomes (former Federal Construction Management)";
                    finalemailBody = "<html><body>" +
                                     " Hello " + clientEmail.FirstName + " " + emailBody;
                    break;

                case "Sponsor":
                    finalemailBody = "<html><body>" +
                                     " Dear " + clientEmail.FirstName + " " + emailBody;
                    break;

                case "Presenter":
                    finalemailBody = "<html><body>" +
                                     " Dear " + clientEmail.FirstName + " " + emailBody;
                    break;

                case "Contractor":
                    emailSubject   = "Construction Safety Workshop - October 2014 - Not to be missed";
                    finalemailBody = "<html><body>" +
                                     " Dear " + clientEmail.FirstName + " " + emailBody;
                    break;
                }

                string emailinlineAttachment = txtinlineAttachment.Text;

                var resp1 = FCMEmail.SendEmailSimple(
                    iRecipient: clientEmail.EmailAddress,
                    iSubject: emailSubject,
                    iBody: finalemailBody,
                    iAttachmentLocation: txtAttachmentLocation.Text,
                    iAttachmentLocation2: txtAttachmentLocation2.Text,
                    inlineAttachment: emailinlineAttachment);

                LogFile.WriteToTodaysLogFile("Email sent to : " + clientEmail.EmailAddress + " " + clientEmail.FirstName, "DM0001");

                RepClientEmail.UpdateToEmailSent(clientEmail.UID);

                numberOfEmailsSent++;
            }
        }