public static void FijarPermisos(List <BE.UsuarioPatente> usuPatentes, List <BE.Patente> patentes, List <BE.Familia> familias) { //LISTA DEFINITVA: patentes de familias (1) + patentes individuales (2) //CONDICION: activas -Patente & Familia- (a nivel general) & no negadas -Patente- (a nivel usuario) //PASO 1: Patente-familia BLL.FamiliaPatente famPat_BLL = new BLL.FamiliaPatente(); foreach (BE.Familia familia in familias) { if (familia.activo) { foreach (BE.Patente patente in famPat_BLL.GetPatentesFamilia(familia.id)) { if (!BE.ConfigUsuario.permisos.Any(p => p.id == patente.id)) { if (patente.activo) { BE.ConfigUsuario.permisos.Add(patente); } } } } } //PASO 2: Patente-individual BE.ConfigUsuario.usuPatentes = usuPatentes; BLL.UsuarioPatente usuPat_BLL = new BLL.UsuarioPatente(); foreach (BE.Patente patente in patentes) { //QUITAR: Si la patente ya se agregó por la familia pero esta negada individualmente if (BE.ConfigUsuario.permisos.Any(p => p.id == patente.id)) { if (BLL.ConfigUsuario.estaNegada(patente.id)) { BE.ConfigUsuario.permisos.RemoveAll(p => p.id == patente.id); } } //AGREGAR: Si la patente individual no se agregó por la familia, no está negada y está activa else { if (patente.activo) { if (!BLL.ConfigUsuario.estaNegada(patente.id)) { BE.ConfigUsuario.permisos.Add(patente); } } } } }
private void RecalcularDigitosFamiliaPatente() { //RECALCULO DVH Y DVV DE LA TABLA FAMILIAPATENTE BLL.FamiliaPatente famPat_BLL = new BLL.FamiliaPatente(); BE.FamiliaPatente famPat_BE = new BE.FamiliaPatente(); List <BE.FamiliaPatente> lista_famPat = new List <BE.FamiliaPatente>(); lista_famPat = famPat_BLL.SelectAll(); string cadena = ""; foreach (BE.FamiliaPatente item in lista_famPat) { cadena = item.id_Patente.ToString() + item.id_Familia.ToString(); int valorDVH = UTILITIES.DigitoVerificador.ObtenerDVH(cadena); famPat_BLL.UpdateDVH(valorDVH, item.id_Patente, item.id_Familia); } BLL.DigitoVerificador.CalcularDVV("FamiliaPatente"); }