Ejemplo n.º 1
0
        public static CapturaRES ObtenerCliente(int pId)
        {
            CapturaRES      pCaptura = new CapturaRES();
            MySqlConnection conexion = coneccion.Obtenerconeccion();

            MySqlCommand    comando = new MySqlCommand(String.Format("SELECT Id ,`Ape_Mat`,`Ape_Pat`, `Nombre`, `Edad`,`Fecha_Naci`,`Sexo`,`Edo_Civil`,`Telefono`,`Colonia`,`Calle`,`CP`,`Entre_que_calles`,`Direccion _IFE`,`Curpri`,`Curp` FROM `datos personales` where Id={0}", pId), conexion);
            MySqlDataReader _reader = comando.ExecuteReader();

            while (_reader.Read())
            {
                pCaptura.Id               = _reader.GetInt32(0);
                pCaptura.Ape_mat          = _reader.GetString(1);
                pCaptura.Ape_pat          = _reader.GetString(2);
                pCaptura.Nombres          = _reader.GetString(3);
                pCaptura.Sexo             = _reader.GetString(6);
                pCaptura.Edo_civil        = _reader.GetString(7);
                pCaptura.Telefono         = _reader.GetString(8);
                pCaptura.Colonia          = _reader.GetString(9);
                pCaptura.calle            = _reader.GetString(10);
                pCaptura.CP               = _reader.GetString(11);
                pCaptura.Entre_que_calles = _reader.GetString(12);
                // pCaptura.Direccion_Ife = _reader.GetString(13);
                pCaptura.Curpri            = _reader.GetString(14);
                pCaptura.Curp              = _reader.GetString(15);
                pCaptura.Seccion_electoral = _reader.GetString(13);
            }

            conexion.Close();
            return(pCaptura);
        }
Ejemplo n.º 2
0
        public static List <CapturaRES> BuscarR(string pNombres)
        {
            List <CapturaRES> _lista = new List <CapturaRES>();

            MySqlCommand _comando = new MySqlCommand(String.Format(
                                                         "SELECT * FROM `datos personales`  where Nombre like '%{0}%'", pNombres), coneccion.Obtenerconeccion());

            MySqlDataReader _reader = _comando.ExecuteReader();

            while (_reader.Read())
            {
                CapturaRES pCaptura = new CapturaRES();


                /* pCaptura.Id = _reader.GetInt32(0);
                 * pCaptura.Ape_mat = _reader.GetString(1);
                 * pCaptura.Ape_pat = _reader.GetString(2);
                 * pCaptura.Nombres =_reader.GetString(3);
                 * //pCaptura.Edad =_reader.GetInt32(4);
                 * //pCaptura.Fecha_naci =_reader.GetString(5);
                 *  pCaptura.Sexo =_reader.GetString(6);
                 *  pCaptura.Edo_civil = _reader.GetString(7);
                 *  pCaptura.Telefono = _reader.GetString(8);
                 *
                 *  pCaptura.Colonia = _reader.GetString(10);
                 *  pCaptura.calle = _reader.GetString(11);
                 *  pCaptura.CP =_reader.GetString(12);
                 *  pCaptura.Entre_que_calles =_reader.GetString(13);
                 *  pCaptura.Seccion_electoral = _reader.GetString(14);
                 *  pCaptura.Direccion_Ife = _reader.GetString(15);
                 *  pCaptura.Curpri = _reader.GetString(16);
                 * // pCaptura.Curp = _reader.GetString(17);*/
                pCaptura.Id               = _reader.GetInt32(0);
                pCaptura.Ape_mat          = _reader.GetString(1);
                pCaptura.Ape_pat          = _reader.GetString(2);
                pCaptura.Nombres          = _reader.GetString(3);
                pCaptura.Sexo             = _reader.GetString(6);
                pCaptura.Edo_civil        = _reader.GetString(7);
                pCaptura.Telefono         = _reader.GetString(8);
                pCaptura.Colonia          = _reader.GetString(9);
                pCaptura.calle            = _reader.GetString(10);
                pCaptura.CP               = _reader.GetString(11);
                pCaptura.Entre_que_calles = _reader.GetString(12);
                // pCaptura.Direccion_Ife = _reader.GetString(13);
                pCaptura.Curpri            = _reader.GetString(16);
                pCaptura.Curp              = _reader.GetString(15);
                pCaptura.Seccion_electoral = _reader.GetString(14);



                _lista.Add(pCaptura);
            }

            return(_lista);
        }
