Example #1
0
        public ActionResult <RetReporte> EnviarEjemplo()
        {
            DateTime   StartTime   = DateTime.Now;
            ComRepoFtp ComRepoFtpO = new ComRepoFtp(
                (string)IEdiFtpConfig.GetValue(typeof(string), "Host"),
                (string)IEdiFtpConfig.GetValue(typeof(string), "HostFailover"),
                (string)IEdiFtpConfig.GetValue(typeof(string), "EdiUser"),
                (string)IEdiFtpConfig.GetValue(typeof(string), "EdiPassword"),
                (string)IEdiFtpConfig.GetValue(typeof(string), "DirIn"),
                (string)IEdiFtpConfig.GetValue(typeof(string), "DirOut"),
                (string)IEdiFtpConfig.GetValue(typeof(string), "DirChecked"),
                Config.GetSection("MaxEdiComs").GetValue(typeof(string), "Value")
                );

            if (!ComRepoFtpO.Ping(ref DbO))
            {
                ComRepoFtpO.UseHost2 = true;
                if (!ComRepoFtpO.Ping(ref DbO))
                {
                    return(new RetReporte()
                    {
                        Info = new RetInfo()
                        {
                            CodError = -3,
                            Mensaje = $"Error, no se puede conectar con el servidor FTP primario o secundario",
                            ResponseTimeSeconds = (DateTime.Now - StartTime).TotalSeconds
                        }
                    });
                }
            }
            ComRepoFtpO.Put("AEnviar.txt", @"C:\temp\AEnviar.txt", ref DbO);
            return(new RetReporte()
            {
                Info = new RetInfo()
                {
                    CodError = 0,
                    Mensaje = "Todo ok",
                    ResponseTimeSeconds = (DateTime.Now - StartTime).TotalSeconds
                }
            });
        }
Example #2
0
        private string SendEdiFtp(string _EdiStr, string Tipo)
        {
            ComRepoFtp ComRepoFtpO = new ComRepoFtp(
                FtpHost,
                FtpHostFailover,
                FtpUser,
                FtpPassword,
                FtpDirIn,
                FtpDirOut,
                FtpDirChecked,
                MaxEdiComs);

            if (!ComRepoFtpO.Ping(ref DbO))
            {
                ComRepoFtpO.UseHost2 = true;
                if (!ComRepoFtpO.Ping(ref DbO))
                {
                    return("Error, no se puede conectar con el servidor FTP primario o secundario");
                }
            }
            ComRepoFtpO.Put(_EdiStr, ref DbO, Tipo);
            return("ok");
        }