Esempio n. 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                Modelo.Clientes      iClientes;
                DAL.DALClassClientes iDALClassClientes;


                iClientes = new Modelo.Clientes(0, TextBoxNome.Text, TextBoxCPF.Text, TextBoxPerfil.Text);


                iDALClassClientes = new DAL.DALClassClientes();


                iDALClassClientes.Insert(iClientes);


                Response.Redirect("~\\WebFormCRUDClientes.aspx");
            }


            catch
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "none", "ErroTamanhoExagerado()", true);
            }
        }
Esempio n. 2
0
        protected void ObjectDataSource1_Deleted(object sender, ObjectDataSourceStatusEventArgs e)
        {
            try
            {
                int                  codigo;
                Modelo.Clientes      aClientes;
                DAL.DALClassClientes aDALClassClientes;

                codigo = int.Parse(DetailsView1.Rows[0].Cells[1].Text);

                aClientes    = new Modelo.Clientes();
                aClientes.id = codigo;

                aDALClassClientes = new DAL.DALClassClientes();

                aDALClassClientes.Delete(aClientes);

                Response.Redirect("~\\WebFormCRUDClientes.aspx");
            }
            catch
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "none", "ErroTamanhoExagerado()", true);
            }
        }