/// <summary> /// lista todas las Zonas existentes. /// </summary> /// <returns></returns> public List <GruposUsuariosInfo> List() { db.SetParameterValue(command, "i_operation", 'S'); db.SetParameterValue(command, "i_option", 'A'); List <GruposUsuariosInfo> col = new List <GruposUsuariosInfo>(); IDataReader dr = null; GruposUsuariosInfo m = null; try { dr = db.ExecuteReader(command); while (dr.Read()) { m = Factory(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); }
private GruposUsuariosInfo Factory(IDataReader dr) { GruposUsuariosInfo item = new GruposUsuariosInfo(); try { item.Grupo = Tools.ToString(dr, "grupo"); } 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)); } try { item.Nombre = Tools.ToString(dr, "nombre"); } 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(item); }