コード例 #1
0
        private void InitializeJob(Object sender, ElapsedEventArgs e)
        {
            // Verifica se o job já foi iniciado
            if (jobController != null)
            {
                startupTrigger.Stop();
                return;
            }

            // Abre a conexão com o banco
            DataAccess dataAccess = DataAccess.Instance;

            dataAccess.MountConnection(FileResource.MapDesktopResource("DataAccess.xml"), DatabaseEnum.PrintAccounting);
            dataAccess.OpenConnection();

            // Busca os parâmetros de execução no banco
            ApplicationParamDAO applicationParamDAO = new ApplicationParamDAO(dataAccess.GetConnection());
            NameValueCollection taskParams          = applicationParamDAO.GetTaskParams("printLogImport");
            double interval = double.Parse(taskParams["interval"]);

            // Fecha a conexão com o banco
            dataAccess.CloseConnection();

            IPeriodicTask printLogImportTask = new PrintLogImportTask();

            jobController = new JobController(printLogImportTask, taskParams, dataAccess, interval);
            jobController.Start();
        }
コード例 #2
0
        private void btnGetTaskParams_Click(object sender, EventArgs e)
        {
            infoBox.Text = "";
            NameValueCollection taskParams = applicationParamDAO.GetTaskParams("copyLogImport");

            foreach (String param in taskParams)
            {
                infoBox.Text = infoBox.Text + param + "    " + taskParams[param] + Environment.NewLine;
            }
            infoBox.Select(0, 1);
        }