protected void btn_salvar_ima_Click(object sender, ImageClickEventArgs e) { string idItem = Request.QueryString["codigo"]; Database_CadastroEntities4 context = new Database_CadastroEntities4(); TB_VENDEDOR vend = new TB_VENDEDOR() { nome = txt_nome.Text, cpf = txt_cpf.Text, email = txt_email.Text, }; if (String.IsNullOrEmpty(idItem)) { // Adcionando Registro context.TB_VENDEDOR.Add(vend); // Mensagem de Sucesso MessageBox.Show("Vendedor Inserido Com Sucesso!"); // COMMIT context.SaveChanges(); // voltando para pegina Principal Response.Redirect("Tela_Principal.aspx"); } }
protected void btn_buscar_Click(object sender, EventArgs e) { string cpf = Text_CPF.Text; TB_VENDEDOR vendedor = context.TB_VENDEDOR.First(c => c.cpf == cpf); Text_nome.Text = vendedor.nome; Text_email.Text = vendedor.email; Bloquear_text(); }
protected void btn_excluir_Click(object sender, ImageClickEventArgs e) { string cpf = Text_CPF.Text; TB_VENDEDOR vendedor = context.TB_VENDEDOR.First(c => c.cpf == cpf); context.TB_VENDEDOR.Remove(vendedor); MessageBox.Show("Vendedor Excluido Com Sucesso!!!"); // COMMIT context.SaveChanges(); // voltando para pegina Principal PaginaInicial(); }
protected void Btn_salvar_Click(object sender, ImageClickEventArgs e) { string cpf = Text_CPF.Text; TB_VENDEDOR vendedor = context.TB_VENDEDOR.First(c => c.cpf == cpf); vendedor.nome = Text_nome.Text; vendedor.email = Text_email.Text; MessageBox.Show("Vendedor Alterado Com Sucesso!!!"); // COMMIT context.SaveChanges(); // voltando para pegina Principal PaginaInicial(); }