public Permiso Detalles(int id) { Permiso result = null; try { string nombreCache = string.Format("Permiso{0}", id); if (!CacheData.Exist(nombreCache)) { PermisoDAL model = new PermisoDAL(_connectionString); var permiso = model.Detalles(id); result = Converter.ConvertToBL(permiso); CacheData.Add(nombreCache, result); } else { result = (Permiso)CacheData.Get(nombreCache); } } catch (Exception ex) { log.Error("Detalles()", ex); } return(result); }
public bool Modificar(Permiso permiso) { bool updated = false; try { DAL.DTO.Permiso permisoDal = Converter.ConvertToDAL(permiso); PermisoDAL mod = new PermisoDAL(_connectionString); updated = mod.Modificar(permisoDal); if (updated) { // Si había una caché para prensa la borramos string nombreCache = string.Format("permiso{0}", permiso.tipoPermiso); CacheData.Remove(nombreCache); } } catch (Exception er) { log.Error("Agregar()", er); } return(updated); }
public static void Borrar(PermisoBE permiso) { PermisoDAL.Guardar(permiso, false, false); // Guardo la bitácora Bitacora.Loguear("Se eliminó el permiso con Id " + permiso.Id); }
public Permiso GetByID(int ID) { Permiso result = default(Permiso); var PermisoDAL = new PermisoDAL(); result = PermisoDAL.ReadBy(ID); return(result); }
public Permiso Create(Permiso Permiso) { Permiso result = default(Permiso); var PermisoDAL = new PermisoDAL(); result = PermisoDAL.Create(Permiso); return(result); }
public List <Permiso> ListarTodos() { List <Permiso> result = default(List <Permiso>); var PermisoDAL = new PermisoDAL(); result = PermisoDAL.Read(); return(result); }
public static void Guardar(PermisoBE permiso) { PermisoDAL.Guardar(permiso, true, true); // Guardo la bitácora string mensajeBitacora = permiso.Id > 0 ? "Se actualizó el permiso con Id " + permiso.Id : "Se creó un nuevo permiso. Nombre: " + permiso.Nombre; Bitacora.Loguear(mensajeBitacora); }
public void Remover(Familia familia, Permiso hijo) { using (IUnitOfWork unitOfWork = UnitOfWorkFactory.Create()) { PermisoDAL permisoDAL = new PermisoDAL(unitOfWork); permisoDAL.Remover(familia, hijo); unitOfWork.SaveChanges(); familia.Remover(hijo); } }
public bool Eliminar(Permiso Permiso) { var PermisoDAL = new PermisoDAL(); try { PermisoDAL.Eliminar(Permiso); return(true); } catch { Console.WriteLine("Error al eliminar el elemento"); return(false); } }
public bool Edit(Permiso Permiso) { var PermisoDAL = new PermisoDAL(); try { PermisoDAL.Update(Permiso); return(true); } catch { Console.WriteLine("Error al editar el elemento"); return(false); } }
public bool Delete(int ID) { var PermisoDAL = new PermisoDAL(); try { PermisoDAL.Delete(ID); return(true); } catch { Console.WriteLine("Error al eliminar el elemento"); return(false); } }
public void Agregar(Familia familia, Permiso hijo) { if (familia.Buscar(hijo)) { throw new InvalidOperationException("El permiso que desea agregar ya existe"); } if (hijo.Buscar(familia)) { throw new InvalidCastException("No puede crear dependencias circulares"); } familia.Agregar(hijo); using (IUnitOfWork unitOfWork = UnitOfWorkFactory.Create()) { PermisoDAL permisoDAL = new PermisoDAL(unitOfWork); permisoDAL.Agregar(familia, hijo); unitOfWork.SaveChanges(); } }
public List <Permiso> Listar() { List <Permiso> result = null; try { PermisoDAL model = new PermisoDAL(_connectionString); var permisos = model.Listar(); if (permisos != null) { result = Converter.ConvertToBL(permisos); } } catch (Exception ex) { log.Error("Listar()", ex); } return(result); }
public bool Eliminar(int Id_Permiso) { bool sw = false; try { PermisoDAL model = new PermisoDAL(_connectionString); sw = model.Eliminar(Id_Permiso); if (sw) { // Si había una caché para prensa la borramos string nombreCache = string.Format("permiso{0}", Id_Permiso); CacheData.Remove(nombreCache); } } catch (Exception er) { log.Error("Eliminar(Id_Permiso: {0})", er, Id_Permiso); } return(sw); }
public static List <PermisoBE> ObtenerPerfiles() { return(PermisoDAL.ObtenerPerfiles()); }
public Permiso() { _mapeador = new PermisoDAL(); }
public PermisoBLL() { this._dao = new PermisoDAL(); this._daoFamilia = new FamiliaPermisoDAL(); }
public PermisoBLL(PermisoDAL pDAO, IFamiliaPermisoDAL pFamiliaDAO) { this._dao = pDAO; this._daoFamilia = pFamiliaDAO; }