예제 #1
0
        private void funcionalidadesRol_SelectedIndexChanged(object sender, EventArgs e)
        {
            CheckedListBox list   = (CheckedListBox)sender;
            Funcionalidad  funcio = funcionalidades.Find(x => x.descripcion == list.SelectedItem.ToString());
            bool           hola   = list.GetSelected(list.SelectedIndex) == funcionalidadesRol.GetSelected(list.SelectedIndex);

            // list.SetSelected(list.SelectedIndex, true);
            if (diccionarioActualizacion[RolesDao.AGREGAR].Contains(funcio) & list.GetSelected(list.SelectedIndex))
            {
                diccionarioActualizacion[RolesDao.AGREGAR].Remove(funcio);
            }
            else if (diccionarioActualizacion[RolesDao.BORRAR].Contains(funcio) & !list.GetSelected(list.SelectedIndex))
            {
                diccionarioActualizacion[RolesDao.BORRAR].Remove(funcio);
            }
            else if (rolActual.funcionalidades.Contains(funcio))
            {
                // DEBO BORRAR DICHA FUNCIONALIDAD
                if (!diccionarioActualizacion[RolesDao.BORRAR].Contains(funcio) & rolActual.funcionalidades.Contains(funcio))
                {
                    diccionarioActualizacion[RolesDao.BORRAR].Add(funcio);
                }
            }
            else if (!diccionarioActualizacion[RolesDao.AGREGAR].Contains(funcio) & !rolActual.funcionalidades.Contains(funcio))
            {
                diccionarioActualizacion[RolesDao.AGREGAR].Add(funcio);
            }
        }
예제 #2
0
        private void SetCheckListBoxSelected(CheckedListBox chkListBox)
        {
            int iSelectedIndex = -1;

            if (!chkListBox.CheckOnClick)
            {
                iSelectedIndex = chkListBox.SelectedIndex;
                if (chkListBox.GetSelected(iSelectedIndex))
                {
                    if (chkListBox.Items[iSelectedIndex].ToString() == Definition.VARIABLE.STAR)
                    {
                        for (int i = 1; i < chkListBox.Items.Count; i++)
                        {
                            chkListBox.SetItemChecked(i, false);
                        }
                    }
                    else
                    {
                        chkListBox.SetItemChecked(0, false);
                    }

                    chkListBox.SetSelected(iSelectedIndex, true);
                }
            }
            else
            {
                chkListBox.SetSelected(chkListBox.SelectedIndex, false);
            }
        }
예제 #3
0
        private void funcionalidadesCheckboxList_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                CheckedListBox listBox = (CheckedListBox)sender;

                Funcionalidad funcionalidad = funcionalidades.Find(elem => elem.descripcion == listBox.SelectedItem.ToString());
                if (funcionalidadesDelRol.Contains(funcionalidad) & listBox.GetSelected(listBox.SelectedIndex))
                {
                    funcionalidadesDelRol.Remove(funcionalidad);
                }
                else
                {
                    funcionalidadesDelRol.Add(funcionalidad);
                }
            }
            catch (Exception ex) { }
        }