Ejemplo n.º 1
0
        /// <summary>
        /// Obtiene todos los PRIOALERTAS
        /// </summary>
        internal List <Models.PRIOALERTAS> Catalogo()
        {
            Models.PRIOALERTAS        oPRIOALERTAS = null;
            List <Models.PRIOALERTAS> lst          = new List <Models.PRIOALERTAS>();
            IDataReader dr = null;

            try
            {
                SqlParameter[] dbparams = new SqlParameter[0] {
                };

                dr = cDblib.DataReader("SUP_PRIOALERTAS_C", dbparams);
                while (dr.Read())
                {
                    oPRIOALERTAS = new Models.PRIOALERTAS();

                    oPRIOALERTAS.t820_idalerta_1 = Convert.ToByte(dr["t820_idalerta_1"]);
                    oPRIOALERTAS.t820_idalerta_2 = Convert.ToByte(dr["t820_idalerta_2"]);
                    oPRIOALERTAS.t820_idalerta_g = Convert.ToByte(dr["t820_idalerta_g"]);

                    oPRIOALERTAS.denAlert1 = dr["denAlert1"].ToString();
                    oPRIOALERTAS.denAlert2 = dr["denAlert2"].ToString();
                    oPRIOALERTAS.denAlertG = dr["denAlertG"].ToString();


                    oPRIOALERTAS.grupo1 = Convert.ToByte(dr["grupo1"]);
                    oPRIOALERTAS.grupo2 = Convert.ToByte(dr["grupo2"]);
                    oPRIOALERTAS.grupoG = Convert.ToByte(dr["grupoG"]);

                    oPRIOALERTAS.denGrupo1 = dr["denGrupo1"].ToString();

                    lst.Add(oPRIOALERTAS);
                }
                return(lst);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dr != null)
                {
                    if (!dr.IsClosed)
                    {
                        dr.Close();
                    }
                    dr.Dispose();
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Actualiza un PRIOALERTAS a partir del id
        /// </summary>
        internal int Update(Models.PRIOALERTAS oPRIOALERTAS)
        {
            try
            {
                SqlParameter[] dbparams = new SqlParameter[3] {
                    Param(enumDBFields.t820_idalerta_1, oPRIOALERTAS.t820_idalerta_1),
                    Param(enumDBFields.t820_idalerta_2, oPRIOALERTAS.t820_idalerta_2),
                    Param(enumDBFields.t820_idalerta_g, oPRIOALERTAS.t820_idalerta_g)
                };

                return((int)cDblib.Execute("SUP_PRIOALERTAS_UPD", dbparams));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 3
0
        public int Update(Models.PRIOALERTAS oPRIOALERTAS)
        {
            Guid methodOwnerID = new Guid("1efd6df0-8ebe-42e3-a1e1-ef71b020dc68");

            OpenDbConn();

            if (cDblib.Transaction.ownerID.Equals(new Guid()))
            {
                cDblib.beginTransaction(methodOwnerID);
            }

            try
            {
                DAL.PRIOALERTAS cPRIOALERTAS = new DAL.PRIOALERTAS(cDblib);

                int result = cPRIOALERTAS.Update(oPRIOALERTAS);

                //Finalizar transacción
                if (cDblib.Transaction.ownerID.Equals(methodOwnerID))
                {
                    cDblib.commitTransaction(methodOwnerID);
                }

                return(result);
            }
            catch (Exception ex)
            {
                //rollback
                //if (cDblib.Transaction.ownerID.Equals(new Guid())) cDblib.rollbackTransaction(methodOwnerID);
                if (cDblib.Transaction.ownerID.Equals(methodOwnerID))
                {
                    cDblib.rollbackTransaction(methodOwnerID);
                }
                throw ex;
            }
        }
Ejemplo n.º 4
0
        public int Insert(Models.PRIOALERTAS oPRIOALERTAS)
        {
            Guid methodOwnerID = new Guid("afb9ebac-943a-4752-a77c-b7d83c7eee80");

            OpenDbConn();

            if (cDblib.Transaction.ownerID.Equals(new Guid()))
            {
                cDblib.beginTransaction(methodOwnerID);
            }

            try
            {
                DAL.PRIOALERTAS cPRIOALERTAS = new DAL.PRIOALERTAS(cDblib);

                int idPRIOALERTAS = cPRIOALERTAS.Insert(oPRIOALERTAS);

                //Finalizar transacción
                if (cDblib.Transaction.ownerID.Equals(methodOwnerID))
                {
                    cDblib.commitTransaction(methodOwnerID);
                }

                return(idPRIOALERTAS);
            }
            catch (Exception ex)
            {
                //rollback
                //if (cDblib.Transaction.ownerID.Equals(new Guid())) cDblib.rollbackTransaction(methodOwnerID);
                if (cDblib.Transaction.ownerID.Equals(methodOwnerID))
                {
                    cDblib.rollbackTransaction(methodOwnerID);
                }
                throw ex;
            }
        }