private void getbyName()
 {
     try
     {
         OdbcConnection conexion = ASG_DB.connectionResult();
         string         sql      = string.Format("SELECT NOMBRE_SUCURSAL FROM SUCURSAL WHERE ID_SUCURSAL  = {0} AND ESTADO_TUPLA = TRUE;", idSucursal);
         OdbcCommand    cmd      = new OdbcCommand(sql, conexion);
         OdbcDataReader reader   = cmd.ExecuteReader();
         if (reader.Read())
         {
             nombreSucursal = reader.GetString(0);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
        protected string GetBranchName(int branch_id)
        {
            if (branch_id <= 0)
            {
                return("");
            }
            string    sql = "SELECT branch_name FROM branch WHERE branch_id='" + branch_id + "'";
            string    ret = String.Empty;
            DBManager db  = new MySQLDBManager(Config.DB_SERVER, Config.DB_NAME, Config.DB_USER, Config.DB_PASSWORD, Config.DB_CHAR_ENC);

            db.Connect();
            OdbcDataReader reader = db.Query(sql);

            reader.Read();
            ret = reader.GetString(0);
            db.Close();
            return(ret);
        }
Beispiel #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        OdbcConnection con = conectarBD();

        if (con != null)
        {
            OdbcCommand    cmd = new OdbcCommand("SELECT usuario.claveU FROM usuario", con);
            OdbcDataReader dr  = cmd.ExecuteReader();
            DropDownList1.Items.Clear();

            while (dr.Read())
            {
                DropDownList1.Items.Add(dr.GetString(0));
            }

            dr.Close();
        }
    }
        public static Order FindOrderByOrderID(int orderID)
        {
            Order  order            = null;
            string connectionString = DataUtilities.ConnectionString;

            if (orderID > 0)
            {
                if ((connectionString != null) && (connectionString.Length > 0))
                {
                    try
                    {
                        OdbcConnection dataConnection = new OdbcConnection();
                        dataConnection.ConnectionString = connectionString;
                        dataConnection.Open();

                        OdbcCommand dataCommand = new OdbcCommand();
                        dataCommand.Connection = dataConnection;

                        // Build Command String
                        StringBuilder commandText =
                            new StringBuilder("SELECT * FROM Orders WHERE OrdersID = ");
                        commandText.Append(orderID);

                        dataCommand.CommandText = commandText.ToString();

                        OdbcDataReader dataReader = dataCommand.ExecuteReader();

                        while (dataReader.Read())
                        {
                            order                = new Order();
                            order.OrderID        = dataReader.GetInt32(0);
                            order.CustomerID     = dataReader.GetString(1);
                            order.OrderDate      = dataReader.GetDateTime(3);
                            order.ShipDate       = dataReader.GetDateTime(5);
                            order.ShipName       = dataReader.GetString(8);
                            order.ShipAddress    = dataReader.GetString(9);
                            order.ShipCity       = dataReader.GetString(10);
                            order.ShipPostalCode = dataReader.GetString(12);
                            order.ShipCountry    = dataReader.GetString(13);
                        }

                        dataConnection.Close();
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("error: " + e.Message);
                    }
                }
            }

            return(order);
        }
Beispiel #5
0
 string getstring(string c)
 {
     try
     {
         if (Program.dsource == Program.dsources.Access)
         {
             return(dr1.GetString(dr1.GetOrdinal(c)));
         }
         else
         {
             return(dr2.GetString(dr2.GetOrdinal(c)));
         }
     }
     catch (InvalidCastException ie)
     {
         return("");
     }
 }
Beispiel #6
0
        public static string getValue(string targerKeyname, string targerValue, string valueKeyname)
        {
            OdbcConnection con  = getCon();
            string         sql  = "select " + valueKeyname + " from DATALINK where " + targerKeyname + "=" + targerValue;
            OdbcCommand    mycm = new OdbcCommand("select * from DATALINK", con);
            OdbcDataReader msdr = (OdbcDataReader)mycm.ExecuteReader();

            while (msdr.Read())
            {
                if (msdr.HasRows)
                {
                    Console.WriteLine(msdr.GetString(0));
                }
            }
            msdr.Close();
            con.Close();
            return(null);
        }
        //funcion para obtener el nombre de usuario
        public string funcObtenerNombreUsuario(string UserName)
        {
            string NombreUsuario = "";

            try
            {
                OdbcCommand    command = new OdbcCommand("select LO.nombreCompleto_login from LOGIN LO where LO.usuario_login ='******';", cn.conexion());
                OdbcDataReader reader  = command.ExecuteReader();
                reader.Read();
                NombreUsuario = reader.GetString(0);
                reader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine("CapaModelo Error al consular ObtenerNombreUsuario:  " + ex);
            }
            return(NombreUsuario);
        }
Beispiel #8
0
        public void llenar_biena()
        {
            //OBTENIENDO ID DE CATALOGO DE PRECIOS
            dgv_bien.Rows.Clear();


            //LLENANDO DATAGRID CON BIENES Y SU PRECIO
            string         scad = "SELECT producto.nombre, producto.precio_unidad, precio.precio FROM producto INNER JOIN precio ON producto.id_producto = precio.id_bien and producto.id_categoria = " + codcategoria + " and producto.id_marca = " + codmarca + " and precio.id_tipo = " + codtipo;
            OdbcCommand    mcd  = new OdbcCommand(scad, Conexion.ObtenerConexion());
            OdbcDataReader mdr  = mcd.ExecuteReader();

            //MessageBox.Show(Convert.ToString(codcategoria));

            while (mdr.Read())
            {
                dgv_bien.Rows.Add(mdr.GetString(0), mdr.GetDecimal(1), mdr.GetDecimal(2));
            }
        }
Beispiel #9
0
 public string getString(string cn)
 {
     try
     {
         if (Program.dataSource == Program.DataSources.Access)
         {
             return(dbr.GetString(dbr.GetOrdinal(cn)));
         }
         else
         {
             return(Odbr.GetString(Odbr.GetOrdinal(cn)));
         }
     }
     catch (InvalidCastException ice)
     {
         return("");
     }
 }
Beispiel #10
0
    public static Team getTeamByName(String name, OdbcConnection con, Boolean closeCon)
    {
        OdbcCommand    cmd    = new OdbcCommand(String.Format("SELECT * FROM equipo WHERE nombre = '{0}';", name), con);
        OdbcDataReader reader = cmd.ExecuteReader();
        Team           team   = null;

        while (reader.Read())
        {
            team = new Team(reader.GetInt32(0), reader.GetString(1));
        }

        if (closeCon)
        {
            con.Close();
        }

        return(team);
    }
        /*AQUI SE GENERAN LOS REPORTES SEMANALES*/

        public void CargarGrid1()//carga la informacion del dg1
        {
            OdbcConnection conexion = TaquillaDB.getDB();

            try
            {
                string         sql    = string.Format("SELECT SUM(MONTO_PAGO_FACTURA) FROM CINE,FACTURA,SALA,FUNCION,RESERVACION WHERE CINE.ID_CINE=SALA.ID_CINE AND FUNCION.ID_SALA=SALA.ID_SALA AND RESERVACION.ID_FUNCION=FUNCION.ID_FUNCION AND RESERVACION.ID_FACTURA=FACTURA.ID_FACTURA AND FACTURA.FECHA_FACTURA BETWEEN '{0}' AND '{1}' AND CINE.NOMBRE_CINE='{2}';", dateTimePicker1.Text, dateTimePicker2.Text, comboBox1.Text);
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    dataGridView1.Rows.Add(reader.GetString(0));
                }
            }
            catch (Exception e) {
                MessageBox.Show("Ocurrio un error por favor verifique");
            }
        }
Beispiel #12
0
 public static string RdrGetStr(OdbcDataReader rdr, int index)
 {
     try
     {
         if (rdr.IsDBNull(index))
         {
             return("");
         }
         else
         {
             return(rdr.GetString(index));
         }
     }
     catch
     {
         return("");
     }
 }
        public int getCafActual(int tipoDte)
        {
            string         idUltimoCaf = string.Empty;
            BaseDato       con         = new BaseDato();
            OdbcConnection conexion    = con.ConnectPostgres();

            OdbcCommand select = new OdbcCommand();

            select.Connection  = conexion;
            select.CommandText = "SELECT max(id) FROM caf where \"tipoDte\" =  '" + tipoDte + "';";
            OdbcDataReader reader = select.ExecuteReader();

            while (reader.Read())
            {
                idUltimoCaf = reader.GetString(reader.GetOrdinal("max"));
            }
            return(Convert.ToInt32(idUltimoCaf));
        }
Beispiel #14
0
        public static Paciente getPacienteByBE(int _be)
        {
            Paciente pc = new Paciente();

            using (OdbcConnection cnn = new OdbcConnection(ConfigurationManager.ConnectionStrings["HospubConn"].ToString()))
            {
                OdbcCommand cmm = cnn.CreateCommand();
                cmm.CommandText = "Select c54identific from cen54 where n54numbolet = " + _be.ToString();
                cnn.Open();
                OdbcDataReader dr = cmm.ExecuteReader();
                if (dr.Read())
                {
                    pc.Nome = dr.GetString(0);
                    pc.Id   = _be;
                }
            }
            return(pc);
        }
Beispiel #15
0
        //Funcion para obtener el codigo del usuario
        public string funcObtenerCodigoUsuario(string usuarioLogin)
        {
            string strCodigo = "";

            try
            {
                OdbcCommand    command = new OdbcCommand("select LO.pk_id_login from LOGIN LO where LO.usuario_login ='******';", cn.conexion());
                OdbcDataReader reader  = command.ExecuteReader();
                reader.Read();
                strCodigo = reader.GetString(0);
                reader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine("CapaModelo Error al consular obtenerCodigoUsuario:  " + ex);
            }
            return(strCodigo);
        }
Beispiel #16
0
        private void llenarPieChartMantenimientosPuntoVenta()
        {
            SeriesCollection          seriesNumActivos = new SeriesCollection();
            Func <ChartPoint, string> labelNumActivos  = pcMantenimientosPuntoVenta => string.Format("{0} ({1:P})", pcMantenimientosPuntoVenta.Y, pcMantenimientosPuntoVenta.Participation);

            try
            {
                string sBuscar = "SELECT COUNT(tbl_bitacora_mantenimiento.PK_idBitacora)" +
                                 ", tbl_punto_Venta.nombre" +
                                 "  FROM tbl_bitacora_mantenimiento INNER JOIN tbl_activo " +
                                 " ON tbl_bitacora_mantenimiento.PK_idActivo = tbl_activo.PK_idActivo" +
                                 " INNER JOIN tbl_empleado ON tbl_activo.cod_empleado_asignado = tbl_empleado.PK_idEmpleado" +
                                 " INNER JOIN tbl_punto_Venta ON tbl_empleado.cod_punto_Venta= tbl_punto_Venta.PK_idPuntoVenta" +
                                 " WHERE fecha BETWEEN '" + dtpInicial.Value.ToString("yyyy-MM-dd") + "' AND' " + dtpFinal.Value.ToString("yyyy-MM-dd") + "' " +
                                 "  GROUP BY  tbl_punto_venta.PK_idPuntoVenta";

                Console.WriteLine(sBuscar);
                OdbcCommand    sqlBuscar = new OdbcCommand(sBuscar, con);
                OdbcDataReader almacena  = sqlBuscar.ExecuteReader();

                while (almacena.Read())
                {
                    int valor = Convert.ToInt32(almacena.GetInt64(0));

                    seriesNumActivos.Add(new PieSeries()
                    {
                        Title  = almacena.GetString(1).ToString(),
                        Values = new ChartValues <int> {
                            valor
                        },
                        DataLabels = true,
                        LabelPoint = labelNumActivos
                    });
                }
                almacena.Close();

                pcMantenimientosPuntoVenta.Series         = seriesNumActivos;
                pcMantenimientosPuntoVenta.LegendLocation = LegendLocation.Right;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Beispiel #17
0
 private void button10_Click(object sender, EventArgs e)
 {
     if (textBox3.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string         sql    = string.Format("SELECT * FROM USUARIO WHERE USU_USUARIO = UPPER('{0}')", textBox3.Text);
             OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (reader.Read())
             {
                 textBox1.Enabled  = true;
                 textBox2.Enabled  = true;
                 textBox3.Enabled  = false;
                 button10.Enabled  = false;
                 button6.Enabled   = true;
                 button7.Enabled   = true;
                 button1.Enabled   = false;
                 checkBox1.Enabled = true;
                 textBox1.Text     = reader.GetString(0);
                 //textBox2.Text = reader.GetString(1);
                 checkBox9.Enabled = true; checkBox9.Checked = reader.GetBoolean(2);
                 checkBox8.Enabled = true; checkBox8.Checked = reader.GetBoolean(3);
                 checkBox7.Enabled = true; checkBox7.Checked = reader.GetBoolean(4);
                 checkBox6.Enabled = true; checkBox6.Checked = reader.GetBoolean(5);
             }
             else
             {
                 MessageBox.Show("USUARIO NO ENCONTRADO!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("ESCRIBA NOMBRE DE USUARIO!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         textBox3.Focus();
     }
 }
Beispiel #18
0
        public string GetScalarXML(string sql, int enrollID, string transType)
        {
            string         x     = "";
            OdbcConnection conn3 = new OdbcConnection(cnStr);

            conn3.Open();
            OdbcCommand cmd = new OdbcCommand();

            cmd.Connection  = conn3;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = sql;
            cmd.Parameters.AddWithValue("@enrollment_id", enrollID);
            cmd.Parameters.AddWithValue("@transType", transType);

            string result = "";

            OdbcDataReader reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess);

            while (reader.Read())
            {
                result = result + reader.GetString(0);
            }

            if (result == null)
            {
                x = "";
                conn3.Close();
                conn3.Dispose();
                conn3 = null;
                return(x);
            }
            if (result.ToString() == "")
            {
                x = "";
            }
            else
            {
                x = result.ToString();
            }
            conn3.Close();
            conn3.Dispose();
            conn3 = null;
            return(x);
        }
        public string GetGateKeeperNamespace(string strGKName)
        {
            string         strGKNamespace = "";
            OdbcDataReader dr             = null;

            try
            {
                StringBuilder strSQL = new StringBuilder();
                strSQL.Append("SELECT " + DBC.SS_GK_NAMESPACE);
                strSQL.Append(" FROM " + DBC.SERVICE_SPACES_TABLE);
                strSQL.Append(" WHERE " + DBC.SS_GK_NAME + "=" + "'" + DBUtil.MakeStringSafe(strGKName) + "'");

                dr = ExecuteReader(strSQL.ToString());
                if (dr != null)
                {
                    dr.Read();                     // move reader past BOF to first record
                    if (!dr.IsDBNull(0))
                    {
                        strGKNamespace = dr.GetString(0);
                    }
                    if (!dr.IsClosed)
                    {
                        dr.Close();
                    }
                }
            }
            catch (System.Exception e)
            {
                // Report error
                EventLog.WriteEntry(SOURCENAME, e.Message, EventLogEntryType.Error);
            }
            finally             // cleanup after exception handled
            {
                if (dr != null)
                {
                    if (!dr.IsClosed)
                    {
                        dr.Close();
                    }
                }
            }

            return(strGKNamespace);
        }
Beispiel #20
0
        private void BtnBuscar_Click(object sender, EventArgs e)
        {
            //Mensaje de Validación
            if (txtIdCliente.Text == "")
            {
                MessageBox.Show("ADVERTENCIA: El campo de busqueda no puede estar vacío.", "ADVERTENCIA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                //se desbloquean los componentes en los que se puede agregar/cambiar información
                BtnIngresar.Enabled = true;
                funcDesBloqueo();
                BtnIngresar.Enabled = false;

                ID = txtIdCliente.Text;
                String estado;
                //Inicio para Busqueda
                OdbcDataReader Lector = Cont.funcBuscarCliente(txtIdCliente.Text);
                if (Lector.HasRows == true)
                {
                    while (Lector.Read())
                    {
                        //Se agrega el valor del lector a los textbox dependiendo la posicion
                        TxtNombre.Text    = Lector.GetString(0);
                        TxtApellidos.Text = Lector.GetString(1);
                        TxtDpi.Text       = Lector.GetString(2);
                        TxtTel.Text       = Lector.GetString(3);
                        TxtCorreo.Text    = Lector.GetString(4);
                        estado            = Lector.GetString(5);

                        if (estado == "1")
                        {
                            rbtnActivo.Checked = true;
                        }
                        else
                        if (estado == "0")
                        {
                            rbtnInactivo.Checked = true;
                        }
                    }
                }
                else
                {
                    //Mensaje de error
                    MessageBox.Show("ERROR: El ID de ese Cliente no se encuentra Registrado.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    funcBloqueo();
                    funcLimpieza();
                }
            }//fin ifelse
        }
Beispiel #21
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            //Mensaje de Validación
            if (txtIdBancoTalento.Text == "")
            {
                MessageBox.Show("ADVERTENCIA: El campo de busqueda no puede estar vacío.", "ADVERTENCIA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                //se desbloquean los componentes en los que se puede agregar/cambiar información
                IdRecluta = txtIdBancoTalento.Text;
                gbxDatosEvaluacion.Enabled = true;
                //Inicio para Busqueda
                OdbcDataReader Lector = Cont_R.funcBuscarReclutaEvaluado(txtIdBancoTalento.Text);
                if (Lector.HasRows == true)
                {
                    while (Lector.Read())
                    {
                        //Se agrega el valor del lector a los textbox dependiendo la posicion
                        //Tabla reclutamiento

                        txtPrimerNombre.Text           = Lector.GetString(0);
                        txtPrimerApellido.Text         = Lector.GetString(1);
                        cmbPuestoTrabajo.Text          = Lector.GetString(2);
                        cmbHorario.Text                = Lector.GetString(3);
                        cmbDepartamentoTrabajo.Text    = Lector.GetString(4);
                        txtPunteoEntrevista.Text       = Lector.GetString(5);
                        txtResultadoEntrevista.Text    = Lector.GetString(6);
                        rtbxComentariosEntrevista.Text = Lector.GetString(7);
                    }
                }
                else
                {
                    //Mensaje de error
                    MessageBox.Show("ERROR: El Id de ese Recluta no se encuentra Registrado.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    funcBloqueo();
                    funcLimpieza();
                }
            }//fin ifelse
        }
        public void mostrar_consulta_aplicaciones_activas()
        {
            string usuario = "";

            usuario = glo.usuariog;
            string valor = "";

            valor = glo.aplica;
            Console.WriteLine("lo que recibe es:   " + usuario + "  " + valor);

            OdbcDataReader mostrar = asignacionDeAplicaciones.funcConsulta_aplicaciones_activas(usuario, valor);

            try
            {
                while (mostrar.Read())
                {
                    string idapli    = mostrar.GetString(0);
                    string insertar  = mostrar.GetString(1);
                    string modificar = mostrar.GetString(2);
                    string eliminar  = mostrar.GetString(3);
                    string consultar = mostrar.GetString(4);
                    string imprimir  = mostrar.GetString(5);
                    aplicacionid = idapli;

                    if (insertar == "1")
                    {
                        cb_insertar.Checked = true;
                    }
                    if (modificar == "1")
                    {
                        cb_modificar.Checked = true;
                    }
                    if (eliminar == "1")
                    {
                        cb_eliminar.Checked = true;
                    }
                    if (consultar == "1")
                    {
                        cb_consultar.Checked = true;
                    }
                    if (imprimir == "1")
                    {
                        cb_imprimir.Checked = true;
                    }
                }
            }
            catch (Exception err)
            {
                Console.WriteLine(err.Message);
            }
        }
Beispiel #23
0
        void Pruebita()
        {
            ConexionMba cs = new ConexionMba();

            CleanGrid(dataGridView1);
            if (!string.IsNullOrEmpty(cmbEmpresa.Text))
            {
                string         CORP      = "SELECT CORP FROM SIST_Parametros_Empresa  WHERE `CORPORATION NAM`= '" + cmbEmpresa.Text + "' ";
                OdbcCommand    DbCommand = new OdbcCommand(CORP, cs.getConexion());
                OdbcDataReader reader    = DbCommand.ExecuteReader();
                string         _CORP     = "";
                string         flag_localidad;

                while (reader.Read())
                {
                    _CORP = reader.GetString(0);

                    if (cmbLocalidad.SelectedIndex == 0)
                    {
                        flag_localidad = "C";
                    }
                    else
                    {
                        flag_localidad = "G";
                    }
                    string cadena = " SELECT VEN.DESCRIPTION_SPN, TRUNC(SUM(valor_factura), 2)   `Valor Factura`" +
                                    " FROM " +
                                    " CLNT_FACTURA_PRINCIPAL FP " +
                                    " INNER JOIN " +
                                    " (CLNT_FICHA_PRINCIPAL FIP INNER JOIN SIST_LISTA_1 VEN ON FIP.SALESMAN = VEN.CODE) " +
                                    " ON FP.CODIGO_CLIENTE_EMPRESA = FIP.CODIGO_CLIENTE_EMPRESA " +
                                    " WHERE ANULADA = CAST('FALSE' AS BOOLEAN) AND CONFIRMADO = CAST('TRUE' AS BOOLEAN) " +
                                    " AND FECHA_FACTURA >=  AND  FIP.CLIENT_TYPE IN ('DISTR', 'FARMA')" +
                                    " AND VEN.GROUP_CATEGORY = 'SELLm' AND VEN.CORP=FIP.EMPRESA " +
                                    " AND FP.EMPRESA = '" + _CORP + "' " +
                                    " AND FIP.ZONA= '" + flag_localidad + "' " +
                                    " GROUP BY VEN.DESCRIPTION_SPN ";

                    fg.FillDataGrid(cadena, dataGridView1);
                }
                cs.cerrarConexion();
            }
        }
        //Procedimiento para obtener datos de la linea producto
        void ProcLineaProducto()
        {
            try
            {
                string         linea        = "Select * from linea_producto ";
                OdbcCommand    comm         = new OdbcCommand(linea, conexion.conexion());
                OdbcDataReader mostrarLinea = comm.ExecuteReader();

                while (mostrarLinea.Read())
                {
                    cmbIdLineaProducto.Items.Add(mostrarLinea.GetInt32(0));
                    cmbLinea.Items.Add(mostrarLinea.GetString(1));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Prueba");
            }
        }
        //Procedimiento para obtener datos de la categoria
        void ProcCategoria()
        {
            try
            {
                string         categoria        = "Select * from categoria_producto ";
                OdbcCommand    comm             = new OdbcCommand(categoria, conexion.conexion());
                OdbcDataReader mostrarCategoria = comm.ExecuteReader();

                while (mostrarCategoria.Read())
                {
                    cmbIdcategoria.Items.Add(mostrarCategoria.GetInt32(0));
                    cmbCategoria.Items.Add(mostrarCategoria.GetString(1));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Prueba");
            }
        }
Beispiel #26
0
 private void cargaSucursales(string sucursal)
 {
     try
     {
         OdbcConnection conexion = ASG_DB.connectionResult();
         string         sql      = string.Format("SELECT NOMBRE_SUCURSAL FROM SUCURSAL WHERE ESTADO_TUPLA = TRUE AND ID_SUCURSAL = {0};", sucursal);
         OdbcCommand    cmd      = new OdbcCommand(sql, conexion);
         OdbcDataReader reader   = cmd.ExecuteReader();
         if (reader.Read())
         {
             comboBox5.Items.Add(reader.GetString(0));
             comboBox5.SelectedIndex = 0;
         }
     }
     catch (Exception e)
     {
         MessageBox.Show(e.ToString());
     }
 }
Beispiel #27
0
 //Cargar Datos de Empleado
 private void cargarEmpleado()
 {
     try
     {
         string         bodega        = "SELECT * FROM EMPLEADO";
         OdbcCommand    comando2      = new OdbcCommand(bodega, con.conexion());
         OdbcDataReader mostrarBodega = comando2.ExecuteReader();
         while (mostrarBodega.Read())
         {
             cmbEmpleado.Items.Add(mostrarBodega.GetInt32(0));
             cmbNomEmp.Items.Add(mostrarBodega.GetString(1));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error al cargar datos al combo");
         Console.WriteLine(ex.Message);
     }
 }
 private void button7_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "" && textBox6.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string         sql    = string.Format("SELECT ID_FORMATO FROM FORMATO WHERE DESCRIPCION_FORMATO = '{0}'", textBox1.Text);
             OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (!reader.Read() || (textBox3.Text == reader.GetString(0)))
             {
                 conexion.Close();
                 conexion = TaquillaDB.getDB();
                 sql      = string.Format("UPDATE FORMATO SET DESCRIPCION_FORMATO = '{0}', PRECIO_FORMATO = {1} WHERE ID_FORMATO = '{2}';", textBox1.Text, textBox6.Text, textBox3.Text);
                 cmd      = new OdbcCommand(sql, conexion);
                 cmd.ExecuteNonQuery();
                 MessageBox.Show("ACTUALIZADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 textBox1.Enabled = false; textBox1.Text = "";
                 textBox6.Enabled = false; textBox6.Text = "";
                 textBox3.Enabled = true; textBox3.Text = "";
                 textBox4.Text    = "";
                 button10.Enabled = true;
                 button2.Enabled  = true;
                 button7.Enabled  = false;
                 button6.Enabled  = false;
             }
             else
             {
                 MessageBox.Show("FORMATO EXISTENTE!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("COMPLETE TODOS LOS CAMPOS!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //user = int.Parse(Request.Form.Get("claveU"));
        OdbcConnection con = conectarBD();

        if (con != null)
        {
            OdbcCommand    cmd = new OdbcCommand("SELECT vendedor.nombre FROM vendedor", con);
            OdbcDataReader dr  = cmd.ExecuteReader();
            DropDownList1.Items.Clear();

            while (dr.Read())
            {
                DropDownList1.Items.Add(dr.GetString(0));
            }

            dr.Close();
        }
    }
Beispiel #30
0
        //procedimiento para obtener los datos del municipio
        void ProcMunicipio()
        {
            try
            {
                string         Municipio        = "Select * from municipio ";
                OdbcCommand    comm             = new OdbcCommand(Municipio, conexion.conexion());
                OdbcDataReader mostrarMunicipio = comm.ExecuteReader();

                while (mostrarMunicipio.Read())
                {
                    cmbIdMunicipio.Items.Add(mostrarMunicipio.GetInt32(0));
                    cmbMunicipio.Items.Add(mostrarMunicipio.GetString(2));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Prueba");
            }
        }