コード例 #1
0
        public DataTable lista_Documentos()
        {
            DataTable dtDocumentos = new DataTable();
            MySqlConnection oSC = new MySqlConnection();

            try
            {
                cls_Conexion oConexion = new cls_Conexion();
                oSC = oConexion.conexion();
                oSC.Open();

                MySqlDataAdapter daDoc = new MySqlDataAdapter("SELECT * FROM tbl_TipoDocumento", oSC);
                daDoc.Fill(dtDocumentos);
                return dtDocumentos;
            }
            catch(Exception e)
            {
                string strError = e.Message;
                throw new Exception(strError);
                throw new Exception("Error al Recuperar Datos Verifique");
            }
            finally
            {
                oSC.Close();
                oSC.Dispose();
            }
            return null;
        }
コード例 #2
0
        public List<Capa_Objetos.cls_Ciudad> listar_Ciudad()
        {
            MySqlConnection oSC = new MySqlConnection();
            var ListaCiudad = new List<Capa_Objetos.cls_Ciudad>();
            try
            {
                cls_Conexion oConexion = new cls_Conexion();
                oSC = oConexion.conexion();
                oSC.Open();

                MySqlCommand oSCmd = new MySqlCommand();
                oSCmd.Connection = oSC;
                oSCmd.CommandType = CommandType.Text;
                oSCmd.CommandText = "SELECT * FROM tbl_Ciudad";

                var dr = oSCmd.ExecuteReader();
                while (dr.Read())
                {
                    ListaCiudad.Add(new Capa_Objetos.cls_Ciudad(dr.GetInt32(0), dr.GetString(1)));
                }
            }
            catch (Exception e)
            {
                string strError = e.Message;
                throw new Exception(strError);
                throw new Exception("Error al Recuperar Datos Verifique");
            }
            finally
            {
                oSC.Close();
                oSC.Dispose();
            }

            return ListaCiudad;
        }
コード例 #3
0
        public DataTable Consultar(string strNumDoc)
        {
            DataTable dtDatosCliente = new DataTable();

            MySqlConnection oSC = new MySqlConnection();

            try
            {

                cls_Conexion oConexion = new cls_Conexion();
                oSC = oConexion.conexion();
                oSC.Open();

                MySqlDataAdapter daCliente = new MySqlDataAdapter("SP_Consultar_Persona", oSC);
                daCliente.SelectCommand.CommandType = CommandType.StoredProcedure;
                daCliente.SelectCommand.Parameters.AddWithValue("inNro_Doc", strNumDoc);
                daCliente.Fill(dtDatosCliente);
                return dtDatosCliente;

            }
            catch (Exception e)
            {
                string strError = e.Message;
                throw new Exception(strError);
                throw;
            }
            finally
            {
                oSC.Close();
                oSC.Dispose();
            }
        }
