public string Ftp(string host     = @"ftp://ftp.dealermade.co",
                          string user     = "******",
                          string password = "******")
        {
            //string localFilePath = @"E:\Projects\Automax\Data\Export.csv";
            string localFilePath = System.Web.HttpContext.Current.Server.MapPath("~/ftp/Export.csv");

            var result = new FTPRepository().UploadData(localFilePath, host, user, password);

            return(result.Message);
        }
Exemple #2
0
        private void FtpTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            try
            {
                string exportFilePath = Library.GetPostingConfiguration("ExportFilePath", @"C:\Export\Export.csv");
                string ftpHost        = Library.GetPostingConfiguration("ftpHost", @"ftp://ftp.dealermade.co");
                string ftpUser        = Library.GetPostingConfiguration("ftpUser", "dealermade-numou");
                string ftpPassword    = Library.GetPostingConfiguration("ftpPassword", "qRHVMefyQbNaPY2Q7k");

                var result = new FTPRepository().UploadData(exportFilePath, ftpHost, ftpUser, ftpPassword);
                if (result.Result)
                {
                    Library.WriteLog("FtpTimer_Elapsed", "FTP Process completed successfully.", LogLevel.Information);
                }
                else
                {
                    Library.WriteLog("FtpTimer_Elapsed", "FTP Process failed with error: " + result.Message, LogLevel.Information);
                }
            }
            catch (Exception ex)
            {
                Library.WriteLog("FtpTimer_Elapsed", ex.Message, LogLevel.Error);
            }
        }