private void btnExecutar_Click(object sender, EventArgs e) { bool deuErro = false; Util.clsUtil util = new Util.clsUtil(); try { clsRegraNegocio regra = new clsRegraNegocio(); List <Control> lst = new List <Control>(); lst.Add(txtNome); if (util.verificarNulo(errorProvider1, lst)) { } else { if (checkBiblioteca.Checked) { if (regra.verificarAmbienteExiste("Biblioteca", txtNome.Text)) { } else { if (criarAmbiente("Biblioteca")) { if (txtEspecificaBiblioteca.Visible == true) { if (txtEspecificaBiblioteca.Text != string.Empty) { atualizar(txtNome.Text, txtEspecificaBiblioteca.Text, "Biblioteca"); } } } else { deuErro = true; return; } } } if (checkLabore.Checked) { if (txtLaboreCriar.Text != string.Empty) { if (criarAmbiente("Aplicativo")) { if (txtEspecificaLabore.Visible == true) { if (txtEspecificaLabore.Text != string.Empty) { atualizar(txtNome.Text, txtEspecificaLabore.Text, regra.retornarAplicativo(txtLaboreCriar.Text)); } } } else { deuErro = true; return; } } } if (checkPortal.Checked) { criarAmbiente("Portal"); if (txtEspecificaPortal.Visible == true) { if (txtEspecificaPortal.Text != string.Empty) { atualizar(txtNome.Text, txtEspecificaPortal.Text, "Portal"); } } // deletarDiretorio(); clsServico servico = new clsServico(); if (checkIniciarHost.Checked) { servico.DesinstalaServico(txtNome.Text); servico.InstalaServico(txtNome.Text); } if (checkIniciarLabore.Checked) { servico.AbreAplicativo(regra.retornarAplicativo(txtLaboreCriar.Text), txtNome.Text, checkVersao12.Checked); } } } } catch (Exception ex) { util.mensagemErro(ex.Message); } finally { deletarDiretorio(@"C:\extrair"); if (deuErro == true) { deletarDiretorio(string.Format(@"c:\totvs\{0}", txtNome.Text)); progressBar1.Value = 0; } } }
private void btnExecutar_Click(object sender, EventArgs e) { bool deuErro = false; Util.clsUtil util = new Util.clsUtil(); try { clsRegraNegocio regra = new clsRegraNegocio(); List<Control> lst = new List<Control>(); lst.Add(txtNome); if (util.verificarNulo(errorProvider1, lst)) { } else { if (checkBiblioteca.Checked) { if (regra.verificarAmbienteExiste("Biblioteca", txtNome.Text)) { } else { if (criarAmbiente("Biblioteca")) { if (txtEspecificaBiblioteca.Visible == true) { if (txtEspecificaBiblioteca.Text != string.Empty) { atualizar(txtNome.Text, txtEspecificaBiblioteca.Text, "Biblioteca"); } } } else { deuErro = true; return; } } } if (checkLabore.Checked) { if (txtLaboreCriar.Text != string.Empty) { if (criarAmbiente("Aplicativo")) { if (txtEspecificaLabore.Visible == true) { if (txtEspecificaLabore.Text != string.Empty) { atualizar(txtNome.Text, txtEspecificaLabore.Text, regra.retornarAplicativo(txtLaboreCriar.Text)); } } } else { deuErro = true; return; } } } if (checkPortal.Checked) { criarAmbiente("Portal"); if (txtEspecificaPortal.Visible == true) { if (txtEspecificaPortal.Text != string.Empty) { atualizar(txtNome.Text, txtEspecificaPortal.Text, "Portal"); } } // deletarDiretorio(); clsServico servico = new clsServico(); if (checkIniciarHost.Checked) { servico.DesinstalaServico(txtNome.Text); servico.InstalaServico(txtNome.Text); } if (checkIniciarLabore.Checked) { servico.AbreAplicativo(regra.retornarAplicativo(txtLaboreCriar.Text), txtNome.Text, checkVersao12.Checked); } } } } catch (Exception ex) { util.mensagemErro(ex.Message); } finally { deletarDiretorio(@"C:\extrair"); if (deuErro == true) { deletarDiretorio(string.Format(@"c:\totvs\{0}", txtNome.Text)); progressBar1.Value = 0; } } }
public bool criarAmbiente(string produto) { bool criou = false; clsOperacoes operacoes = new clsOperacoes(progressBar1, lblTeste, checkVersao12.Checked); clsConfiguracao config = new clsConfiguracao(); bool versao12 = false; try { if (produto == "Biblioteca") { operacoes.setTxtDiretorio(txtBibliotecaCriar); operacoes.extrairInstalador(txtBibliotecaCriar.Text, @"c:\extrair"); versao12 = operacoes.verificarVersao12(string.Format(@"C:\extrair\WinRoot\totvs\CorporeRM\RM.Net\RM.Version.dll", txtNome.Text)); operacoes.DirectoryCopy(@"C:\extrair\WinRoot\totvs\CorporeRM", txtNome .Text, true, false); config.criarArquivoConfig(txtNome.Text, false, versao12, txtBibliotecaCriar); ambienteCriadoSucesso(); config.deletarBroker(txtNome.Text); } if (produto == "Aplicativo") { operacoes.setTxtDiretorio(txtBibliotecaCriar); if (Directory.Exists(@"C:\extrair")) { operacoes.deletarDiretorio(@"c:\extrair", true); } operacoes.extrairInstalador(txtLaboreCriar.Text, @"c:\extrair"); operacoes.DirectoryCopy(@"C:\extrair\WinRoot\totvs\CorporeRM", txtNome .Text, true, false); config.criarArquivoConfig(txtNome.Text, true, versao12, txtLaboreCriar); clsRegraNegocio regra = new clsRegraNegocio(); string aplicativo = regra.retornarAplicativo(txtLaboreCriar.Text); File.Copy(@"C:\Gerencia Ambiente\Ambiente\RM.Lib.Interop.dll", string.Format(@"C:\totvs\{0}\RM{1}\RM.Lib.Interop.dll ", txtNome.Text, aplicativo), true); ambienteCriadoSucesso(); } if (produto == "Portal") { operacoes.setTxtDiretorio(txtPortalCriar); if (Directory.Exists(@"C:\extrair")) { operacoes.deletarDiretorio(@"c:\extrair", true); } operacoes.extrairInstalador(txtPortalCriar.Text, @"c:\extrair"); operacoes.DirectoryCopy(@"C:\extrair\WinRoot\totvs\CorporeRM", txtNome .Text, true, false); config.criarArquivoConfig(txtNome.Text, false, checkVersao12.Checked, txtPortalCriar); config.deletarBroker(txtNome.Text); ambienteCriadoSucesso(); } criou = true; } catch (Exception ex) { criou = false; MessageBox.Show(ex.Message); } return(criou); }
public bool criarAmbiente(string produto) { bool criou = false; clsOperacoes operacoes = new clsOperacoes(progressBar1, lblTeste, checkVersao12.Checked); clsConfiguracao config = new clsConfiguracao(); bool versao12 = false; try { if (produto == "Biblioteca") { operacoes.setTxtDiretorio(txtBibliotecaCriar); operacoes.extrairInstalador(txtBibliotecaCriar.Text, @"c:\extrair"); versao12 = operacoes.verificarVersao12(string.Format(@"C:\extrair\WinRoot\totvs\CorporeRM\RM.Net\RM.Version.dll", txtNome.Text)); operacoes.DirectoryCopy(@"C:\extrair\WinRoot\totvs\CorporeRM", txtNome .Text, true, false); config.criarArquivoConfig(txtNome.Text, false, versao12, txtBibliotecaCriar); ambienteCriadoSucesso(); config.deletarBroker(txtNome.Text); } if (produto == "Aplicativo") { operacoes.setTxtDiretorio(txtBibliotecaCriar); if (Directory.Exists(@"C:\extrair")) { operacoes.deletarDiretorio(@"c:\extrair", true); } operacoes.extrairInstalador(txtLaboreCriar.Text, @"c:\extrair"); operacoes.DirectoryCopy(@"C:\extrair\WinRoot\totvs\CorporeRM", txtNome .Text, true, false); config.criarArquivoConfig(txtNome.Text, true, versao12, txtLaboreCriar); clsRegraNegocio regra = new clsRegraNegocio(); string aplicativo = regra.retornarAplicativo(txtLaboreCriar.Text); File.Copy(@"C:\Gerencia Ambiente\Ambiente\RM.Lib.Interop.dll", string.Format(@"C:\totvs\{0}\RM{1}\RM.Lib.Interop.dll ", txtNome.Text,aplicativo), true); ambienteCriadoSucesso(); } if (produto == "Portal") { operacoes.setTxtDiretorio(txtPortalCriar); if (Directory.Exists(@"C:\extrair")) { operacoes.deletarDiretorio(@"c:\extrair", true); } operacoes.extrairInstalador(txtPortalCriar.Text, @"c:\extrair"); operacoes.DirectoryCopy(@"C:\extrair\WinRoot\totvs\CorporeRM", txtNome .Text, true, false); config.criarArquivoConfig(txtNome.Text, false, checkVersao12.Checked, txtPortalCriar); config.deletarBroker(txtNome.Text); ambienteCriadoSucesso(); } criou = true; } catch (Exception ex) { criou = false; MessageBox.Show(ex.Message); } return criou; }