コード例 #1
0
        public void TestFileOutput()
        {
            var facade = Helper.CreateFacade(ConnectionString);
            IDataManagerFactory dataManagerFactory = new FakeDataManagerFactory();
            var connectionFactory  = new SqlConnectionFactory(ConnectionString);
            var dataManager        = dataManagerFactory.CreateDataManager(connectionFactory.CreateConnection(), null);
            var securityRepository = facade.RepositoryManager.ClaimSecurityRepository(dataManager);

            var fileManager = new TradingTargetsFileManager();
            var targetings  = fileManager.GetFileContent(securityRepository, dataManager);

            using (StreamWriter sw = new StreamWriter(String.Format(@"C:\temp\AshmoreEMM_Models - as of {0:yyyyMMdd}-{0:HHmmss}.CSV", DateTime.Now)))
            {
                sw.Write(targetings);
            }
        }
コード例 #2
0
 public void CreateTargetingFile(SecurityRepository securityRepository, IDataManager manager)
 {
     try
     {
         var    fileManager = new TradingTargetsFileManager();
         string fileContent = fileManager.GetFileContent(securityRepository, manager);
         var    now         = DateTime.Now;
         var    fileName    = "AshmoreEMM_Models - as of " + now.ToString("yyyyMMdd-hhmmss") + ".csv";
         var    directory   = ConfigurationManager.AppSettings["TargetingFileOutputDirectory"];
         if (!directory.EndsWith(@"\"))
         {
             directory += @"\";
         }
         using (StreamWriter sw = new StreamWriter(directory + fileName))
         {
             sw.Write(fileContent);
         }
     }
     catch (Exception e)
     {
         throw new OutputTargetingFileException("See inner exception for details", e);
     }
 }