Esempio n. 1
0
        public z_llamados getObjectz_llamados_id(System.Int32 myID)
        {
            z_llamados myz_llamados = new z_llamados();
            CnxBase    myBase       = new CnxBase();
            string     reqSQL       = "SELECT id_llamado,codigo_llamado,clave,descripcion, max_b, incendio, rest_incendio FROM z_llamados WHERE (id_llamado=" + myID + ")";

            try
            {
                NpgsqlConnection myConn    = myBase.OpenConnection(myBase.cnxString);
                NpgsqlCommand    myCommand = new NpgsqlCommand(reqSQL, myConn);
                NpgsqlDataReader myReader  = myCommand.ExecuteReader();
                if (myReader.Read())
                {
                    myz_llamados.id_llamado     = Convert.ToInt32(myReader[0]);
                    myz_llamados.codigo_llamado = Convert.ToInt32(myReader[1]);
                    myz_llamados.clave          = myReader[2].ToString();
                    myz_llamados.descripcion    = myReader[3].ToString();
                    myz_llamados.max_b          = Convert.ToInt32(myReader[4]);
                    myz_llamados.incendio       = Convert.ToBoolean(myReader[5]);
                    myz_llamados.rest_incendio  = Convert.ToBoolean(myReader[6]);
                }
                myBase.CloseConnection(myConn);
            }
            catch (Exception myErr)
            {
                throw (new Exception(myErr.ToString() + reqSQL));
            }
            return(myz_llamados);
        }
Esempio n. 2
0
        /// <summary>
        /// modify a record
        /// </summary>
        public void modifyz_llamados(z_llamados myz_llamados)
        {
            CnxBase myBase = new CnxBase();
            string  reqSQL = "UPDATE z_llamados SET id_llamado=" + myz_llamados.id_llamado + ",codigo_llamado=" + myz_llamados.codigo_llamado + ",clave='" + myz_llamados.clave + "',descripcion='" + myz_llamados.descripcion + "' WHERE (id_llamado=" + myz_llamados.id_llamado + ")";

            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_llamados(z_llamados myz_llamados)
        {
            CnxBase myBase = new CnxBase();
            string  reqSQL = "INSERT INTO z_llamados (codigo_llamado,clave,descripcion, max_b, incendio, rest_incendio) VALUES (" + myz_llamados.codigo_llamado + ",'" + myz_llamados.clave + "','" + myz_llamados.descripcion + "'," + myz_llamados.max_b + "," + myz_llamados.incendio + "," + myz_llamados.rest_incendio + ")";

            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));
            }
        }