public DataTable Listagem() { ClientesDAL obj = new ClientesDAL(); return(obj.Listagem()); }
public void DeleteTransaction(SqlConnection pConnection, SqlTransaction pTransaction) { ClientesEntity pClientes = new ClientesEntity(); pClientes.id = id; ClientesDAL.DeleteTransaction(pConnection, pTransaction, pClientes); }
public static int Guardar(Cliente pCliente) { // Valida que el nro de documento no se repita List <Cliente> lista = new List <Cliente>(); lista = ClientesDAL.Buscar(pCliente.Nro_Doc); if (lista.Count > 0) { // Si el cliente es nuevo y hay Nros de Documento repetidos if (pCliente.ID == 0) { return(0); } else { // Si el cliente existía y hay nros de documento repetidos // y el nro de documento repetido es diferente del cliente a modificar if (lista[0].ID != pCliente.ID) { return(0); } } } return(ClientesDAL.Guardar(pCliente)); }
private void btnPesquisa_Click(object sender, EventArgs e) { try { SqlConnection conexao = FabricaConexao.getConexao(); ClientesDAL ClieDAL = new ClientesDAL(); if (mskData.Text.Trim() == string.Empty || mskData.Text.Equals("")) { MessageBox.Show("DATA INVALIDA!", "ATENÇÃO!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { ClieDAL.abrirConexao(conexao); string sqlSelect = " select id,idcliente,nome,email,telefone,DataDeEnvio,respondido,assunto,mensagem from Faleconosco where DataDeEnvio ='" + mskData.Text + "'"; dgvFale.DataSource = ClieDAL.retornaDataTable(sqlSelect, conexao); ClieDAL.fecharConexao(conexao); CheckBox1.Checked = false; CheckBox2.Checked = false; cboAssunto.Text = " "; txtEmail.Clear(); } } catch (Exception) { } }
public static bool Exists(string pConnection,int pId) { ClientesEntity pClientes = new ClientesEntity(); pClientes.id = pId; return ClientesDAL.Exists(pConnection, pClientes); }
protected void CheckBoxPrimeiro(object sender, EventArgs e) { if (CheckBox1.Checked == true) { CheckBox2.Checked = false; try { SqlConnection conexao = FabricaConexao.getConexao(); ClientesDAL ClieDAL = new ClientesDAL(); if (CheckBox1.Checked) { ClieDAL.abrirConexao(conexao); string sqlSelect = " select id,idcliente,nome,email,telefone,DataDeEnvio,respondido,assunto,mensagem from Faleconosco where respondido ='" + CheckBox1.Text + "'"; dgvFale.DataSource = ClieDAL.retornaDataTable(sqlSelect, conexao); ClieDAL.fecharConexao(conexao); } } catch (Exception) { } } }
private void button2_Click(object sender, EventArgs e) { try { SqlConnection conexao = FabricaConexao.getConexao(); ClientesDAL ClieDAL = new ClientesDAL(); if (cboAssunto.Text.Trim() == string.Empty || cboAssunto.Text.Equals("")) { MessageBox.Show("ESCOLHA UM ASSUNTO!", "ATENÇÃO!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { ClieDAL.abrirConexao(conexao); string sqlSelect = " select Faleconosco.id, Faleconosco.idcliente, Faleconosco.nome, Faleconosco.email, Faleconosco.telefone, Faleconosco.DataDeEnvio, Faleconosco.respondido, assuntos.assunto, Faleconosco.mensagem from Faleconosco inner join assuntos on assuntos.id_assunto = Faleconosco.assunto where assuntos.assunto = '" + cboAssunto.Text + "'"; dgvFale.DataSource = ClieDAL.retornaDataTable(sqlSelect, conexao); ClieDAL.fecharConexao(conexao); CheckBox1.Checked = false; CheckBox2.Checked = false; mskData.Text = DateTime.Now.ToString(); txtEmail.Clear(); } } catch (Exception) { } }
public void Alterar(ClienteInformation cliente) { ClientesDAL obj = new ClientesDAL(); obj.Alterar(cliente); }
private void button3_Click(object sender, EventArgs e) { try { SqlConnection conexao = FabricaConexao.getConexao(); ClientesDAL ClieDAL = new ClientesDAL(); if (txtBarras.Text.Trim() == string.Empty || txtBarras.Text.Equals("")) { MessageBox.Show("Digite um Código de Barras", "ATENÇÃO!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { ClieDAL.abrirConexao(conexao); string sqlSelect = " select IDproduto,CodigoDeBarras,Marca,Nome,ValorUnitario,Quantidade,Categoria,Fornecedor,DataEntrada,DataVencimento from Produtos where CodigoDeBarras ='" + txtBarras.Text + "'"; DgvEstoque.DataSource = ClieDAL.retornaDataTable(sqlSelect, conexao); ClieDAL.fecharConexao(conexao); mskVencimento.Clear(); cboCategoria.Text = " "; } } catch (Exception) { } }
// GET api/clientehost/3 public Cliente Get(int id) { List <Cliente> _cliente = new List <Cliente>(); ClientesDAL _clienteDal = new ClientesDAL(); _cliente = _clienteDal.retornaClientes(); return(_cliente.Where(x => x.Id == id).FirstOrDefault()); }
// GET api/clientehost public IEnumerable <Cliente> Get() { List <Cliente> _cliente = new List <Cliente>(); ClientesDAL _clienteDal = new ClientesDAL(); _cliente = _clienteDal.retornaClientes(); return(_cliente); }
public void Excluir(int codigo) { if (codigo < 1) { throw new Exception("Selecione um cliente antes de excluí-lo."); } ClientesDAL obj = new ClientesDAL(); obj.Excluir(codigo); }
public static List<ClientesBO> GetAll(string pConnection) { List<ClientesEntity> lClientes = ClientesDAL.GetAll(pConnection); List<ClientesBO> lista = new List<ClientesBO>(); foreach (ClientesEntity ent in lClientes) { lista.Add(new ClientesBO(ent)); } return lista; }
private void carregar() { SqlConnection conexao = FabricaConexao.getConexao(); ClientesDAL ClieDAL = new ClientesDAL(); ClieDAL.abrirConexao(conexao); string sqlSelect = "select IDvenda,CPFcliente,DataVenda, ValorTotal,FormaPagamento from venda"; DgvVenda.DataSource = ClieDAL.retornaDataTable(sqlSelect, conexao); }
public void Alterar(ClienteInformation cliente) { if (cliente.Nome.Trim().Length == 0) { throw new Exception("O nome do clinte é obrigatório"); } cliente.Email = cliente.Email.ToLower(); ClientesDAL obj = new ClientesDAL(); obj.Alterar(cliente); }
public void Save(string pConnection) { ClientesEntity pCLientes = new ClientesEntity(); pCLientes.id = id; pCLientes.apellido = apellido; pCLientes.nombre = nombre; pCLientes.nit = nit; if (IsNew == false) ClientesDAL.Update(pConnection, pCLientes); else ClientesDAL.Add(pConnection, pCLientes); }
public ClienteVIEW CargarCliente(int idCliente) { try { ClientesDAL clientesDAL = new ClientesDAL(); return(clientesDAL.CargarCliente(idCliente)); } catch (Exception ex) { throw ex; } }
private void carregarInativos() { SqlConnection conexao = FabricaConexao.getConexao(); ClientesDAL ClieDAL = new ClientesDAL(); ClieDAL.abrirConexao(conexao); string sqlSelect = "select * from Funcionario where StatusFunc = 'inativo'"; dgvFale.DataSource = ClieDAL.retornaDataTable(sqlSelect, conexao); }
public List <ClienteVIEW> ListarTodosClientes() { try { ClientesDAL clientesDAL = new ClientesDAL(); return(clientesDAL.ListarTodosClientes()); } catch (Exception ex) { throw ex; } }
private void carregar() { SqlConnection conexao = FabricaConexao.getConexao(); ClientesDAL ClieDAL = new ClientesDAL(); ClieDAL.abrirConexao(conexao); string sqlSelect = "select * from cliente "; dgvFale.DataSource = ClieDAL.retornaDataTable(sqlSelect, conexao); }
public static int Guardar(Cliente pCliente) { DateTime fecha_nac = DateTime.Parse(pCliente.Fecha_Nac); if (fecha_nac <= DateTime.Now.Date) { return(ClientesDAL.Guardar(pCliente)); } else { return(0); } }
private void carregar() { SqlConnection conexao = FabricaConexao.getConexao(); ClientesDAL ClieDAL = new ClientesDAL(); ClieDAL.abrirConexao(conexao); string sqlSelect = "select Faleconosco.id, Faleconosco.idcliente, Faleconosco.nome, Faleconosco.email, Faleconosco.telefone, Faleconosco.DataDeEnvio, Faleconosco.respondido, assuntos.assunto, Faleconosco.mensagem from Faleconosco inner join assuntos on assuntos.id_assunto = Faleconosco.assunto "; dgvFale.DataSource = ClieDAL.retornaDataTable(sqlSelect, conexao); }
public void SaveTransaction(SqlConnection pConnection, SqlTransaction pTransaction) { ClientesEntity pClientes = new ClientesEntity(); pClientes.id = id; pClientes.apellido = apellido; pClientes.nombre = nombre; pClientes.nit = nit; if (IsNew == false) ClientesDAL.UpdateTransaction(pConnection, pTransaction, pClientes); else ClientesDAL.AddTransaction(pConnection, pTransaction, pClientes); }
public ClientesBO(string pConnection, int pId) { ClientesEntity pClientes = new ClientesEntity(); pClientes.id = pId; try { this.FillEntity(ClientesDAL.GetSingle(pConnection, pClientes)); } catch { this.FillEntity(); } }
public void Incluir(ClienteInformation cliente) { //O nome do cliente é obrigatório if (cliente.Nome.Trim().Length == 0) { throw new Exception("O nome do cliente é obrigatório"); } //E-mail é sempre em letras minúsculas cliente.Email = cliente.Email.ToLower(); //Se tudo está Ok, chama a rotina de inserção. ClientesDAL obj = new ClientesDAL(); obj.Incluir(cliente); }
// Regra de Négocios para Inserir dados no BD public void Inserir(ClienteInformation cliente) { // Obriga que o nome tenha algo escrito if (cliente.Nome.Trim().Length == 0) { throw new Exception("O nome do clinte é obrigatório"); } // E obriga que o email deve ser em caixa baixa cliente.Email = cliente.Email.ToLower(); // Cria um objeto da camada de acesso ao banco de dados ClientesDAL obj = new ClientesDAL(); // Chama o método da DAL e insere no BD o objeto cliente criado a partir do Modulo que é responspavel por maniupar a tabela clientes obj.Inserir(cliente); }
private void button1_Click(object sender, EventArgs e) { SqlConnection conexao = FabricaConexao.getConexao(); ClientesDAL ClieDAL = new ClientesDAL(); ClieDAL.abrirConexao(conexao); string sqlSelect = " select * from Fornecedor where NomeFantasia like '%" + txtNome.Text + "%'"; dgvFale.DataSource = ClieDAL.retornaDataTable(sqlSelect, conexao); txtNome.Clear(); txtEmail.Clear(); mskCNPJ.Clear(); }
private void button5_Click(object sender, EventArgs e) { SqlConnection conexao = FabricaConexao.getConexao(); ClientesDAL ClieDAL = new ClientesDAL(); ClieDAL.abrirConexao(conexao); string sqlSelect = " select * from cliente where CPF ='" + mskCPF.Text + "'"; dgvFale.DataSource = ClieDAL.retornaDataTable(sqlSelect, conexao); txtNome.Clear(); txtEmail.Clear(); mskCPF.Clear(); }
private void button2_Click(object sender, EventArgs e) { SqlConnection conexao = FabricaConexao.getConexao(); ClientesDAL ClieDAL = new ClientesDAL(); ClieDAL.abrirConexao(conexao); string sqlSelect = " select * from Funcionario where email like '%" + txtEmail.Text + "%'"; dgvFale.DataSource = ClieDAL.retornaDataTable(sqlSelect, conexao); txtNome.Clear(); txtEmail.Clear(); cboCargo.Text = " "; mskCPF.Clear(); }
private void btnID_Click(object sender, EventArgs e) { SqlConnection conexao = FabricaConexao.getConexao(); ClientesDAL ClieDAL = new ClientesDAL(); ClieDAL.abrirConexao(conexao); string sqlSelect = " select * from Encomendas where idPedido like '%" + txtID.Text + "%'"; dgvEncomendas.DataSource = ClieDAL.retornaDataTable(sqlSelect, conexao); txtID.Clear(); txtEmail.Clear(); txtOcasioes.Clear(); mskNascimento.Text = DateTime.Now.ToString(); }