public int ComprasRealizadas(Model.Entities.tb_cliente cli) { int total = db.ComprasRealizadas(cli); return(total); }
public void Remover(int id) { Model.Entities.tb_cliente remove = db.tb_cliente.FirstOrDefault(t => t.id_cliente == id); db.tb_cliente.Remove(remove); db.SaveChanges(); }
private void button1_Click(object sender, EventArgs e) { Model.Entities.tb_cliente cli = new Model.Entities.tb_cliente(); Business.ClienteBusiness buscli = new Business.ClienteBusiness(); cli.ds_cel = txtCel.Text; cli.ds_cep = txtCep.Text; cli.ds_cpf = txtCpf.Text; cli.ds_email = txtEmail.Text; cli.ds_rg = txtRg.Text; cli.ds_tel = txtTel.Text; cli.dt_nasc = dtpNasc.Value; cli.end_cliente = txtEnd.Text; cli.uf_estado = cboUf.Text; cli.nm_cliente = txtNome.Text; cli.nu_cliente = txtNu.Text; if (rdnF.Checked == true) { cli.ds_genero = "F"; } else { cli.ds_genero = "M"; } buscli.Inserir(cli); MessageBox.Show("Cadastro efetuado com sucesso", "Fast Care", MessageBoxButtons.OK, MessageBoxIcon.Information); frmCadastrar tela = new frmCadastrar(); tela.Show(); Hide(); }
public void Alterar(Model.Entities.tb_cliente cliente) { DataBase.ClienteDataBase db = new DataBase.ClienteDataBase(); if (cliente.ds_cel == string.Empty) { throw new ArgumentException(" o campo Celular è obrigatorio"); } if (cliente.ds_cep == string.Empty) { throw new ArgumentException(" o campo CEP è obrigatorio"); } if (cliente.ds_cpf == string.Empty) { throw new ArgumentException(" o campo CPF è obrigatorio"); } if (cliente.ds_email == string.Empty) { throw new ArgumentException(" o campo Celular è obrigatorio"); } if (cliente.ds_rg == string.Empty) { throw new ArgumentException(" o campo RG è obrigatorio"); } if (cliente.ds_tel == string.Empty) { throw new ArgumentException(" o campo TELEFONE è obrigatorio"); } if (cliente.dt_nasc > DateTime.Now) { throw new ArgumentException(" o campo NASCIMENTO deve ser preenchido corretamente"); } if (cliente.end_cliente == string.Empty) { throw new ArgumentException(" o campo ENDEREÇO è obrigatorio"); } if (cliente.nm_cliente == string.Empty) { throw new ArgumentException(" o campo NOME è obrigatorio"); } if (cliente.nu_cliente == string.Empty) { throw new ArgumentException(" o campo Nº CASA è obrigatorio"); } if (cliente.uf_estado == string.Empty) { throw new ArgumentException(" o campo ESTADO è obrigatorio"); } db.Alterar(cliente); }
public void Alterar(Model.Entities.tb_cliente cli) { Model.Entities.tb_cliente antigo = db.tb_cliente.FirstOrDefault(c => c.id_cliente == cli.id_cliente); antigo.ds_cel = cli.ds_cel; antigo.ds_cep = cli.ds_cep; antigo.ds_cpf = cli.ds_cpf; antigo.ds_email = cli.ds_email; antigo.ds_rg = cli.ds_rg; antigo.ds_tel = cli.ds_tel; antigo.dt_nasc = cli.dt_nasc; antigo.end_cliente = cli.end_cliente; antigo.nm_cliente = cli.nm_cliente; antigo.nu_cliente = cli.nu_cliente; antigo.uf_estado = cli.uf_estado; db.SaveChanges(); }
public int ComprasAvaliadas(Model.Entities.tb_cliente cli) { int total = db.tb_compra.Where(m => m.id_cliente == cli.id_cliente && m.ds_avaliacao != null).Count(); return(total); }
public int ComprasRealizadas(Model.Entities.tb_cliente cli) { int total = db.tb_compra.Where(m => m.id_cliente == cli.id_cliente).Count(); return(total); }
public void Inserir(Model.Entities.tb_cliente cliente) { db.tb_cliente.Add(cliente); db.SaveChanges(); }