Exemplo n.º 1
0
        protected void EliminarButton_Click(object sender, EventArgs e)
        {
            GridViewRow          grid        = GridView.SelectedRow;
            RepositorioServicios repositorio = new RepositorioServicios();
            int id        = Utils.ToInt(IdTextBox.Text);
            var servicios = repositorio.Buscar(id);

            if (servicios != null)
            {
                if (repositorio.Eliminar(id))
                {
                    Utils.ShowToastr(this.Page, "Exito Eliminado", "success");
                    Limpiar();
                }
                else
                {
                    Utils.ShowToastr(this.Page, "No Eliminado", "error");
                }
            }
        }
Exemplo n.º 2
0
        protected void GuardarButton_Click(object sender, EventArgs e)
        {
            RepositorioServicios repositorio = new RepositorioServicios();
            Servicios            servicios   = repositorio.Buscar(Utils.ToInt(IdTextBox.Text));

            if (Validar())
            {
                return;
            }
            if (servicios == null)
            {
                if (repositorio.Guardar(LlenarClase()))
                {
                    Utils.ShowToastr(this, "Guardado", "Exito", "success");
                    Limpiar();
                }
                else
                {
                    Utils.ShowToastr(this, "No existe", "Error", "error");
                    Limpiar();
                }
            }
            else
            {
                if (repositorio.Modificar(LlenarClase()))
                {
                    Utils.ShowToastr(this.Page, "Modificado con exito!!", "Guardado", "success");
                    Limpiar();
                }
                else
                {
                    Utils.ShowToastr(this.Page, "No se puede modificar", "Error", "error");
                    Limpiar();
                }
            }
        }