Example #1
0
        protected override void OnStart(string[] args)
        {
            try
            {
                OptionsManager manager = new OptionsManager(@"D:\Lab4\DataManagerService\bin\Release\AppSettings.xml");
                dataManagerOptions = manager.GetOptions <DataManagerOptions>();

                errorDb  = new Database(dataManagerOptions.ErrorConnectionString);
                personDb = new Database(dataManagerOptions.ConnectionString);
                var persons = personDb.GetPersons(dataManagerOptions.SearchCriteria);

                XmlXsdGenerator <Person> generator = new XmlXsdGenerator <Person>(persons);
                var xmlString = generator.GenerateXml();
                var xsdString = generator.GenerateXsd();

                FileManagerService fileManager = new FileManagerService();
                fileManager.Launch();

                FileTransfer sender = new FileTransfer(dataManagerOptions.FtpSourceFolder);
                sender.Send(xmlString, xsdString);
            }
            catch (Exception ex)
            {
                Error error = new Error(ex.Source, ex.Message, ex.StackTrace, DateTime.Now);
                errorDb.LogError(error);
            }
        }