示例#1
0
        private bool getEmailDistributionListSendAttachment(bool isSuccessful, string fileName, string threadName, string desFilePath)
        {
            bool success = true;

            IAPL.Transport.Transactions.ServerDetails emailDetails = new ServerDetails();

            IAPL.Transport.Data.DbTransaction db = new IAPL.Transport.Data.DbTransaction();

            db.emailDistributionList(false, messageInformation.MessageCode, messageInformation.ERP, 0);

            System.Data.DataTable dTable = db.CommonDataTable;
            string emailSMTP             = IAPL.Transport.Configuration.Config.GetAppSettingsValue("emailnotificationsmtp", "");

            if (dTable != null)
            {
                foreach (System.Data.DataRow row in dTable.Rows)
                {
                    //IAPL.Transport.Configuration.Config.GetAppSettingsValue("emailnotificationsender", "")

                    IAPL.Transport.Operation.Email email = new IAPL.Transport.Operation.Email(
                        IAPL.Transport.Util.CommonTools.ValueToString((Object)row["emldIntEmailAddrFROM"]),
                        IAPL.Transport.Util.CommonTools.ValueToString((Object)row["emldIntEmailAddrTO"]),
                        IAPL.Transport.Util.CommonTools.ValueToString((Object)row["emldIntEmailAddrCC"]),
                        IAPL.Transport.Util.CommonTools.ValueToString((Object)row["emldIntEmailAddrBCC"]),
                        IAPL.Transport.Util.CommonTools.ValueToString((Object)row["emldEmailSubject"]),
                        2,
                        emailSMTP);

                    string mesgBody = this.readNoticationMessageBody(fileName, isSuccessful,
                                                                     IAPL.Transport.Util.CommonTools.ValueToString((Object)row["emldXSLTPath"]));

                    ArrayList list = new ArrayList();

                    fileName = this.serverInformation.GetNetworkSourceFile(desFilePath, fileName);
                    list.Add(fileName);

                    // temporarily set to save as TEXT for the sake of testing....
                    //success = email.Send(true, mesgBody, list);

                    success = email.Send(false, mesgBody, list);
                    if (!success)
                    {
                        this.ErrorMessage = email.ErrorMessage;
                    }

                    //emailDetails.EmailSubject = row["emldEmailSubject"].ToString();
                }
            }
            else
            {
                success = false;
            }

            //return emailDetails;
            return(success);
        }
示例#2
0
//        private bool getEmailDistributionListSendAttachment(bool isSuccessful, string fileName, string threadName, string desFilePath)
        private bool getIMSEmailDistributionList(int Report,
                                                 string fileName,
                                                 string desFilePath,
                                                 string ThreadName,
                                                 System.Collections.Hashtable DetailsForIMS,
                                                 IAPL.Transport.Transactions.MessageDetails mDetails)
        {
            bool success = true;

            IAPL.Transport.Transactions.ServerDetails emailDetails = new ServerDetails();

            IAPL.Transport.Data.DbTransaction db = new IAPL.Transport.Data.DbTransaction();

            db.emailDistributionList(true, mDetails.MessageCode, mDetails.ERP, Report);

            System.Data.DataTable dTable = db.CommonDataTable;
            string emailSMTP             = IAPL.Transport.Configuration.Config.GetAppSettingsValue("emailnotificationsmtp", "");

            if (dTable != null)
            {
                foreach (System.Data.DataRow row in dTable.Rows)
                {
                    IAPL.Transport.Operation.Email email = new IAPL.Transport.Operation.Email(
                        IAPL.Transport.Util.CommonTools.ValueToString((Object)row["IMSemldIntEmailAddrFROM"]),
                        IAPL.Transport.Util.CommonTools.ValueToString((Object)row["IMSemldIntEmailAddrTO"]),
                        IAPL.Transport.Util.CommonTools.ValueToString((Object)row["IMSemldIntEmailAddrCC"]),
                        IAPL.Transport.Util.CommonTools.ValueToString((Object)row["IMSemldIntEmailAddrBCC"]),
                        IAPL.Transport.Util.CommonTools.ValueToString((Object)row["IMSemldEmailSubject"]),
                        2,
                        emailSMTP);

                    string mesgBody = this.IMSreadNoticationMessageBody(Report, success,
                                                                        IAPL.Transport.Util.CommonTools.ValueToString((Object)row["IMSemldXSLTPath"]),
                                                                        DetailsForIMS,
                                                                        mDetails.IMSBatchRun);

                    // Email this!
                    //success = email.Send(true, mesgBody, list);
                    success = email.Send(false, mesgBody, null);
                    if (!success)
                    {
                        this.ErrorMessage = email.ErrorMessage;
                    }
                }
            }
            else
            {
                success = false;
            }

            //return emailDetails;
            return(success);
        }
示例#3
0
        private void SendEmail(object data)
        {
            ArrayList list       = (ArrayList)data;
            string    to         = (string)list[0];
            string    from       = (string)list[1];
            string    subject    = (string)list[2];
            string    smtpServer = (string)list[3];
            string    message    = (string)list[4];
            string    threadName = (string)list[5];

            //System.Console.WriteLine("Thread {0} is running ", threadName);
            IAPL.Transport.Operation.Email email = new IAPL.Transport.Operation.Email(from, to, 2, smtpServer);
            email.Send(subject, false, message, null);
        }
