示例#1
0
        public static int addTitel(Tipos pTitel)
        {
            int             retorno  = 0;
            MySqlConnection conexion = Conectando.conectando();

            using (MySqlCommand cmd = new MySqlCommand())
            {
                try
                {
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Connection  = conexion;
                    cmd.CommandText = "inTiTel";

                    cmd.Parameters.AddWithValue("pTiTel", pTitel.nom);

                    retorno = cmd.ExecuteNonQuery();
                }
                catch (Exception Ex)
                {
                    MessageBox.Show(Ex.ToString(), "ERROR AL INSERTAR EL REGISTRO TIPOTEL");
                }
                finally
                {
                    conexion.Close();
                }
            }
            return(retorno);
        }
示例#2
0
        public static Tipos obtenerReg(int pId)
        {
            Tipos           pObjet   = new Tipos();
            MySqlConnection conexion = Conectando.conectando();

            try
            {
                MySqlCommand _comando = new MySqlCommand(string.Format(
                                                             "SELECT id, parentezco FROM parentezco where id={0}", pId), conexion);
                MySqlDataReader _reader = _comando.ExecuteReader();
                while (_reader.Read())
                {
                    pObjet.id  = _reader.GetInt32(0);
                    pObjet.nom = _reader.GetString(1);
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.ToString(), "ERROR AL BUSCAR EL REGISTRO PARIENTES");
            }
            finally
            {
                conexion.Close();
            }
            return(pObjet);
        }
示例#3
0
        public static Tipos ObtenerTel(int pId)
        {
            Tipos           pTel     = new Tipos();
            MySqlConnection conexion = Conectando.conectando();

            try
            {
                MySqlCommand _comando = new MySqlCommand(string.Format(
                                                             "SELECT id, nomTiTel FROM tipotel where id={0}", pId), conexion);
                MySqlDataReader _reader = _comando.ExecuteReader();
                while (_reader.Read())
                {
                    pTel.id  = _reader.GetInt32(0);
                    pTel.nom = _reader.GetString(1);
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.ToString(), "ERROR AL INSERTAR EL REGISTRO TIPOTEL");
            }
            finally
            {
                conexion.Close();
            }
            return(pTel);
        }
示例#4
0
        public static int insertar(Tipos pObjet)
        {
            int             retorno  = 0;
            MySqlConnection conexion = Conectando.conectando();

            using (MySqlCommand cmd = new MySqlCommand())
            {
                try
                {
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Connection  = conexion;
                    cmd.CommandText = "inparent";

                    cmd.Parameters.AddWithValue("pNom", pObjet.nom);

                    retorno = cmd.ExecuteNonQuery();
                }
                catch (Exception Ex)
                {
                    MessageBox.Show(Ex.ToString(), "ERROR AL INSERTAR EL REGISTRO PARIENTES");
                }
                finally
                {
                    conexion.Close();
                }
            }
            return(retorno);
        }
