protected void chkKbxRoles_OnSelectedIndexChanged(object sender, EventArgs e) { try { if (chklbxRoles.Items.Cast <ListItem>().Any(item => item.Selected && int.Parse(item.Value) == (int)BusinessVariables.EnumRoles.Administrador)) { foreach (ListItem item in chklbxRoles.Items.Cast <ListItem>()) { item.Selected = int.Parse(item.Value) == (int)BusinessVariables.EnumRoles.Administrador; } } List <object> lst = new List <object>(); foreach (ListItem item in chklbxRoles.Items.Cast <ListItem>()) { AsociarGrupoUsuario.HabilitaGrupos(Convert.ToInt32(item.Value), item.Selected); } lst.Insert(BusinessVariables.ComboBoxCatalogo.Index, new TipoGrupo { Id = BusinessVariables.ComboBoxCatalogo.Value, Descripcion = BusinessVariables.ComboBoxCatalogo.Descripcion }); Session["UsuarioGrupo"] = new List <UsuarioGrupo>(); btnModalGrupos.Visible = true; upGrupos.Update(); } catch (Exception ex) { if (_lstError == null) { _lstError = new List <string>(); } _lstError.Add(ex.Message); AlertaGeneral = _lstError; } }
private void LimpiarPantalla() { try { Session["UsuarioGrupo"] = null; txtAp.Text = string.Empty; txtAm.Text = string.Empty; txtNombre.Text = string.Empty; txtUserName.Text = string.Empty; Metodos.LimpiarCombo(ddlPuesto); chkVip.Checked = false; chkDirectoriActivo.Checked = false; btnModalDatosGenerales.CssClass = "btn btn-primary"; btnModalOrganizacion.CssClass = "btn btn-primary disabled"; btnModalUbicacion.CssClass = "btn btn-primary disabled"; btnModalRoles.CssClass = "btn btn-primary disabled"; btnModalGrupos.CssClass = "btn btn-primary disabled"; foreach (ListItem item in chklbxRoles.Items) { item.Selected = false; } upRoles.Update(); AsociarGrupoUsuario.Limpiar(); } catch (Exception ex) { if (_lstError == null) { _lstError = new List <string>(); } _lstError.Add(ex.Message); AlertaGeneral = _lstError; } }
private void ValidaCapturaGrupos() { StringBuilder sb = new StringBuilder(); if (!AsociarGrupoUsuario.ValidaCapturaGrupos()) { sb.AppendLine("<li>Debe asignar al menos un Grupo.</li>"); } if (sb.ToString() != string.Empty) { sb.Append("</ul>"); sb.Insert(0, "<ul>"); sb.Insert(0, "<h3>Grupos</h3>"); throw new Exception(sb.ToString()); } }
protected void btnCerrarGrupos_OnClick(object sender, EventArgs e) { try { if (!AsociarGrupoUsuario.ValidaCapturaGrupos()) { return; } btnModalGrupos.CssClass = "btn btn-success btn-lg"; ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "CierraPopup(\"#modalGrupos\");", true); } catch (Exception ex) { if (_lstError == null) { _lstError = new List <string>(); } _lstError.Add(ex.Message); } }