public bool ValidarPermiso(int id, List <PermisoBE> lista) { bool contiene = false; if (lista != null) { foreach (var perm in lista) { if (perm.Id.Equals(id)) { contiene = true; break; } PermisoBLL permisoBLL = new PermisoBLL(); PermisoBE permiso = new PermisoBE(); permiso.Id = perm.Id; permiso = permisoBLL.Consulta(ref permiso); FamiliaBE familia = new FamiliaBE(permiso); familia.Permisos = permisoBLL.ConsultaPermisos(familia); foreach (var permisoHijo in familia.Permisos) { if (permisoHijo.Id.Equals(id)) { contiene = true; break; } } } } return(contiene); }
public bool Modificacion(ref FamiliaBE value) { try { return(this._dao.Modificacion(ref value)); } catch (Exception ex) { throw new Exception("No se puede modificar.", ex); } }
public System.Collections.Generic.List <FamiliaBE> ConsultaRango(FamiliaBE filtroDesde, FamiliaBE filtroHasta) { try { return(this._dao.ConsultaRango(filtroDesde, filtroHasta)); } catch (Exception ex) { throw new Exception("No se puede consultar por rango.", ex); } }
public List <PermisoBE> ConsultaPermisos(ref FamiliaBE filtro) { try { return(this._dao.ConsultaPermisos(ref filtro)); } catch (Exception ex) { throw new Exception("No se puede consultar.", ex); } }
/// <summary> /// ''' Agrega un nuevo permiso al sistema. /// ''' </summary> public bool Alta(ref FamiliaBE value) { try { return(this._dao.Alta(ref value)); } catch (Exception ex) { throw new Exception("No se puede agregar.", ex); } }
/// <summary> /// ''' Elimina un permiso existente del sistema. /// ''' </summary> public bool Baja(ref FamiliaBE value) { try { return(this._dao.Baja(ref value)); } catch (Exception ex) { throw new Exception("No se puede eliminar.", ex); } }
// GET: Familia/Details/5 public ActionResult Details(int id) { FamiliaBE familiaBE = new FamiliaBE(); Familia familia = new Familia(); familia = familiaBE.ReadBy(id); familiaBE.ObtenerTodosLosPermisos(familia); return(View(familia)); }
public List <FamiliaBE> ConsultaRango(FamiliaBE filtroDesde, FamiliaBE filtroHasta) { List <FamiliaBE> lista = new List <FamiliaBE>(); IDbCommand comando = this.Wrapper.CrearComando("select * from familia WHERE (id=@id OR @id IS NULL) ", CommandType.Text); try { if (filtroDesde != null && filtroDesde.Id > 0) { this.Wrapper.AgregarParametro(comando, "@id", filtroDesde.Id); } else { this.Wrapper.AgregarParametro(comando, "@id", DBNull.Value); } if (filtroDesde != null && !string.IsNullOrEmpty(filtroDesde.Nombre)) { this.Wrapper.AgregarParametro(comando, "@nombre", filtroDesde.Nombre); } else { this.Wrapper.AgregarParametro(comando, "@nombre", DBNull.Value); } using (IDataReader reader = this.Wrapper.ConsultarReader(comando)) { while (reader.Read()) { lista.Add(this.Conversor.Convertir(reader)); } } } catch { throw; } finally { this.Wrapper.CerrarConexion(comando); } return(lista); }
public List <FamiliaBE> ConsultaRango(ref FamiliaBE filtroDesde, ref FamiliaBE filtroHasta) { List <FamiliaBE> lista = new List <FamiliaBE>(); IDbCommand comando = this.Wrapper.CrearComando("HS_PERMISO_LISTAR", CommandType.StoredProcedure); try { if (filtroDesde != null && filtroDesde.Id > 0) { this.Wrapper.AgregarParametro(comando, "@id", filtroDesde.Id); } else { this.Wrapper.AgregarParametro(comando, "@id", DBNull.Value); } if (filtroDesde != null && !string.IsNullOrEmpty(filtroDesde.Nombre)) { this.Wrapper.AgregarParametro(comando, "@nombre", filtroDesde.Nombre); } else { this.Wrapper.AgregarParametro(comando, "@nombre", DBNull.Value); } using (IDataReader reader = this.Wrapper.ConsultarReader(comando)) { while (reader.Read()) { lista.Add(this.Conversor.Convertir(reader)); } } } catch { throw; } finally { this.Wrapper.CerrarConexion(comando); } return(lista); }
public bool Alta(ref FamiliaBE value) { int resultado = 0; IDbCommand comando = this.Wrapper.CrearComando("INSERT INTO familia VALUES(@id, @id_permiso)", CommandType.Text); try { this.Wrapper.AgregarParametro(comando, "@id", value.Id); resultado = this._wrapper.EjecutarConsulta(comando); } catch { throw; } finally { this.Wrapper.CerrarConexion(comando); } return(resultado > 0 ? true : false); }
public bool Modificacion(ref FamiliaBE value) { int resultado = 0; IDbCommand comando = this.Wrapper.CrearComando("HS_PERMISO_MODIFICAR", CommandType.StoredProcedure); try { this.Wrapper.AgregarParametro(comando, "@nombre", value.Nombre); this.Wrapper.AgregarParametro(comando, "@descripcion", value.Descripcion); this.Wrapper.AgregarParametro(comando, "@eliminado", value.Eliminado); this.Wrapper.AgregarParametro(comando, "@id", value.Id); resultado = this._wrapper.EjecutarConsulta(comando); } catch { throw; } finally { this.Wrapper.CerrarConexion(comando); } return(resultado > 0); }
public List <PermisoBE> ConsultaPermisos(ref FamiliaBE filtro) { IDbCommand comando = this.Wrapper.CrearComando("SELECT * FROM familia WHERE id = @id", CommandType.Text); try { List <FamiliaBE> familiaList = new List <FamiliaBE>(); if (filtro != null && filtro.Id > 0) { this.Wrapper.AgregarParametro(comando, "@id", filtro.Id); } else { this.Wrapper.AgregarParametro(comando, "@id", DBNull.Value); } using (IDataReader reader = this.Wrapper.ConsultarReader(comando)) { while (reader.Read()) { familiaList.Add(this.Conversor.Convertir(reader)); } } } catch { throw; } finally { this.Wrapper.CerrarConexion(comando); } return(null); }
// GET: Familia public ActionResult Index() { FamiliaBE familiaBE = new FamiliaBE(); return(View(familiaBE.Read())); }
public List <FamiliaBE> Consulta(ref FamiliaBE filtro) { List <FamiliaBE> lista = this.ConsultaRango(filtro, filtro); return(lista); }
public bool AgregarPermisos(FamiliaBE familia) { return(this._dao.AgregarPermisos(familia)); }
public bool QuitarPermisos(FamiliaBE familia) { return(this._dao.QuitarPermisos(familia)); }
public List <PermisoBE> ConsultaPermisos(FamiliaBE familia) { return(this._dao.ConsultarHijos(familia)); }