Ejemplo n.º 3
0
        public static int Agregar(CapturaRES pCaptura)
        {
            string       cnsulta = "Insert into `datos personales` values ('" + pCaptura.Ape_pat + "','" + pCaptura.Ape_mat + "','" + pCaptura.Nombres + "','" + pCaptura.Edad + "','" + pCaptura.Fecha_naci + "','" + pCaptura.Sexo + "','" + pCaptura.Edo_civil + "','" + pCaptura.Telefono + "','" + pCaptura.Colonia + "','" + pCaptura.calle + "','" + pCaptura.CP + "','" + pCaptura.Entre_que_calles + "','" + pCaptura.Seccion_electoral + "','" + pCaptura.Direccion_Ife + "','" + pCaptura.Curpri + "','" + pCaptura.Curp + "')";
            MySqlCommand comando = new MySqlCommand(cnsulta, coneccion.Obtenerconeccion());

            int retorno = 0;



            retorno = comando.ExecuteNonQuery();

            return(retorno);
        }
Ejemplo n.º 4
0
        public static int Actualizar(CapturaRES pCaptura)
        {
            int             retorno  = 0;
            MySqlConnection conexion = coneccion.Obtenerconeccion();

            MySqlCommand comando = new MySqlCommand(string.Format("Update `datos personales` set Ape_Mat ='{1}', Ape_Pat='{2}', Nombre='{3}', Edad='{4}',Fecha_Naci='{5}', Sexo='{6}' where Id={0}",
                                                                  pCaptura.Id, pCaptura.Ape_mat, pCaptura.Ape_pat, pCaptura.Nombres, pCaptura.Edad, pCaptura.Fecha_naci, pCaptura.Sexo), conexion);

            retorno = comando.ExecuteNonQuery();
            conexion.Close();

            return(retorno);
        }
Ejemplo n.º 5
0
        void Button2Click(object sender, EventArgs e)
        {
            if (dtg12.SelectedRows.Count == 1)
            {
                int Id = Convert.ToInt32(dtg12.CurrentRow.Cells[0].Value);
                ClienteSelecionad = CapturaDAL.ObtenerCliente(Id);

                this.Hide();
            }
            else
            {
                MessageBox.Show(" Seleccione un Registro");
            }
        }
