Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            WebForm.App_Code.Camadas.BLL.Cliente bllCliente = new WebForm.App_Code.Camadas.BLL.Cliente();

            //gvCliente.DataSource = bllCliente.Select();
            gvCliente.DataBind();

            Cache["OP"] = "X";
            habilitaCampos(false);
        }
    }
Exemplo n.º 2
0
    protected void btnRemover_Click(object sender, EventArgs e)
    {
        if (txtId.Text != String.Empty)
        {
            if (Convert.ToInt32(txtId.Text) > 0)
            {
                WebForm.App_Code.Camadas.BLL.Cliente   bllCliente = new WebForm.App_Code.Camadas.BLL.Cliente();
                WebForm.App_Code.Camadas.MODEL.Cliente cliente    = new WebForm.App_Code.Camadas.MODEL.Cliente();


                cliente.id = Convert.ToInt32(txtId.Text);
                bllCliente.Delete(cliente);

                gvCliente.DataBind();

                Cache["OP"] = "X";
                habilitaCampos(false);
            }
        }
    }
Exemplo n.º 3
0
    protected void btnGravar_Click(object sender, EventArgs e)
    {
        WebForm.App_Code.Camadas.BLL.Cliente   bllCliente = new WebForm.App_Code.Camadas.BLL.Cliente();
        WebForm.App_Code.Camadas.MODEL.Cliente Cliente    = new WebForm.App_Code.Camadas.MODEL.Cliente();

        Cliente.id       = Convert.ToInt32(txtId.Text);
        Cliente.nome     = txtNome.Text;
        Cliente.cpf      = txtCpf.Text;
        Cliente.endereco = txtEndereco.Text;
        Cliente.cidade   = txtCidade.Text;
        Cliente.telefone = txtTelefone.Text;
        Cliente.sexo     = rdbSexo.Text;
        Cliente.email    = txtEmail.Text;
        Cliente.datanasc = Convert.ToInt32(txtIdade.Text);


        if (Cache["OP"].ToString() == "I")
        {
            bllCliente.Insert(Cliente);
        }
        else if (Cache["OP"].ToString() == "E")
        {
            bllCliente.Update(Cliente);
        }

        //gvCliente.DataSource = bllCliente.Select();
        gvCliente.DataBind();

        if (Cache["OP"].ToString() == "I")
        {
            gvCliente.SetPageIndex(gvCliente.PageCount);
        }

        Cache["OP"] = "X;";
        habilitaCampos(false);
    }