Skip to content

Instantly share code, notes, and snippets.

Avatar

Peter Campbell skenderbeu

View GitHub Profile
View ZipModule.cs
using System;
using System.Collections.Generic;
using log4net;
namespace Zoom.MailingExtracts
{
public class ZipModule : IDisposable
{
protected static readonly ILog Log = LogManager.GetLogger(typeof(ZipModule));
protected string BrandName;
View UploadFileWithWINSCP_WithPolly.cs
public void FTPZippedFile(some params....)
{
//create and set variables
var fallback = Policy
.Handle<SessionRemoteException>()
.Fallback((ex)=> SendEmail(ex.Message));
var fileUploadResult = fallback.Execute(() =>
UploadFile(zipFileName, fullzipFilepath,
View UploadFileWithWINSCPSnip.cs
public string UploadFile(string zipFileName, string fullZipFilePath,
TransferOptions transOptions, SessionOptions sessionOptions)
{
using (var session = new Session())
{
session.Open(sessionOptions);
return session.PutFiles(
zipFileName,
fullZipFilePath,
View ReadExcelFileWithPolly.cs
using System;
using System.IO;
using Polly;
namespace SpreadsheetImporter
{
class Program
{
static void Main(string[] args)
{
View ReadExcelFile.cs
using System;
using System.IO;
namespace SpreadsheetImporter
{
class Program
{
static void Main(string[] args)
{
ReadFile(@"C:\temp\jam2.xls");
View Upload.cs
using System;
using System.IO;
using log4net;
using WinSCP;
public class Upload
{
public static void SendFile(UploadConfig config, ILog log)
{
try
View UploadConfig.cs
public class UploadConfig
{
public string Protocol { get; set; }
public string Host { get; set; }
public string User { get; set; }
public string Password { get; set; }
public string ZipFileName { get; set; }
public string RemotePath { get; set; }
public string PrivateKeyPath { get; set; }
public string Port { get; set; }
View ZipUtil.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using log4net;
public class ZipUtil : IZip
{
private static readonly ILog Log = LogManager.GetLogger(typeof(ZipModule));
private string _zipFileName;
View IZip.cs
public interface IZip
{
void SetZipFileName(string zipfileName);
void SetFilesToZip(List<string> files);
void CreateArchive();
}
View createShipment
public void createShipment( utcdatetime _shipmentDate,
SalesTable _salesTable,
str _noOfParcels = "1"
)
{
RoyalMail.shippingAPIPortTypeClient serviceClient;
RoyalMail.createShipmentRequest shipmentRequest;
RoyalMail.createShipmentResponse shipmentResponse;