Ejemplo n.º 6
0
        void BTN_Agregar_Click(object sender, EventArgs e)
        {
            CapturaRES pCaptura = new CapturaRES();

            pCaptura.Ape_mat = TXT_Ap_Mat.Text.ToUpper();
            pCaptura.Ape_pat = TXT_Ap_Pat.Text.ToUpper();
            pCaptura.Nombres = TXT_Nombres.Text.ToUpper();
            pCaptura.Edad    = (DateTime.Today.AddTicks(-DTI_FecNac.Value.Ticks).Year);

            pCaptura.Fecha_naci = DTI_FecNac.Text;

            if (RBT_F.Checked)
            {
                pCaptura.Sexo = RBT_F.Text.ToUpper();
            }

            else if (RBT_M.Checked)
            {
                pCaptura.Sexo = RBT_M.Text.ToUpper();
            }

            pCaptura.Edo_civil = CMB_EdoCiv.Text.ToUpper();
            pCaptura.Telefono  = TXT_TelCas.Text.ToUpper();

            pCaptura.Colonia          = TXT_Col.Text.ToUpper();
            pCaptura.calle            = TXT_Calle.Text.ToUpper();
            pCaptura.CP               = TXT_CP.Text.ToUpper();
            pCaptura.Entre_que_calles = TXT_Entre.Text.ToUpper();

            pCaptura.Seccion_electoral = TXT_SecElect.Text.ToUpper();
            pCaptura.Direccion_Ife     = TXT_IFE.Text.Trim();
            pCaptura.Curpri            = TXT_Curppri.Text.ToUpper();
            pCaptura.Curp = TXT_Curp.Text.ToUpper();

            Limpiar();

            int resultado = CapturaDAL.Agregar(pCaptura);

            if (resultado > 0)
            {
                MessageBox.Show("Guardado", "Registro Guardado", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("No se Guardo", "Fallo!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Ejemplo n.º 7
0
        void TXT_Buscar_Click(object sender, EventArgs e)
        {
            BUSCACAPTURA busca = new BUSCACAPTURA();

            busca.ShowDialog();

            if (busca.ClienteSelecionad != null)
            {
                clienteActual = busca.ClienteSelecionad;

                TXT_Ap_Mat.Text  = busca.ClienteSelecionad.Ape_mat;
                TXT_Ap_Pat.Text  = busca.ClienteSelecionad.Ape_pat;
                TXT_Nombres.Text = busca.ClienteSelecionad.Nombres;
                TXT_Curp.Text    = busca.ClienteSelecionad.Curp;
                TXT_Calle.Text   = busca.ClienteSelecionad.calle;
                TXT_CP.Text      = busca.ClienteSelecionad.CP;
                TXT_Col.Text     = busca.ClienteSelecionad.Colonia;
                TXT_TelCas.Text  = busca.ClienteSelecionad.Telefono;
                TXT_Entre.Text   = busca.ClienteSelecionad.Entre_que_calles;
                TXT_IFE.Text     = busca.ClienteSelecionad.Direccion_Ife;
                TXT_Curppri.Text = busca.ClienteSelecionad.Curpri;
            }
        }
Ejemplo n.º 8
0
        void TXT_editar_Click(object sender, EventArgs e)
        {
            {
                if (string.IsNullOrWhiteSpace(TXT_Ap_Mat.Text) || string.IsNullOrWhiteSpace(TXT_Ap_Pat.Text) ||
                    string.IsNullOrWhiteSpace(TXT_Nombres.Text) || string.IsNullOrWhiteSpace(TXT_Calle.Text) ||
                    string.IsNullOrWhiteSpace(TXT_Col.Text))
                {
                    MessageBox.Show("Hay Uno o mas Campos Vacios!", "Campos Vacios!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }



                else

                {
                    CapturaRES pCaptura1 = new CapturaRES();
                    pCaptura1.Ape_mat = TXT_Ap_Mat.Text.ToUpper();
                    pCaptura1.Ape_pat = TXT_Ap_Pat.Text.ToUpper();
                    pCaptura1.Nombres = TXT_Nombres.Text.ToUpper();
                    // pCaptura1.Edad = (DateTime.Today.AddTicks(-DTI_FecNac.Value.Ticks).Year);

                    pCaptura1.Fecha_naci = DTI_FecNac.Text.ToUpper();

                    if (RBT_F.Checked)
                    {
                        pCaptura1.Sexo = RBT_F.Text.ToUpper();
                    }

                    else if (RBT_M.Checked)
                    {
                        pCaptura1.Sexo = RBT_M.Text.ToUpper();
                    }

                    pCaptura1.Edo_civil = CMB_EdoCiv.Text.ToUpper();
                    pCaptura1.Telefono  = TXT_TelCas.Text.ToUpper();
                    //pCaptura1.Direccion  =  TXT_Dir.Text.Trim();
                    pCaptura1.Colonia          = TXT_Col.Text.ToUpper();
                    pCaptura1.calle            = TXT_Calle.Text.ToUpper();
                    pCaptura1.CP               = TXT_CP.Text.ToUpper();
                    pCaptura1.Entre_que_calles = TXT_Entre.Text.ToUpper();
                    // pCaptura1.Datos_electorales = TXT_TelCel.Text.ToUpper();
                    pCaptura1.Seccion_electoral = TXT_SecElect.Text.ToUpper();
                    //pCaptura1.Direccion_Ife = TXT_Dir.Text.Trim();
                    pCaptura1.Curpri = TXT_Curppri.Text.ToUpper();
                    pCaptura1.Curp   = TXT_Curp.Text.ToUpper();



                    pCaptura1.Id = clienteActual.Id;

                    if (CapturaDAL.Actualizar(pCaptura1) > 0)
                    {
                        MessageBox.Show("El Registro se actualizo", "Datos Actualizados", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Limpiar();
                    }
                    else
                    {
                        MessageBox.Show("No se pudo actualizar", "Error al Actualizar", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
        }