1: using System;
2: using System.IO;
3: using Microsoft.CommerceServer.Internal.Marketing;
4: using Microsoft.CommerceServer.Runtime.Configuration;
5:
6: namespace ExportMarketingData
7: { 8: class ExportMarketingData
9: { 10: static void Main(string[] args)
11: { 12: if (args.Length != 2)
13: { 14: Console.WriteLine("Exports a Microsoft Commerce Server site's Marketing resource to a file."); 15: Console.WriteLine("ExportMarketingData.exe [sitename] [export directory]"); 16: return;
17: }
18:
19: // let Pup validate the site so we get a descriptive error if something is wrong
20: string sitename = args[0];
21:
22: // validate export directory exists
23: string exportDirectory = args[1];
24: DirectoryInfo dirInfo = new DirectoryInfo(exportDirectory);
25: if (!dirInfo.Exists)
26: { 27: Console.WriteLine("The specified output directory {0} does not exist", exportDirectory); 28: return;
29: }
30:
31: // validate export file does not exist
32: FileInfo fileInfo = new FileInfo(Path.Combine(exportDirectory, "MarketingData.xml"));
33: if (fileInfo.Exists)
34: { 35: Console.WriteLine("Cannot overwrite existing file {0}", fileInfo.FullName); 36: return;
37: }
38:
39: // do the export
40: MarketingPup pup = new MarketingPup();
41: pup.Export(sitename, "Marketing", exportDirectory, 0, 0);
42:
43: // print success
44: Console.WriteLine("Exported file {0}", fileInfo.FullName); 45: }
46: }
47: }