private void btn_acessar_Click(object sender, EventArgs e) { if ((txt_nomeUsuaario.Text == "admin") & (txt_senhaUsuario.Text == "condobiometry2018admin")) { Develophers develophers = new Develophers(); develophers.Show(); this.Hide(); } else { try { mod.nome = txt_nomeUsuaario.Text; mod.senha = txt_senhaUsuario.Text; if ((txt_nomeUsuaario.Text == "") || (txt_senhaUsuario.Text == "")) { MessageBox.Show("PREENCHA OS CAMPOS NOME E SENHA!", "ACESO NEGADO!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { CondoRepositorio repo = new CondoRepositorio(); if (!repo.Verifica_Login(mod)) { MessageBox.Show("LOGIN OU SENHA INVÁLIDOS!", "ACESSO NEGADO!", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_nomeUsuaario.Text = ""; txt_senhaUsuario.Text = ""; } else { panel_login.Visible = false; if (serialPort1.IsOpen) { serialPort1.Close(); } frm_Setup frm = new frm_Setup(); this.Hide(); frm.ShowDialog(); } } } catch (Exception ex) { MessageBox.Show("NÃO FOI POSSÍVEL SE CONECTAR A BASE DADOS " + ex.Message, "ERRO8", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public void Realizar_Restore() { Develophers frm = new Develophers(); Script_sql = frm.Arquivo_sql; // string strRestoreNome = db_caminhoBackup + Script_sql; string strRestoreNome = Script_sql; try { StreamReader sr = new StreamReader(strRestoreNome); string stdin = sr.ReadToEnd(); sr.Close(); ProcessStartInfo psinfo = new ProcessStartInfo(); psinfo.FileName = Develophers.caminho_instalacao_Mysql + "\\mysql"; psinfo.RedirectStandardInput = true; psinfo.RedirectStandardOutput = false; psinfo.Arguments = ("--host=localhost --user=root --password=34362377rr condo_biometry");//Acesso ao banco psinfo.UseShellExecute = false; Process Iniciar_Restore = Process.Start(psinfo); Iniciar_Restore.StandardInput.WriteLine(stdin); Iniciar_Restore.StandardInput.Close(); Iniciar_Restore.WaitForExit(); Iniciar_Restore.Close(); MessageBox.Show("RESTAURAÇÃO REALIZADA COM SUCESSO!" + "\n" + "ORIGEM DE ARQUIVO: " + strRestoreNome, "SUCESSO", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (IOException ex) { MessageBox.Show("Não foi possível restaurar base de dados! " + "\n" + ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Instalar_BancoDados() { Develophers frm = new Develophers(); Script_sql = frm.Arquivo_sql; // string strRestoreNome = db_caminhoBackup + Script_sql; string strRestoreNome = Script_sql; try { StreamReader sr = new StreamReader(strRestoreNome); string stdin = sr.ReadToEnd(); sr.Close(); ProcessStartInfo psinfo = new ProcessStartInfo(); // psinfo.FileName = "C:\\Program Files (x86)\\MySQL\\MySQL Workbench 6.0 CE\\mysql";//caminho de instalação mysql psinfo.FileName = Develophers.caminho_instalacao_Mysql + "\\mysql"; psinfo.RedirectStandardInput = true; psinfo.RedirectStandardOutput = false; psinfo.Arguments = ("--host=localhost --user=root --password=34362377rr");//Acesso ao banco //"SERVER=127.0.0.1;DATABASE=condo_biometry;UID=root;PASSWORD=34362377rr;"; psinfo.UseShellExecute = false; Process Iniciar_Restore = Process.Start(psinfo); Iniciar_Restore.StandardInput.WriteLine(stdin); Iniciar_Restore.StandardInput.Close(); Iniciar_Restore.WaitForExit(); Iniciar_Restore.Close(); MessageBox.Show("BANCO DE DADOS FOI CRIADO COM SUCESSO!" + "\n" + "ORIGEM DE ARQUIVO: " + strRestoreNome, "SUCESSO", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (IOException ex) { MessageBox.Show("Não foi possível criar a base de dados! " + "\n" + ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); } }