/// <summary> /// lista todos los premois de esa regla /// </summary> /// <returns></returns> public List <PremiosPremiosInfo> ListPremios(int regla) { db.SetParameterValue(commandReglasPremios, "i_operation", 'S'); db.SetParameterValue(commandReglasPremios, "i_option", 'C'); db.SetParameterValue(commandReglasPremios, "i_idregla", regla); List <PremiosPremiosInfo> col = new List <PremiosPremiosInfo>(); IDataReader dr = null; PremiosPremiosInfo m = null; try { dr = db.ExecuteReader(commandReglasPremios); while (dr.Read()) { m = Factory.getPremiosPremios(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 Insertpremios(PremiosPremiosInfo item, string usuario) { return(module.Insertpremios(item, usuario)); }
/// <summary> /// Guarda estados de la regla premio /// </summary> /// <param name="item"></param> public int Insertpremios(PremiosPremiosInfo item, string usuario) { int id = 1; IDataReader dr = null; try { db.SetParameterValue(commandReglasPremios, "i_operation", 'I'); db.SetParameterValue(commandReglasPremios, "i_option", 'D'); db.SetParameterValue(commandReglasPremios, "i_idregla", item.IdRegla); db.SetParameterValue(commandReglasPremios, "i_referenciai", item.Referencia); db.SetParameterValue(commandReglasPremios, "i_plui", item.Plu); db.SetParameterValue(commandReglasPremios, "i_nombre", item.Nombre); db.SetParameterValue(commandReglasPremios, "i_cantidadpremio", item.Cantidad); db.SetParameterValue(commandReglasPremios, "i_tipopremio", item.TipoPremio); 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 premios para la regla premio. idregla:" + item.IdRegla + " referencia" + item.Referencia + " plu" + item.Plu + " cantidad " + item.Cantidad + ". 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); }