//Instalação do Import Service
        public void ProgressImportInstalation()
        {
            if (InvokeRequired)
            {
                this.Invoke(new MethodInvoker(ProgressImportInstalation));
                return;
            }

            //Se não for Update, cria o serviço
            if (!ControllerClass.isUpdate)
            {
                lblProConnector.Text = "Copiando Componentes...";
                lblProConnector.Refresh();

                //Copia DBMGR
                Components();

                //Copia o SQLCMD para a ferramenta DBMGR
                CopySQLCMD();

                lblProConnector.Text = "Criando chaves de registro...";
                lblProConnector.Refresh();

                //Move progress
                ProgressBarUpdate();

                //Cria Chaves de registro NDDigital
                eConnector.CreateNDDigitalRegKeys();

                lblProConnector.Text = "Criando Banco de Dados...";
                lblProConnector.Refresh();

                //Move progress
                ProgressBarUpdate();

                /*if (!ControllerClass.Oracle && !ControllerClass.Informix)
                 * {
                 *  DBMGR = new CreateDataBase();
                 *
                 *  if (!ControllerClass.SGBDCreated || !ControllerClass.SGBDCreatedCold)
                 *  {
                 *      if (!eConnector.VerifyDBMGRResult())
                 *      {
                 *          MessageBox.Show("Não foi possível acessar o banco de dados, verifique os eventos do Windows para maiores informações!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 *          StartPage.ActiveForm.Close();
                 *      }
                 *  }
                 * }*/

                //Move progress
                ProgressBarUpdate();

                lblProConnector.Text = "Criando Pastas de destino...";
                lblProConnector.Refresh();

                //Cria as pastas de destino para as DLLS
                eConnector.CreateFolderConnector();

                //Move progress
                ProgressBarUpdate();

                lblProConnector.Text = "Criando Serviços...";
                lblProConnector.Refresh();

                //Move progress
                ProgressBarUpdate();

                //Cria serviço Connector Service
                Services.CreateService(ControllerClass.PathFolder + @"\Connector\Connector Service\NDDigital.eForms.ConnectorService.exe", "NDDigitaleFormsConnectorService",
                                       "Serviço responsável pela captura e processamento de documentos enviados à solução e-Forms.", "NDDigital e-Forms Connector Service");

                //Move progress
                ProgressBarUpdate();

                //Estraindo DLLs
                ExtractResources("Settings");
                ExtractResources("Service");
                ExtractResources("Services");
                ExtractResources("B2B");
                ExtractResources("DPEC");

                CalculateFileQuantity();

                //Movendo as DLLs para o caminho de destino
                MoveDLLs(@"C:\Inst\ConnectorSettings", "Connector Settings");
                Thread.Sleep(500);

                MoveDLLs(@"C:\Inst\ConnectorService", "Connector Service");
                Thread.Sleep(500);

                MoveDLLs(@"C:\Inst\ConnectorServices", "Connector Services");
                Thread.Sleep(500);

                MoveDLLs(@"C:\Inst\B2B", "B2B Service");
                Thread.Sleep(500);

                MoveDLLs(@"C:\Inst\DPEC", "DPEC Server");
                Thread.Sleep(500);
            }

            //Caso seja Update, para o serviço para atualizar as DLLs
            else
            {
                lblProConnector.Text = "Verificando update...";
                lblProConnector.Refresh();

                ControllerClass.VerifyRegKeysIFUpdate();

                //Move progress
                ProgressBarUpdate();

                lblProConnector.Text = "Verificando pastas existentes...";
                lblProConnector.Refresh();

                eConnector.CreateFolderConnector();

                //Move progress
                ProgressBarUpdate();


                lblProConnector.Text = "Parando os Serviços...";
                lblProConnector.Refresh();

                Services.ConnectorServiceStop();
                Thread.Sleep(3500);

                //Move progress
                ProgressBarUpdate();


                lblProConnector.Text = "Deletando arquivo antigos...";
                lblProConnector.Refresh();

                removeFiles.DeleteSchemasFrom(ControllerClass.PathFolder + @"\Connector\Connector Service\Schemas");
                removeFiles.DeleteFilesFrom(ControllerClass.PathFolder + @"\Connector\Connector Settings");
                removeFiles.DeleteFilesFrom(ControllerClass.PathFolder + @"\Connector\Connector Service");
                removeFiles.DeleteFilesFrom(ControllerClass.PathFolder + @"\Connector\Connector Services");
                removeFiles.DeleteFilesFrom(ControllerClass.PathFolder + @"\Connector\B2B Service");
                removeFiles.DeleteFilesFrom(ControllerClass.PathFolder + @"\Connector\DPEC Server");

                //Move progress
                ProgressBarUpdate();

                //Estraindo DLLs
                ExtractResources("Settings");
                ExtractResources("Service");
                ExtractResources("Services");
                ExtractResources("B2B");
                ExtractResources("DPEC");

                //Move progress
                ProgressBarUpdate();

                //Calcula a quantidade de arquivos para definir o tamanho da barra de progresso
                CalculateFileQuantity();

                MoveDLLs(@"C:\Inst\ConnectorSettings", "Connector Settings");
                Thread.Sleep(500);

                MoveDLLs(@"C:\Inst\ConnectorService", "Connector Service");
                Thread.Sleep(500);

                MoveDLLs(@"C:\Inst\ConnectorServices", "Connector Services");
                Thread.Sleep(500);

                MoveDLLs(@"C:\Inst\B2B", "B2B Service");
                Thread.Sleep(500);

                MoveDLLs(@"C:\Inst\DPEC", "DPEC Server");
                Thread.Sleep(500);

                //Move progress
                ProgressBarUpdate();

                lblProConnector.Text = "Finalizando...";
                lblProConnector.Refresh();
            }


            lblProConnector.Text = "Atualizando atalhos...";
            lblProConnector.Refresh();

            ShortcutConnector(ControllerClass.PathFolder);
            //ShortcutMonitor(ControllerClass.RootFolder);

            lblProConnector.Text = "Iniciando os Serviços...";
            lblProConnector.Refresh();

            //Inicia Serviço
            Services.ConnectorServiceStart();

            //Move progress
            ProgressBarUpdate();

            lblProConnector.Font      = new Font(lblProConnector.Font, FontStyle.Bold);
            lblProConnector.ForeColor = Color.Green;
            lblProConnector.Text      = "Concluido";
            PctImport.Visible         = true;
            BtnNext.Enabled           = true;
            lblCopy.Text = "Todos os arquivos foram copiados";
            lblFile.Text = "";
            groupGeneral.Refresh();
        }
