private void eliminarPersona()
        {
            personasDTO = new PersonasDTO();
            personasDTO.setCedula(int.Parse(txtcedula.Text));
            personasDAO = new PersonasDAO(personasDTO);

            personasDAO.eliminarPersona();

            MessageBox.Show("Registro eliminado");
            limpiarCampos();
        }
        private void guardarCambiosPersonas()
        {
            personasDTO = new PersonasDTO();
            personasDTO.setCedula(int.Parse(txtcedula.Text));
            personasDTO.setNombre(txtnombre.Text);
            personasDTO.setEdad(Byte.Parse(txtedad.Text));

            personasDAO = new PersonasDAO(personasDTO);

            personasDAO.guardarCambiosPersonas();

            MessageBox.Show("Registro actualizado");
        }
        public void guardarPersona()
        {
            personasDTO = new PersonasDTO();
            personasDTO.setCedula(int.Parse(txtcedula.Text));
            personasDTO.setNombre(txtnombre.Text);
            personasDTO.setEdad(Byte.Parse(txtedad.Text));

            personasDAO = new PersonasDAO(personasDTO);

            personasDAO.guardarPersona();

            MessageBox.Show("Se ha guardado el registro");
        }
예제 #4
0
        // GET: api/Personas
        public IHttpActionResult GetPersonas(string current, string rowCount, string searchPhrase, string id)
        {
            /*
             * Formato de la peticion que realiza por ajax el bootgrid
             * current=1 & rowCount=10 & sort[sender]=asc & searchPhrase= & id=b0df282a-0d67-40e5-8558-c9e93b7befed
             *
             */

            int    iCurrent        = 1;
            int    iRowCount       = 10;
            int    iTotalRegistros = 0;
            string campoOrdenar    = string.Empty;
            string orden           = string.Empty;

            // obtiene de los parametros del query string el campo y el sentido de ordenacion
            var vars = Request.GetQueryNameValuePairs();

            KeyValuePair <string, string> sortValues = vars.FirstOrDefault(x => x.Key.Contains("sort"));

            if (!string.IsNullOrEmpty(sortValues.Value))
            {
                campoOrdenar = sortValues.Key.TrimStart("sort.".ToArray());
                orden        = sortValues.Value;
            }

            // se transforman los valores de paginación
            Int32.TryParse(current, out iCurrent);
            Int32.TryParse(rowCount, out iRowCount);

            // obtiene la lista de familias filtrada
            PersonasDAO       item  = new PersonasDAO();
            List <PersonaDTO> lista = new List <PersonaDTO>();

            lista = item.GetListaFiltrada(iCurrent, iRowCount, searchPhrase, campoOrdenar, orden, out iTotalRegistros);

            // se completa el objeto de respuesta
            DataBootGrid bootGrid = new DataBootGrid()
            {
                current   = iCurrent,
                rowsCount = iRowCount,
                rows      = lista.ToArray(),
                total     = iTotalRegistros
            };

            return(Ok(bootGrid));
        }
        public void listarPersonas()
        {
            personasDTO = new PersonasDTO();
            personasDAO = new PersonasDAO(personasDTO);

            dataTable = new DataTable();
            dataTable = personasDAO.ListarPersonas();

            if (dataTable.Rows.Count > 0)
            {
                dtpersonas.DataSource = dataTable;
            }
            else
            {
                MessageBox.Show("No hay registros de Personas.");
            }
        }