Esempio n. 1
0
        /// <summary>
        /// get an instance of object
        /// </summary>
        /// <param name="myID"></param>
        public z_orden getObjectz_orden(System.Int32 myID)
        {
            z_orden myz_orden = new z_orden();
            CnxBase myBase    = new CnxBase();
            string  reqSQL    = "SELECT id_orden,codigo_llamado,orden_numero,id_tipo_carro FROM z_orden WHERE (id_orden=" + myID + ")";

            try
            {
                NpgsqlConnection myConn    = myBase.OpenConnection(myBase.cnxString);
                NpgsqlCommand    myCommand = new NpgsqlCommand(reqSQL, myConn);
                NpgsqlDataReader myReader  = myCommand.ExecuteReader();
                if (myReader.Read())
                {
                    myz_orden.id_orden       = Convert.ToInt32(myReader[0]);
                    myz_orden.codigo_llamado = Convert.ToInt32(myReader[1]);
                    myz_orden.orden_numero   = Convert.ToInt32(myReader[2]);
                    myz_orden.id_tipo_carro  = Convert.ToInt32(myReader[3]);
                }
                myBase.CloseConnection(myConn);
            }
            catch (Exception myErr)
            {
                throw (new Exception(myErr.ToString() + reqSQL));
            }
            return(myz_orden);
        }
Esempio n. 2
0
        /// <summary>
        /// modify a record
        /// </summary>
        public void modifyz_orden(z_orden myz_orden)
        {
            CnxBase myBase = new CnxBase();
            string  reqSQL = "UPDATE z_orden SET id_orden=" + myz_orden.id_orden + ",codigo_llamado=" + myz_orden.codigo_llamado + ",orden_numero=" + myz_orden.orden_numero + ",id_tipo_carro=" + myz_orden.id_tipo_carro + " WHERE (id_orden=" + myz_orden.id_orden + ")";

            try
            {
                NpgsqlConnection myConn    = myBase.OpenConnection(myBase.cnxString);
                NpgsqlCommand    myCommand = new NpgsqlCommand(reqSQL, myConn);
                myCommand.ExecuteNonQuery();
                myBase.CloseConnection(myConn);
            }
            catch (Exception myErr)
            {
                throw (new Exception(myErr.ToString() + reqSQL));
            }
        }
Esempio n. 3
0
        /// <summary>
        /// add a record
        /// </summary>
        /// <param name="myID"></param>
        public void addz_orden(z_orden myz_orden)
        {
            CnxBase myBase = new CnxBase();
            string  reqSQL = "INSERT INTO z_orden (id_orden,codigo_llamado,orden_numero,id_tipo_carro) VALUES (" + myz_orden.id_orden + "," + myz_orden.codigo_llamado + "," + myz_orden.orden_numero + "," + myz_orden.id_tipo_carro + ")";

            try
            {
                NpgsqlConnection myConn    = myBase.OpenConnection(myBase.cnxString);
                NpgsqlCommand    myCommand = new NpgsqlCommand(reqSQL, myConn);
                myCommand.ExecuteNonQuery();
                myBase.CloseConnection(myConn);
            }
            catch (Exception myErr)
            {
                throw (new Exception(myErr.ToString() + reqSQL));
            }
        }