Example #2
0
        //Instalação do Entry Service
        public void ProgressEntryInstalation()
        {
            if (InvokeRequired)
            {
                this.Invoke(new MethodInvoker(ProgressEntryInstalation));
                return;
            }

            entry.CreateFolderEntry();

            //Move progress
            ProgressBarUpdate();

            //Se não for Update, cria o serviço
            if (!ControllerClass.isUpdate)
            {
                lblProEntry.Text = "Criando chaves de registro...";
                lblProEntry.Refresh();

                entry.CreateNDDigitalRegKeys();

                lblProEntry.Text = "Criando Serviço do Cold Processor...";
                lblProEntry.Refresh();

                //Move progress
                ProgressBarUpdate();

                Services.CreateService(ControllerClass.PathFolder + @"\Cold\Cold Processor Service\NDDigital.eForms$TYPE.ColdService.exe", "NDDigitaleFormsColdProcessorService",
                                       "Serviço responsável por inserir em uma base de dados (guarda eletrônica), os documentos processados pela solução e-Forms.", "NDDigital e-Forms Cold Processor Service");

                //Move progress
                ProgressBarUpdate();

                ExtractResources("ColdProcessor");
                ExtractResources("ColdService");
                ExtractResources("ColdWeb");

                //Move progress
                ProgressBarUpdate();

                //Move DLLs para o caminho de destino
                MoveDLLs(@"C:\Inst\ColdProcessor", ControllerClass.PathFolder + @"\Cold\ColdProcessor");
                MoveDLLs(@"C:\Inst\ColdService", ControllerClass.RootFolder + @"\Webs\ColdService");
                MoveDLLs(@"C:\Inst\ColdWeb", ControllerClass.RootFolder + @"\Webs\ColdWeb");
            }

            //Caso seja Update, para o serviço para atualizar as DLLs
            else
            {
                lblProEntry.Text = "Parando Serviço do Cold Processor...";
                lblProEntry.Refresh();

                //Move progress
                ProgressBarUpdate();

                //Parando os Serviços
                Services.ServiceStop();

                Thread.Sleep(2000);

                lblProEntry.Text = "Deletando arquivos antigos...";
                lblProEntry.Refresh();

                removeFiles.DeleteFilesFrom(ControllerClass.PathFolder + @"\Cold\Cold Processor Service");
                removeFiles.DeleteFilesFrom(ControllerClass.RootFolder + @"\Webs\ColdService");
                removeFiles.DeleteFilesFrom(ControllerClass.RootFolder + @"\Webs\ColdWeb");

                //Move progress
                ProgressBarUpdate();

                //Extrai DLLs
                ExtractResources("ColdProcessor");
                ExtractResources("ColdService");
                ExtractResources("ColdWeb");

                //Move progress
                ProgressBarUpdate();

                lblProEntry.Text = "Movendo DLLS para a pasta de destino...";
                lblProEntry.Refresh();

                //Move DLLs para o caminho de destino
                MoveDLLs(@"C:\Inst\ColdProcessor", ControllerClass.PathFolder + @"\Cold\ColdProcessor");
                MoveDLLs(@"C:\Inst\ColdService", ControllerClass.PathFolder + @"\Cold\ColdService");
                MoveDLLs(@"C:\Inst\ColdWeb", ControllerClass.RootFolder + @"\Webs\ColdWeb");

                lblProEntry.Text = "Finalizando...";
                lblProEntry.Refresh();
            }

            lblProEntry.Text = "Iniciando o Serviço do Cold Processor...";
            lblProEntry.Refresh();

            //Inicia Serviço
            Services.ServiceStart();

            //Move progress
            ProgressBarUpdate();

            lblProEntry.Font      = new Font(lblProEntry.Font, FontStyle.Bold);
            lblProEntry.ForeColor = Color.Green;
            lblProEntry.Text      = "Concluido";
            PctEntry.Visible      = true;
            BtnNext.Enabled       = true;
            lblCopy.Text          = "Todos os arquivos foram copiados";
            lblFile.Text          = "";
        }
        //Instalação do Import Service
        public void ProgressImportInstalation()
        {
            if (InvokeRequired)
            {
                this.Invoke(new MethodInvoker(ProgressImportInstalation));
                return;
            }

            import.CreateFolderImport();

            //Move progress
            ProgressBarUpdate();

            //Se não for Update, cria o serviço
            if (!ControllerClass.isUpdate)
            {
                lblProImport.Text = "Criando chaves de registro...";
                lblProImport.Refresh();

                import.CreateConferencingRegKeys();
                import.CreateNDDigitalRegKeys();

                lblProImport.Text = "Criando Serviço do Cold Import...";
                lblProImport.Refresh();

                //Move progress
                ProgressBarUpdate();

                Services.CreateService(ControllerClass.PathFolder + @"\Connector\Import Service\NDDigital.eForms.ColdImport.Service.exe", "NDDigitaleFormsImportService",
                                       "Serviço responsável pela importação de documentos NF-e e CT-e para armazenamento em Cold.", "NDDigital e-Forms Cold Import Service");

                //Move progress
                ProgressBarUpdate();

                ExtractResources();

                //Move progress
                ProgressBarUpdate();

                MoveDLLs(@"C:\Inst\ImportService");
            }

            //Caso seja Update, para o serviço para atualizar as DLLs
            else
            {
                lblProImport.Text = "Parando Serviço do Cold Import...";
                lblProImport.Refresh();

                //Move progress
                ProgressBarUpdate();

                //Parando os Serviços
                Services.ServiceStop();

                Thread.Sleep(2000);

                lblProImport.Text = "Deletando arquivos antigos...";
                lblProImport.Refresh();

                removeFiles.DeleteFilesFrom(ControllerClass.PathFolder + @"\Connector\Import Service");

                //Move progress
                ProgressBarUpdate();

                //Extrai DLLs
                ExtractResources();

                //Move progress
                ProgressBarUpdate();

                lblProImport.Text = "Movendo DLLS para a pasta de destino...";
                lblProImport.Refresh();

                //Move DLLs para o caminho de destino
                MoveDLLs(@"C:\Inst\ImportService");

                lblProImport.Text = "Finalizando...";
                lblProImport.Refresh();
            }

            lblProImport.Text = "Iniciando o Serviço do Cold Import...";
            lblProImport.Refresh();

            //Inicia Serviço
            Services.ServiceStart();

            //Move progress
            ProgressBarUpdate();

            lblProImport.Font      = new Font(lblProImport.Font, FontStyle.Bold);
            lblProImport.ForeColor = Color.Green;
            lblProImport.Text      = "Concluido";
            PctImport.Visible      = true;
            BtnNext.Enabled        = true;
            lblCopy.Text           = "Todos os arquivos foram copiados";
            lblFile.Text           = "";
        }