public StdResult<NoType> CanalPushFileFTP(string localPath) { string distantDirectory = "/"; FTP ftp = new FTP { Host = ConfigurationManager.AppSettings["ftpServer_canal"], Login = ConfigurationManager.AppSettings["ftpLogin_canal"], Pwd = ConfigurationManager.AppSettings["ftpPass_canal"], LogDelegate = Program.log, Mode = Mode.Sftp }; StdResult<NoType> ftpResult = ftp.PushFile(localPath, distantDirectory); if (ftpResult.Result) { Mailer mailer = new Mailer(); mailer.LogDelegate = Program.log; string emailConf = ConfigurationManager.AppSettings["NotificationEmail"]; mailer.SendMail(emailConf, "[Moulinette Canal Collecte] Envoi Ftp chez Canal", "Tout est ok. <br/><a href='http://monitoring.collecte.canalplus.clients.rappfrance.com'>Monitoring</a>", null, ConfigurationManager.AppSettings["NotificationEmail_CC"]); } return ftpResult; }
public void MailPerformancePushFileFTP(string localPath, string brand) { string distantDirectory = (brand == "cplus" ? ConfigurationManager.AppSettings["ftpFilePathCplus"] : ConfigurationManager.AppSettings["ftpFilePathCsat"]) .Replace("#Date#", DateTime.Now.ToString("yyyyMMdd")); FTP ftp = new FTP { Host = ConfigurationManager.AppSettings["ftpServer"], Login = ConfigurationManager.AppSettings["ftpLogin"], Pwd = ConfigurationManager.AppSettings["ftpPass"], LogDelegate = Program.Log }; StdResult<NoType> ftpResult = ftp.PushFile(localPath, distantDirectory); if (ftpResult.Result) { Mailer mailer = new Mailer(); mailer.LogDelegate = Program.Log; string emailConf = ConfigurationManager.AppSettings["NotificationEmail"]; mailer.SendMail(emailConf, "[Morning Service Collecte] Envoi à MailPerf", "Tout est ok.", new Attachment(localPath), ConfigurationManager.AppSettings["NotificationEmail_CC"]); } }