コード例 #4
0
ファイル: frmRole.cs プロジェクト: silviaaraya0193/prueba
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         cls_Conexion conexion = new cls_Conexion();
         conexion.mGuardarRole(this.txtNombre.Text.Trim(), Convert.ToInt32(this.txtCodigo.Text.Trim()));
         MessageBox.Show("Perfil insertado correctamente" + this.txtNombre.Text, "Registro realizado", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Verifique los datos del role", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #5
0
        public int[] consultarHobbies(string strNumDoc)
        {
            int[] Hobbies = new int[4];

            MySqlConnection oSC = new MySqlConnection();

            try
            {

                cls_Conexion oConexion = new cls_Conexion();
                oSC = oConexion.conexion();
                oSC.Open();

                MySqlCommand cmdHobbies = new MySqlCommand("SP_Consultar_Hobbies_P", oSC);
                cmdHobbies.CommandType = CommandType.StoredProcedure;
                cmdHobbies.Parameters.AddWithValue("inNro_doc", strNumDoc);

                var dr = cmdHobbies.ExecuteReader();

                int cont = 0;

                while (dr.Read()) {
                    Hobbies[cont] = dr.GetInt32(0);
                    cont++;
                }

                return Hobbies;

            }
            catch (Exception e)
            {
                string strError = e.Message;
                throw new Exception(strError);
                throw;
            }
            finally
            {
                oSC.Close();
                oSC.Dispose();
            }
        }
コード例 #6
0
        public List<Capa_Objetos.cls_TipoDocumento> listar_Documentos()
        {
            MySqlConnection oSC = new MySqlConnection();
            var ListaDocumentos = new List<Capa_Objetos.cls_TipoDocumento>();
            try
            {
                cls_Conexion oConexion = new cls_Conexion();
                oSC = oConexion.conexion();
                oSC.Open();

                MySqlCommand oSCmd = new MySqlCommand();
                oSCmd.Connection = oSC;
                oSCmd.CommandType = CommandType.Text;
                oSCmd.CommandText = "SELECT * FROM tbl_TipoDocumento";

                var dr = oSCmd.ExecuteReader();
                while (dr.Read())
                {
                    ListaDocumentos.Add(new Capa_Objetos.cls_TipoDocumento(dr.GetByte(0), dr.GetString(1)));
                }

            }
            catch (Exception e)
            {
                string strError = e.Message;
                throw new Exception(strError);
                throw new Exception("Error al Recuperar Datos Verifique");
            }
            finally
            {
                oSC.Close();
                oSC.Dispose();
            }
            return ListaDocumentos;

            //ListaDocumentos.Add(new Capa_Objetos.cls_TipoDocumento(1, "Cedula"));
            //ListaDocumentos.Add(new Capa_Objetos.cls_TipoDocumento(2, "Cedula Extranjeria"));
            //ListaDocumentos.Add(new Capa_Objetos.cls_TipoDocumento(3, "Tarjeta de Identidad"));
        }
コード例 #7
0
        public bool registrar_Hobbie(params int[] hobbies)
        {
            bool blRegistro = false;
            MySqlConnection oSC = new MySqlConnection();

            try
            {
                cls_Conexion oConexion = new cls_Conexion();
                oSC = oConexion.conexion();
                oSC.Open();

                strProcedimiento = "SP_Registrar_Hobbie";
                MySqlCommand scmcli = new MySqlCommand(strProcedimiento, oSC);
                scmcli.CommandType = CommandType.StoredProcedure;
                //SqlCommand scmcli = new SqlCommand();
                //scmcli.Connection = oSC;
                //scmcli.CommandType = System.Data.CommandType.Text;
                //scmcli.CommandText = "INSERT INTO tbl_Personas VALUES(@Nro_doc, @nombres, @apellidos, @edad, @id_Td, @fecha_Nacimiento, @Id_c, @tipo_Persona, @id_Ciudad);";
                scmcli.Parameters.AddWithValue("inNro_doc", hobbies[0]);
                scmcli.Parameters.AddWithValue("inNombres", hobbies[1]);

                int intCliente = scmcli.ExecuteNonQuery();
                if (intCliente > 0)
                { blRegistro = true; }
            }
            catch (Exception e)
            {
                string strError = e.Message;
                throw new Exception(strError);
                throw;
            }
            finally
            {
                oSC.Close();
                oSC.Dispose();
            }
            return blRegistro;
        }
コード例 #8
0
 public cls_LogicaPermiso()
 {
     clConexion      = new cls_Conexion();
     arregloPermisos = new ArrayList();
 }//fin del constructor
コード例 #9
0
        public override bool editar_Persona(Capa_Objetos.cls_Persona odjPersona, int IcCliente)
        {
            bool blRegistro = false;
            MySqlConnection oSC = new MySqlConnection();

            try
            {
                cls_Conexion oConexion = new cls_Conexion();
                oSC = oConexion.conexion();
                oSC.Open();

                strProcedimiento = "SP_Editar_Persona";
                MySqlCommand scmcli = new MySqlCommand(strProcedimiento, oSC);
                scmcli.CommandType = CommandType.StoredProcedure;
                //SqlCommand scmcli = new SqlCommand();
                //scmcli.Connection = oSC;
                //scmcli.CommandType = System.Data.CommandType.Text;
                //scmcli.CommandText = "INSERT INTO tbl_Personas VALUES(@Nro_doc, @nombres, @apellidos, @edad, @id_Td, @fecha_Nacimiento, @Id_c, @tipo_Persona, @id_Ciudad);";
                scmcli.Parameters.AddWithValue("inNro_doc", odjPersona.Nro_doc);
                scmcli.Parameters.AddWithValue("inNombres", odjPersona.Nombres);
                scmcli.Parameters.AddWithValue("inApellidos", odjPersona.Apellidos);
                scmcli.Parameters.AddWithValue("inEdad", odjPersona.Edad);
                scmcli.Parameters.AddWithValue("inId_Td", odjPersona.TipoDocumento.Id_td);
                scmcli.Parameters.AddWithValue("inFecha_Nacimiento", odjPersona.Fecha_Nacimiento);
                scmcli.Parameters.AddWithValue("inId_c", 0);
                scmcli.Parameters.AddWithValue("inTipo_Persona", true);
                scmcli.Parameters.AddWithValue("inId_Ciudad", odjPersona.Ciudad.Id_Ciudad);

                int intEmpleado = scmcli.ExecuteNonQuery();

                int[] intHobbie = new int[4];

                oSC.Close();

                if (intEmpleado > 0)
                {

                    for (int i = 1; i < odjPersona.Hobbies.Length; i++)
                    {
                        oSC.Open();
                        strProcedimiento = "SP_Editar_Hobbies";
                        MySqlCommand cmdHobbies = new MySqlCommand(strProcedimiento, oSC);
                        cmdHobbies.CommandType = CommandType.StoredProcedure;
                        cmdHobbies.Parameters.AddWithValue("inNro_doc", odjPersona.Nro_doc);

                        if (odjPersona.Hobbies[i] != 0)
                        {
                            cmdHobbies.Parameters.AddWithValue("inHobbie", odjPersona.Hobbies[i]);
                            cmdHobbies.Parameters.AddWithValue("inEstado", true);
                        }
                        else
                        {
                            cmdHobbies.Parameters.AddWithValue("inHobbie", i);
                            cmdHobbies.Parameters.AddWithValue("inEstado", false);
                        }

                        intHobbie[i - 1] = cmdHobbies.ExecuteNonQuery();
                        oSC.Close();
                    }

                }

                if (((intHobbie[0] == 1) && (intHobbie[1] == 1) && (intHobbie[2] == 1) && (intHobbie[3] == 1)) || intEmpleado > 0)
                {
                    blRegistro = true;
                }
            }
            catch (Exception e)
            {
                string strError = e.Message;
                throw new Exception(strError);
                throw;
            }
            finally
            {
                oSC.Close();
                oSC.Dispose();
            }
            return blRegistro;
        }
コード例 #10
0
 public cls_LogicaUsuario()
 {
     clConexion = new cls_Conexion();
 }