/// <summary> /// Realiza el registro de una configuracion de puntos. /// </summary> /// <param name="item"></param> public int Insert(PremiosPuntosConfInfo item) { try { return(module.Insert(item)); } 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)); return(0); } }
/// <summary> /// Realiza el registro de una configuracion de puntos. /// </summary> /// <param name="item"></param> public int Insert(PremiosPuntosConfInfo item) { int id = 0; IDataReader dr = null; try { db.SetParameterValue(commandPremiosPuntosConf, "i_operation", 'I'); db.SetParameterValue(commandPremiosPuntosConf, "i_option", 'A'); db.SetParameterValue(commandPremiosPuntosConf, "i_cam_id", item.IdCampo); db.SetParameterValue(commandPremiosPuntosConf, "i_ptc_campana", item.Campana); db.SetParameterValue(commandPremiosPuntosConf, "i_ptc_tipoprecio", item.TipoPrecio); db.SetParameterValue(commandPremiosPuntosConf, "i_ptc_puntos", item.Puntos); dr = db.ExecuteReader(commandPremiosPuntosConf); //Obtiene el identificador (consecutivo) del insert id = Convert.ToInt32(db.GetParameterValue(commandPremiosPuntosConf, "i_ptc_id")); } 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); }
/// <summary> ///Lista todos los puntos configuracion /// </summary> /// <returns></returns> public List <PremiosPuntosConfInfo> List() { db.SetParameterValue(commandPremiosPuntosConf, "i_operation", 'S'); db.SetParameterValue(commandPremiosPuntosConf, "i_option", 'A'); List <PremiosPuntosConfInfo> col = new List <PremiosPuntosConfInfo>(); IDataReader dr = null; PremiosPuntosConfInfo m = null; try { dr = db.ExecuteReader(commandPremiosPuntosConf); while (dr.Read()) { m = Factory.GetPremiosPuntosConf(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); }