예제 #1
0
        public void Seleccionar()
        {
            if (DropDownList1.SelectedIndex == 0)
            {
                int id = Convert.ToInt32(TextBox1.Text);
                lista = ServicioBll.GetList(p => p.idServicio == id);
                GridView1.DataSource = lista;
                GridView1.DataBind();
            }
            else if (DropDownList1.SelectedIndex == 1)
            {
                if (TextBox1.Text == "")
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Debe de Insertar el Nombre');</script>");
                }
                else
                {
                    lista = ServicioBll.GetList(p => p.nombre == TextBox1.Text);
                    GridView1.DataSource = lista;
                    GridView1.DataBind();
                }
            }
            else if (DropDownList1.SelectedIndex == 2)
            {
                lista = ServicioBll.GetListTodo();
                GridView1.DataSource = lista;
                GridView1.DataBind();
            }

            GridView1.DataSource = lista;
            GridView1.DataBind();
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Servicios servicio = new Servicios();

            /*GridView1.DataSource = BLL.ServicioBll.GetListTodo();
             * GridView1.DataBind();*/
            lista = ServicioBll.GetListTodo();
        }
예제 #3
0
        protected void Eliminar_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(idTextbox.Text);

            Servicios = ServicioBll.Buscar(p => p.idServicio == id);
            if (Servicios != null)
            {
                ServicioBll.Eliminar(Servicios);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('No existe !');");
            }
        }
예제 #4
0
 protected void Guardar_Click(object sender, EventArgs e)
 {
     Servicios = LLenar();
     if (Servicios.idServicio != 0)
     {
         ServicioBll.Modificar(Servicios);
         Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Modificado !');</script>");
     }
     else
     {
         ServicioBll.Guardar(Servicios);
         Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Guardado !');</script>");
         limpiar();
         NombreTextbox.Focus();
     }
 }
예제 #5
0
        protected void Buscar_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(idTextbox.Text);

            Servicios = ServicioBll.Buscar(p => p.idServicio == id);

            if (Servicios != null)
            {
                NombreTextbox.Text = Servicios.nombre;
                CostoTextBox1.Text = Convert.ToString(Servicios.costo);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('No existe !');");
            }
        }