private void ButtonExcluir_Click(object sender, EventArgs e) { var conexao = (ConexaoEntidade)ListConexoes.SelectedItem; if (conexao != null) { ConexaoService.Deletar(conexao); CarregarConexoes(); LimparFormulario(); } }
private void CarregarConexoes() { ComboBoxConexao.DataSource = ConexaoService.BuscarPorOidSistema(SistemaSelecionado.OID_SISTEMA); if (((List <ConexaoEntidade>)ComboBoxConexao.DataSource).Count > 0) { ComboBoxConexao.SelectedIndex = 0; } else { ComboBoxConexao.SelectedIndex = -1; } }
private void BtnLogin_Click(object sender, EventArgs e) { if (ConexaoService.BuscarConexao(@"C:\Projeto LocalBase\conection.txt")) { var usuario = _loginService.GetUsuarioModel(TxtUsuario.Text, TxtSenha.Text); if (_loginService.AutorizarLogin(usuario)) { TelaImportacao telaInicio = new TelaImportacao(); telaInicio.ShowDialog(); } else { MessageBox.Show("Login Invalido"); } } else { MessageBox.Show("Caminho Invalido"); } }
private void ButtonSalvar_Click(object sender, EventArgs e) { if (ModoEdicao) { var conexao = (ConexaoEntidade)ListConexoes.SelectedItem; conexao.NOME = TextBoxNome.Text; conexao.PROVIDER = ComboBoxProvedor.SelectedItem.ToString(); conexao.SERVIDOR = ComboBoxServidor.SelectedItem.ToString(); conexao.USUARIO = TextBoxUsuario.Text; conexao.SENHA = TextBoxSenha.Text; conexao.OID_SISTEMA = ((SistemaEntidade)ComboBoxSistema.SelectedItem).OID_SISTEMA; conexao.BANCO = ComboBoxBanco.SelectedItem.ToString(); ConexaoService.Atualizar(conexao); MessageBox.Show("Conexão alterada com sucesso!"); } else { var conexao = new ConexaoEntidade { NOME = TextBoxNome.Text, PROVIDER = ComboBoxProvedor.SelectedItem.ToString(), SERVIDOR = ComboBoxServidor.SelectedItem.ToString(), USUARIO = TextBoxUsuario.Text, SENHA = TextBoxSenha.Text, BANCO = ComboBoxBanco.SelectedItem.ToString() }; conexao.OID_SISTEMA = ((SistemaEntidade)ComboBoxSistema.SelectedItem).OID_SISTEMA; ConexaoService.Inserir(conexao); MessageBox.Show("Conexão inserida com sucesso!"); } CarregarConexoes(); LimparFormulario(); }
public override void BuscarColunas(Entidade entidade) { var listaColunas = new List <EntidadeColuna>(); var colunas = ConexaoService.BuscarColunas(Conexao.SERVIDOR, Conexao.USUARIO, Conexao.SENHA, Conexao.BANCO, entidade.NomeTabela, entidade.Sinonimo.HasValue ? entidade.Sinonimo.Value : false); foreach (var column in colunas) { if (!((string)column.type).Contains("Entidade") || !listaColunas.Any(x => x.Nome == column.name)) { listaColunas.Add(new EntidadeColuna { Nome = (string)column.name, Tipo = MapeiaTipo((string)column.type), TipoTS = MapeiaTipoTS((string)column.type), AceitaNulo = column.is_nullable, IsColunaExtra = false, ChavePrimaria = (bool)column.is_identity || (string)column.name == entidade.ChavePrimaria }); } } AdicionarColunas(entidade, listaColunas); }
private void CarregarBancos() { ComboBoxBanco.DataSource = ConexaoService.BuscarBancos(ComboBoxServidor.SelectedItem.ToString(), TextBoxUsuario.Text, TextBoxSenha.Text); }
private void CarregarConexoes() { ListConexoes.DataSource = ConexaoService.Listar(); }
public TelaLogin() { InitializeComponent(); ConexaoService.BuscarConexao(@"C:\temp\teste.txt"); _loginService = new LoginService(); }
private void ClasseLista_Load(object sender, EventArgs e) { ClasseRepository rep = new ClasseRepository(ConexaoService.GetConnectionString()); dataGridView.DataSource = rep.Lista(); }