private void SendSuccessEmail(HTTPProcessObject _httpProcess)//string _msgCode, string _erp, string _sourceFile, string _url, string suppName, string backupFolder) { List <string> _failed = new List <string>(); List <string> _sent = new List <string>(); EmailTransaction emailTrans = new EmailTransaction(); ServerDetails desServerDetails = new ServerDetails(); MessageDetails msgDetails = new MessageDetails(); for (int i = 0; i < _SentDetails.Count; i++) { if (emailTrans.HTTPSendingFailed(_httpProcess.MessageCode, _httpProcess.ERP, _SentDetails[i].FileName)) { _failed.Add(_SentDetails[i].FileName); } else { _sent.Add(_SentDetails[i].FileName); } } //Remove Batch file from List _sent.Remove(_httpProcess.SourceFile); _failed.Remove(_httpProcess.SourceFile); bool _a = emailTrans.GenerateHTML(_sent, _failed, _httpProcess.Guid + "requeue\\", _httpProcess.EmailXSLTPath, _SentDetails, _httpProcess, false);//, desServerDetails, msgDetails, _SentDetails, false); }
private void TechnicalErrorEmail(string errorMessage, HTTPProcessObject _httpObject) { string technicalError = errorMessage; Data.DbTransaction db = new IAPL.Transport.Data.DbTransaction(); MessageDetails msgDetails = new MessageDetails(); errorMessage = _httpObject.SourceFile + "[\'" + _httpObject.FileName + "\'file has been backup on " + _httpObject.Guid + "folder but failed on transmission to " + _httpObject.URL + " Address!] " + errorMessage; //errorMessage = threadName + " [\'" + fileName + "\' file has been backup on " + msgDetails.BackupFolder + " folder but failed on transmisson to " + //desServerDetails.ServerAddress + " server!] " + errorMessage; IAPL.Transport.Util.TextLogger.Log(IAPL.Transport.Util.TextLogger.messageType.Bulleted, "", errorMessage); // send email notification msgDetails.ProcessLogID = db.GetProcessLogID; msgDetails.TransDescription = "FILETRANSFER - failed."; msgDetails.TechnicalErrorDescription = errorMessage; //emailTrans = new EmailTransaction(msgDetails); msgDetails.ERP = _httpObject.ERP; msgDetails.MessageCode = _httpObject.MessageCode; msgDetails.SupplierName = _httpObject.SupplierName; msgDetails.StartDate = DateTime.Now.ToString(); msgDetails.EndDate = DateTime.Now.ToString(); msgDetails.TechnicalErrorDescription = technicalError; msgDetails.ApplicationCode = "Requeue"; msgDetails.TransDescription = errorMessage; msgDetails.SourceFile = _httpObject.SourceFile; msgDetails.SourceFolder = _httpObject.Guid; msgDetails.Principal = _httpObject.Principal; msgDetails.TradingCode = _httpObject.TradingCode; // //CREATE PROCESSLOG //log to db CreateProcessLog(msgDetails, errorMessage); //db.UpdateTransactionLog(false, "FILETRANSFER - failed.", errorMessage); EmailTransaction emailtrans = new EmailTransaction(msgDetails); emailtrans.DestinationFolder = _httpObject.URL; emailtrans.SourceFile = _httpObject.path; emailtrans.OutputFile = "N/A"; //emailTrans.DestinationFolder = desServerDetails.GetDestinationFolder(desServerDetails.ServerFolder); //emailTrans.SourceFile = srcServerDetails.GetSourceFile(); //emailTrans.OutputFile = desServerDetails.GetDestinationFile(desServerDetails.ServerFolder); //IAPL.Transport.Transactions.EmailTransaction emailTrans = new EmailTransaction(msgDetails); if (!emailtrans.SendEmailNotification(_httpObject.FileName, _httpObject.SourceFile, false)) { string[] errorList = IAPL.Transport.Util.TextLogger.ParseError(emailtrans.ErrorMessage); if (errorList.Length >= 2) { IAPL.Transport.Util.TextLogger.LogError(errorList[0], "[Thread: " + _httpObject.SourceFile + "] " + errorList[1]); } else { IAPL.Transport.Util.TextLogger.LogError("Worker-ProcessFile()", "[Thread: " + _httpObject.SourceFile + "] " + emailtrans.ErrorMessage); } } }