示例#5
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            Tipos pObjet = new Tipos();

            pObjet.id  = int.Parse(txtId.Text.Trim());
            pObjet.nom = txtNombre.Text.Trim();
            int updResul = parentDal.update(pObjet);

            if (updResul > 0)
            {
                MessageBox.Show("Zona Modificada con exito!!", "Modificando", MessageBoxButtons.OK, MessageBoxIcon.Information);
                rNew();
            }
            else
            {
                int resultado = parentDal.insertar(pObjet);
                if (resultado > 0)
                {
                    MessageBox.Show("Registro Guardado con exito!!", "Guardado", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    rNew();
                }
                else
                {
                    MessageBox.Show("No se pudo guardar el Zona", "Fallo!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
示例#6
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("¿Esta seguro que desea ELIMINAR el registro?", "¿Eliminar?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                lblEstado.Text      = "<<<ELIMINANDO>>>";
                lblEstado.ForeColor = Color.FromArgb(255, 255, 255);

                Tipos pObjet = new Tipos();
                pObjet.id  = int.Parse(txtId.Text.Trim());
                pObjet.nom = txtNombre.Text.Trim();
                int delResul = parentDal.delete(pObjet);
                if (delResul > 0)
                {
                    MessageBox.Show("¡Registro ELIMINADO con exito!", "¡Eliminando!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    rNew();
                }
                else
                {
                    MessageBox.Show("¡Registro no fue encontrado!", "¡Error!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                rNew();
            }
        }
示例#7
0
        public static int update(Tipos pObjet)
        {
            int             retorno  = 0;
            MySqlConnection conexion = Conectando.conectando();

            using (MySqlCommand cmd = new MySqlCommand())
            {
                try
                {
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Connection  = conexion;
                    cmd.CommandText = "updzona";

                    cmd.Parameters.AddWithValue("pId", pObjet.id);
                    cmd.Parameters.AddWithValue("pNomZona", pObjet.nom);

                    retorno = cmd.ExecuteNonQuery();
                }
                catch (Exception Ex)
                {
                    MessageBox.Show(Ex.ToString(), "ERROR AL ACTUALIZAR EL REGISTRO ZONA");
                }
                finally
                {
                    conexion.Close();
                }
            }

            return(retorno);
        }
示例#8
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            Tipos pTitel = new Tipos();

            pTitel.id  = int.Parse(txtId.Text.Trim());
            pTitel.nom = txtNombre.Text.Trim();
            int updResul = tiTelDala.updTitel(pTitel);

            if (updResul > 0)
            {
                MessageBox.Show("Ciudad Modificado con exito!!", "Modificando", MessageBoxButtons.OK, MessageBoxIcon.Information);
                rNew();
            }
            else
            {
                int resultado = tiTelDala.addTitel(pTitel);
                if (resultado > 0)
                {
                    MessageBox.Show("Registro Guardado con exito!!", "Guardado", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    rNew();
                }
                else
                {
                    MessageBox.Show("No se pudo guardar el TipoTel", "Fallo!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
示例#9
0
        private void dgvContenido_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            Tipos obj = new Tipos();

            obj                 = parentDal.obtenerReg((int)dgvContenido.CurrentRow.Cells["ID"].Value);
            lblEstado.Text      = "<<<Consultando>>>";
            lblEstado.ForeColor = Color.FromArgb(65, 105, 225);
            txtId.Text          = obj.id.ToString();
            txtNombre.Text      = obj.nom.ToString();
            ctrlInicio(true);
            txtNombre.Enabled = false;
        }
示例#10
0
        private void btnAddPariente_Click(object sender, EventArgs e)
        {
            Tipos pObjet = new Tipos();

            if (txtNomPariente.Text != "" && txtApePariente.Text != "" && txtTelPariente.Text != "")
            {
                pObjet = parentDal.obtenerReg(int.Parse(cbParentezco.SelectedValue.ToString()));
                dtvParent.Rows.Add(txtNomPariente.Text, txtApePariente.Text, txtTelPariente.Text, pObjet.nom);
                txtNomPariente.Clear();
                txtApePariente.Clear(); txtTelPariente.Clear();
                cbParentezco.SelectedIndex = 0;
            }
            txtNomPariente.Focus();
        }
示例#11
0
        public static List <Tipos> buscar()
        {
            List <Tipos> _lista   = new List <Tipos>();
            MySqlCommand _comando = new MySqlCommand(string.Format(
                                                         "SELECT id, nomTiTel FROM tipotel"), Conectando.conectando());

            MySqlDataReader _reader = _comando.ExecuteReader();

            while (_reader.Read())
            {
                Tipos tipotel = new Tipos();
                tipotel.id  = _reader.GetInt32(0);
                tipotel.nom = _reader.GetString(1);

                _lista.Add(tipotel);
            }

            return(_lista);
        }