/// <summary> /// Constructor por defecto que instancia las 3 listas y setea el valor estatico iva /// </summary> public Negocio() { this.clientes = ClientesDB.SelectAll(); this.productos = ProductosDB.SelectAll(); this.ventas = new List <Venta>(); Negocio.porcentajeIva = 21; }
private void btnEliminarClie_Click(object sender, EventArgs e) { ClientesDB clientesDB = new ClientesDB(); try { if (dgvClientes.SelectedRows.Count > 0) { if (MessageBox.Show("Está seguro que desea eliminar el registro?", "No apto para inseguros", MessageBoxButtons.YesNo) == DialogResult.Yes) { Cliente aux = (Cliente)dgvClientes.CurrentRow.DataBoundItem; clientesDB.Eliminar(aux.Id); WFClientes_Load(sender, e); } } else { MessageBox.Show("Por favor seleccione un registro"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void WFClientes_Load(object sender, EventArgs e) { ClientesDB clientesDB = new ClientesDB(); try { dgvClientes.DataSource = clientesDB.Listar(); dgvClientes.Columns[0].Visible = false; dgvClientes.Columns[1].Width = 50; dgvClientes.Columns[5].DisplayIndex = 1; dgvClientes.Columns[4].Width = 120; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
protected void btnSalvar_Click(object sender, EventArgs e) { DataSet dsCliente = ClientesDB.SelectLogin(TextUsuario.Text, ClientesDB.PWD(TextSenha.Text)); int qtdCli = dsCliente.Tables[0].Rows.Count; DataSet dsEmpresa = EmpresasDB.SelectLogin(TextUsuario.Text, EmpresasDB.PWD(TextSenha.Text)); int qtdEmp = dsEmpresa.Tables[0].Rows.Count; if (qtdCli == 1 && qtdEmp == 0) { Clientes cli = new Clientes(); cli.Cli_nome = dsCliente.Tables[0].Rows[0]["cli_nome"].ToString(); cli.Cli_email = dsCliente.Tables[0].Rows[0]["cli_email"].ToString(); cli.Cli_data_nascimento = Convert.ToDateTime(dsCliente.Tables[0].Rows[0]["cli_data_nascimento"].ToString()); cli.Cli_id = Convert.ToInt32(dsCliente.Tables[0].Rows[0]["cli_id"]); Session["cli_cliente"] = cli; Response.Redirect("../PaginaCliente/MeusDados.aspx"); } else if (qtdCli == 0 && qtdEmp == 1) { Empresas emp = new Empresas(); emp.Emp_id = Convert.ToInt32(dsEmpresa.Tables[0].Rows[0]["emp_id"]); emp.Emp_razao_social = dsEmpresa.Tables[0].Rows[0]["emp_razao_social"].ToString(); emp.Emp_nome_fantasia = dsEmpresa.Tables[0].Rows[0]["emp_nome_fantasia"].ToString(); emp.Emp_cnpj = dsEmpresa.Tables[0].Rows[0]["emp_cnpj"].ToString(); emp.Emp_email = dsEmpresa.Tables[0].Rows[0]["emp_email"].ToString(); emp.Emp_senha = dsEmpresa.Tables[0].Rows[0]["emp_senha"].ToString(); emp.Emp_numero_endereco = dsEmpresa.Tables[0].Rows[0]["emp_numero_endereco"].ToString(); Session["emp_empresa"] = emp; Response.Redirect("../PaginaEmpresa/EmpDados.aspx"); } else { ltl.Text = "<p class='text-success'>Erro no Login</p>"; Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>$('#myModal').modal('show');</script>", false); } }
protected void carregaDados() { Clientes id = (Clientes)Session["cli_cliente"]; Clientes cli = new Clientes(); DataSet ds = ClientesDB.SelectAll(id.Cli_id); cli.Cli_id = Convert.ToInt32(ds.Tables[0].Rows[0]["cli_id"]); cli.Cli_nome = Convert.ToString(ds.Tables[0].Rows[0]["cli_nome"]); cli.Cli_senha = Convert.ToString(ds.Tables[0].Rows[0]["cli_senha"]); cli.Cli_email = Convert.ToString(ds.Tables[0].Rows[0]["cli_email"]); cli.Cli_celular = Convert.ToString(ds.Tables[0].Rows[0]["cli_celular"]); cli.Cli_sexo = Convert.ToChar(ds.Tables[0].Rows[0]["cli_sexo"]); cli.Cli_data_nascimento = Convert.ToDateTime(ds.Tables[0].Rows[0]["cli_data_nascimento"]); cli.Cli_foto_url = Convert.ToString(ds.Tables[0].Rows[0]["cli_foto_url"]); textCalendario.Text = cli.Cli_data_nascimento.ToString(); textCelular.Text = cli.Cli_celular.ToString(); textEmail.Text = cli.Cli_email.ToString(); textNome.Text = cli.Cli_nome.ToString(); rblSexo.SelectedValue = cli.Cli_sexo.ToString(); }
protected void btnAtualizar_Click(object sender, EventArgs e) { Clientes id = (Clientes)Session["cli_cliente"]; Clientes cli = new Clientes(); DataSet ds = ClientesDB.SelectAll(id.Cli_id); cli.Cli_id = Convert.ToInt32(ds.Tables[0].Rows[0]["cli_id"]); cli.Cli_nome = Convert.ToString(ds.Tables[0].Rows[0]["cli_nome"]); cli.Cli_senha = Convert.ToString(ds.Tables[0].Rows[0]["cli_senha"]); cli.Cli_email = Convert.ToString(ds.Tables[0].Rows[0]["cli_email"]); cli.Cli_celular = Convert.ToString(ds.Tables[0].Rows[0]["cli_celular"]); cli.Cli_sexo = Convert.ToChar(ds.Tables[0].Rows[0]["cli_sexo"]); cli.Cli_data_nascimento = Convert.ToDateTime(ds.Tables[0].Rows[0]["cli_data_nascimento"]); cli.Cli_foto_url = Convert.ToString(ds.Tables[0].Rows[0]["cli_foto_url"]); cli.Cli_data_nascimento = Convert.ToDateTime(textCalendario.Text); cli.Cli_celular = textCelular.Text; cli.Cli_email = textEmail.Text; cli.Cli_nome = textNome.Text; cli.Cli_sexo = Convert.ToChar(rblSexo.SelectedValue); switch (ClientesDB.Update(cli)) { case 0: ltl.Text = "<p class='text-success'>atualizado com sucesso </p>"; Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>$('#myModal').modal('show');</script>", false); break; case -2: ltl.Text = "<p class='text-success'>Erro no cadastro</p>"; Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>$('#myModal').modal('show');</script>", false); break; } }
private void btnAgregarCliente_Click(object sender, EventArgs e) { ClientesDB clientesDB = new ClientesDB(); try { if (cliente == null) { cliente = new Cliente(); } cliente.NombreApellido = TBNombreClie.Text.Trim(); cliente.NombreApellido = cliente.NombreApellido.ToUpper(); cliente.Cuit = TBCuitClie.Text.Trim(); cliente.Telefono = TBTelefClie.Text.Trim(); cliente.Direccion = TBDireccClie.Text.Trim(); cliente.Direccion = cliente.Direccion.ToUpper(); cliente.Mail = TBMailClie.Text.Trim(); cliente.Fnac = DTPFnac.Value; if (Text != "Modificar") { clientesDB.Agregar(cliente); MessageBox.Show("Agregado con éxito"); } else { clientesDB.Modificar(cliente); MessageBox.Show("Modificado con éxito"); } Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public static List <Cliente> ObtenerCLientesActivos() { return(ClientesDB.ObtenerCLientesActivos()); }
public static Cliente ObtenerCLiente(int?id_cliente) { return(id_cliente != null?ClientesDB.ObtenerCLiente(id_cliente.Value) : null); }
public List <Cliente> ObtenerPorMiembro(int idUsuario) { return(ClientesDB.ObtenerPorMiembro(idUsuario)); }
public List <Cliente> ObtenerTodos() { return(ClientesDB.ObtenerTodos()); }
protected void btnConta_Click(object sender, EventArgs e) { if (EscolhePessoa.SelectedValue == "1") { Clientes cli = new Clientes(); cli.Cli_nome = textNome.Text; cli.Cli_email = textEmail.Text; cli.Cli_senha = ClientesDB.PWD(textSenha.Text); cli.Cli_sexo = Convert.ToChar(rblSexo.SelectedValue); cli.Cli_data_nascimento = Convert.ToDateTime(textCalendario.Text); cli.Cli_celular = textCelular.Text; cli.Cli_id = ClientesDB.Insert(cli); Cidades cid = new Cidades(); Bairros bai = new Bairros(); bai.Bai_nome = textBairro.Text; bai.Bai_rua = textRua.Text; //FK cid.Cid_id = Convert.ToInt32(rblCidade.SelectedValue); bai.Cid_id = cid; bai.Bai_id = BairrosDB.Insert(bai); Enderecos end = new Enderecos(); end.End_cep = textCep.Text; end.End_tipo = textComplemento.Text; //FK end.Bai_id = bai; end.End_id = EnderecosDB.Insert(end); ClienteEndereco cle = new ClienteEndereco(); cle.Cle_num = textNumero.Text; cle.Cle_principal = true; //FK cle.Cli_id = cli; cle.End_id = end; switch (ClienteEnderecoDB.Insert(cle)) { case 0: Session["cli_cliente"] = cli; Response.Redirect("../PaginaCliente/MeusDados.aspx"); break; case -2: ltl.Text = "<p class='text-success'>Erro no cadastro</p>"; Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>$('#myModal').modal('show');</script>", false); break; } } else { Cidades cid = new Cidades(); Bairros bai = new Bairros(); bai.Bai_nome = textBairro.Text; bai.Bai_rua = textRua.Text; //FK cid.Cid_id = Convert.ToInt32(rblCidade.SelectedValue); bai.Cid_id = cid; bai.Bai_id = BairrosDB.Insert(bai); Enderecos end = new Enderecos(); end.End_cep = textCep.Text; end.End_tipo = textComplemento.Text; //FK end.Bai_id = bai; end.End_id = EnderecosDB.Insert(end); Empresas emp = new Empresas(); emp.Emp_razao_social = textSocial.Text; emp.Emp_email = textEmail2.Text; emp.Emp_nome_fantasia = textNomeFantasia.Text; emp.Emp_cnpj = textCNPJ.Text; emp.Emp_senha = EmpresasDB.PWD(textSenha2.Text); emp.Emp_numero_endereco = textNumero.Text; //FK emp.End_id = end; emp.Emp_id = EmpresasDB.Insert(emp); Telefones tel = new Telefones(); tel.Tel_ddd = Convert.ToString(textDDD.Text); tel.Tel_num = Convert.ToString(textTelefone.Text); //FK tel.Emp_id = emp; switch (TelefonesDB.Insert(tel)) { case -2: ltl.Text = "<p class='text-success'>Erro no cadastro</p>"; Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>$('#modalUpdate').modal('show');</script>", false); break; default: Session["emp_empresa"] = emp; Response.Redirect("../PaginaEmpresa/EmpDados.aspx"); break; } } }