private void mitEmailReport_Click(object sender, RoutedEventArgs e)
        {
            int    intCounter;
            int    intNumberOfRecords;
            string strEmailAddress;

            try
            {
                EmailEmployees EmailEmployees = new EmailEmployees();
                EmailEmployees.ShowDialog();

                CreateReport();

                intNumberOfRecords = MainWindow.TheEmailListDataSet.employees.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strEmailAddress = MainWindow.TheEmailListDataSet.employees[intCounter].EmailAddress;

                    TheSendEmailClass.SendEmail(strEmailAddress, gstrHeader, gstrMessage);
                }

                TheMessagesClass.InformationMessage("Email Sent");
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Deactivate Employee Tools // Email Report Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Пример #2
0
        private void mitSendEmail_Click(object sender, RoutedEventArgs e)
        {
            string strHeader;
            string strMessage;
            string strFinalMessage;
            string strErrorMessage = "";
            bool   blnFatalError   = false;
            int    intCounter;
            int    intNumberOfRecords;
            string strEmailAddress;

            strHeader = txtSubject.Text;
            if (strHeader == "")
            {
                blnFatalError    = true;
                strErrorMessage += "The Subject Was Not Entered\n";
            }
            strMessage = txtMessage.Text;
            if (strMessage == "")
            {
                blnFatalError    = true;
                strErrorMessage += "The Message Was Not Entered\n";
            }
            if (blnFatalError == true)
            {
                TheMessagesClass.ErrorMessage(strErrorMessage);
                return;
            }

            EmailEmployees EmailEmployees = new EmailEmployees();

            EmailEmployees.ShowDialog();

            strHeader += " - DO NOT REPLY";

            strFinalMessage  = "<h1>" + strHeader + "</h1>";
            strFinalMessage += "<h3>From " + MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].FirstName + " " + MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].LastName + "</h3>";
            strFinalMessage += "<p>" + strMessage + "</p>";

            intNumberOfRecords = MainWindow.TheEmailListDataSet.employees.Rows.Count - 1;

            for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
            {
                strEmailAddress = MainWindow.TheEmailListDataSet.employees[intCounter].EmailAddress;

                TheSendEmailClass.SendEmail(strEmailAddress, strHeader, strFinalMessage);
            }

            TheMessagesClass.InformationMessage("Email Sent");

            ClearControls();
        }