示例#4
0
        public bool GenerateHTML(List <string> Sent, List <string> Failed, string TempFolderEmail, string XSLTFile, ServerDetails sDetails, MessageDetails mDetails, List <SentDetail_BO> filesSent, bool isTechnicalError)
        {
            //Demo purposes

            //Preparation Code
            //1. Create Guid folder

            string _tempGUID    = IAPL.Transport.Util.CommonTools.CreateGuidFolder(TempFolderEmail) + "\\";
            string _fileName    = Path.GetFileName(XSLTFile);
            string _workingFile = _tempGUID + _fileName;

            //2. copy XSLTFile to Guid
            File.Copy(XSLTFile, _tempGUID + _fileName);

            //3. add sent files to file


            //Add the sent stuff
            #region SENT

            StringBuilder _sbHeader = new StringBuilder();
            StringBuilder _sbBody   = new StringBuilder();

            //Sent Files
            for (int i = 0; i < Sent.Count; i++)
            {
                string a = Sent[i].ToString();
                string b = filesSent[i].FileName;
                string c = filesSent[i].DateSent;

                _sbHeader.AppendLine(AddEntry("ItemEntry", i, true, filesSent[i].DateSent, "SentFiles"));
                _sbBody.AppendLine(AddEntry("ItemEntry", i, false, filesSent[i].DateSent, "SentFiles"));
                //MessageBox.Show(_list[i]);
            }

            //READY THE LOOP FOR PENDING FILES
            for (int i = 0; i < Failed.Count; i++)
            {
                _sbHeader.AppendLine(AddEntry("PendingEntry", i, true, filesSent[i].DateSent, "PendingFiles"));
                _sbBody.AppendLine(AddEntry("PendingEntry", i, false, filesSent[i].DateSent, "PendingFiles"));
            }


            //XSLT FOR CLIENT HAS BEEN CREATED
            bool success = AppendToFile(_workingFile, "ItemEntry", _sbHeader, _tempGUID + "BBraunClient.xslt", _sbBody, true);
            //CREATE THE HTML EMAIL FOR THE CLIENT
            string toSend = CreateHTMLEmailForClient(false, _tempGUID + "BBraunClient.xslt", Sent, sDetails, mDetails, Failed);



            //SEND EMAIL
            if (toSend != "")
            {
                //Successful mailing
                Operation.Email _ToMail = new IAPL.Transport.Operation.Email(sDetails.EmailAddressFrom, sDetails.EmailAddressTo, sDetails.EmailAddressCC, sDetails.EmailAddressBCC, sDetails.EmailSubject, 3, Configuration.Config.GetAppSettingsValue("emailnotificationsmtp", ""));
                _ToMail.Send(true, toSend, null);
            }



            #endregion

            //Clean up
            Directory.Delete(_tempGUID, true);


            return(true);
        }
示例#5
0
        private bool getEmailDistributionListEmailNotification(bool isSuccessful, string fileName, string threadName)
        {
            bool success = true;

            IAPL.Transport.Transactions.ServerDetails emailDetails = new ServerDetails();

            IAPL.Transport.Data.DbTransaction db = new IAPL.Transport.Data.DbTransaction();

            if (!isSuccessful)
            {
                db.emailDistributionList(false, IAPL.Transport.Configuration.Config.GetAppSettingsValue("emailnotificationmessagecode", "TECHNICAL_NOTIFICATION"),
                                         IAPL.Transport.Configuration.Config.GetAppSettingsValue("emailnotificationerp", "IAPL"), 0);
            }
            else
            {
                db.emailDistributionList(false, messageInformation.MessageCode, messageInformation.ERP, 0);
            }

            System.Data.DataTable dTable = db.CommonDataTable;
            string emailSMTP             = IAPL.Transport.Configuration.Config.GetAppSettingsValue("emailnotificationsmtp", "");

            if (dTable != null)
            {
                foreach (System.Data.DataRow row in dTable.Rows)
                {
                    //IAPL.Transport.Configuration.Config.GetAppSettingsValue("emailnotificationsender", "")

                    IAPL.Transport.Operation.Email email = new IAPL.Transport.Operation.Email(
                        IAPL.Transport.Util.CommonTools.ValueToString((Object)row["emldIntEmailAddrFROM"]),
                        IAPL.Transport.Util.CommonTools.ValueToString((Object)row["emldIntEmailAddrTO"]),
                        IAPL.Transport.Util.CommonTools.ValueToString((Object)row["emldIntEmailAddrCC"]),
                        IAPL.Transport.Util.CommonTools.ValueToString((Object)row["emldIntEmailAddrBCC"]),
                        IAPL.Transport.Util.CommonTools.ValueToString((Object)row["emldEmailSubject"]),
                        2,
                        emailSMTP);

                    string mesgBody = this.readNoticationMessageBody(fileName, isSuccessful,
                                                                     IAPL.Transport.Util.CommonTools.ValueToString((Object)row["emldXSLTPath"]));

                    ArrayList list = new ArrayList();

                    //fileName = this.serverInformation.GetNetworkSourceFile(desFilePath, fileName);
                    //list.Add(fileName);

                    IAPL.Transport.Util.TextLogger.LogSetting("EmailContent [Subject: " + email.Subject + "]", mesgBody);

                    //IAPL.Transport.Util.TextLogger.Log("-->EmailContent [Subject: " + email.Subject + "]", mesgBody);

                    success = email.Send(true, mesgBody, list);
                    if (!success)
                    {
                        this.ErrorMessage = email.ErrorMessage + " (" + email.SmtpServer + ")";
                    }
                    //emailDetails.EmailSubject = row["emldEmailSubject"].ToString();
                }
            }
            else
            {
                success = false;
            }

            //return emailDetails;
            return(success);
        }