예제 #1
0
        /// <summary>
        /// Guarda estados de la regla premio
        /// </summary>
        /// <param name="item"></param>
        public int Insertestados(EstadosPremiosInfo item, string usuario)
        {
            int id = 1;

            IDataReader dr = null;

            try
            {
                db.SetParameterValue(commandReglasPremios, "i_operation", 'I');
                db.SetParameterValue(commandReglasPremios, "i_option", 'C');

                db.SetParameterValue(commandReglasPremios, "i_idregla", item.IdRegla);
                db.SetParameterValue(commandReglasPremios, "i_estado", item.Estado);
                db.SetParameterValue(commandReglasPremios, "i_tipoestado", item.TipoEstado);
                db.SetParameterValue(commandReglasPremios, "i_cantidadest", item.Cantidad);


                dr = db.ExecuteReader(commandReglasPremios);

                //-----------------------------------------------------------------------------------------------------------------------------
                //Guardar auditoria
                try
                {
                    Auditoria     objAuditoria     = new Auditoria("conexion");
                    AuditoriaInfo objAuditoriaInfo = new AuditoriaInfo();

                    objAuditoriaInfo.FechaSistema = DateTime.Now;
                    objAuditoriaInfo.Usuario      = usuario;
                    objAuditoriaInfo.Proceso      = "Se realizó creación de estados para la regla premio.  idregla:" + item.IdRegla + " estado" + item.Estado + ". Acción Realizada por el Usuario: " + usuario;

                    objAuditoria.Insert(objAuditoriaInfo);
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Trace.WriteLine(string.Format("NIVI Error Auditoria: {0} , NameSpace: {1}, Clase: {2}, Metodo: {3} ", ex.Message, MethodBase.GetCurrentMethod().DeclaringType.Namespace, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name));
                }
                //-----------------------------------------------------------------------------------------------------------------------------
            }
            catch (Exception ex)
            {
                id = 0;

                System.Diagnostics.Trace.WriteLine(string.Format("NIVI Error: {0} , NameSpace: {1}, Clase: {2}, Metodo: {3} ", ex.Message, MethodBase.GetCurrentMethod().DeclaringType.Namespace, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name));

                bool rethrow = ExceptionPolicy.HandleException(ex, "DataAccess Policy");

                if (rethrow)
                {
                    throw;
                }
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
            }
            return(id);
        }
예제 #2
0
        /// <summary>
        /// lista todos los estados de esa regla
        /// </summary>
        /// <returns></returns>
        public List <EstadosPremiosInfo> ListEstados(int regla)
        {
            db.SetParameterValue(commandReglasPremios, "i_operation", 'S');
            db.SetParameterValue(commandReglasPremios, "i_option", 'B');
            db.SetParameterValue(commandReglasPremios, "i_idregla", regla);

            List <EstadosPremiosInfo> col = new List <EstadosPremiosInfo>();

            IDataReader dr = null;

            EstadosPremiosInfo m = null;

            try
            {
                dr = db.ExecuteReader(commandReglasPremios);

                while (dr.Read())
                {
                    m = Factory.getEstadoPremios(dr);

                    col.Add(m);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(string.Format("NIVI Error: {0} , NameSpace: {1}, Clase: {2}, Metodo: {3} ", ex.Message, MethodBase.GetCurrentMethod().DeclaringType.Namespace, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name));

                bool rethrow = ExceptionPolicy.HandleException(ex, "DataAccess Policy");

                if (rethrow)
                {
                    throw;
                }
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
            }

            return(col);
        }
 /// <summary>
 /// Guarda estados de la regla premio
 /// </summary>
 /// <param name="item"></param>
 public int Insertestados(EstadosPremiosInfo item, string usuario)
 {
     return(module.Insertestados(item, usuario));
 }