protected void btnSalvar_Click(object sender, EventArgs e) { CpfCnpjEntities1 context = new CpfCnpjEntities1(); if (CpfCnpjValid(txtCpf.Text)) { sendMessage("CPF Valido"); } else { sendMessage("CPF Invalido"); return; } Cliente cliente = new Cliente() { nome = txtNome.Text, telefone = txtTelefone.Text, cidade = txtCidade.Text, endereco = txtEndereco.Text, cpf = txtCpf.Text }; context.Cliente.Add(cliente); context.SaveChanges(); loadGrid(); }
protected void btnSalvar_Click(object sender, EventArgs e) { CpfCnpjEntities1 context = new CpfCnpjEntities1(); if (CpfCnpjValid(txtCnpj.Text)) { sendMessage("CNPJ Valido"); } else { sendMessage("CNPJ Invalido"); return; } Fornecedor fornecedor = new Fornecedor() { nome = txtNome.Text, telefone = txtTelefone.Text, cidade = txtCidade.Text, endereco = txtEndereco.Text, cnpj = txtCnpj.Text }; context.Fornecedor.Add(fornecedor); context.SaveChanges(); loadGrid(); }
protected void btnSalvar_Click(object sender, EventArgs e) { CpfCnpjEntities1 context = new CpfCnpjEntities1(); Tipo tipo = new Tipo() { descricao = txtDescricao.Text }; context.Tipo.Add(tipo); context.SaveChanges(); loadGrid(); }
protected void btnSalvar_Click(object sender, EventArgs e) { CpfCnpjEntities1 context = new CpfCnpjEntities1(); Material material = new Material() { descricao = txtDescricao.Text, dataEntrada = DateTime.UtcNow, tipo = int.Parse(txtTipo.SelectedValue.ToString()), valor = int.Parse(txtValor.Text), fornecedor = int.Parse(txtFornecedor.SelectedValue.ToString()) }; context.Material.Add(material); context.SaveChanges(); loadGrid(); sendMessage("Registro Inserido"); }