Пример #1
0
        public ScreenRol()
        {
            InitializeComponent();

            BindingList <Rol> data_source = _RolManager.GetAll();

            dataGrid_rol.DataSource = data_source;
        }
Пример #2
0
        public AddEditUser(Usuario user)
        {
            InitializeComponent();

            button_modifDatos.Enabled = false;

            BindingList <Rol> all_roles = _rolMan.GetAll();

            listBox_rol.DataSource    = all_roles;
            listBox_rol.DisplayMember = "nombre_rol";
            listBox_rol.SelectedItems.Clear();

            BindingList <int> all_hoteles = _hotelMan.GetAll();

            listBox_hots.DataSource = all_hoteles;
            listBox_hots.SelectedItems.Clear();

            comboBox_estadoUser.Items.Add("True");
            comboBox_estadoUser.Items.Add("False");

            if (user != null)
            {
                current_user = user;

                current_user.hoteles = _hotelMan.GetAllPorUser(current_user.id_usuario);
                if (!current_user.hoteles.Contains(Sesion.id_hotel))
                {
                    MessageBox.Show("El Usuario seleccionado no pertenece a este hotel");
                    string hoteles = "";
                    foreach (int hotel in current_user.hoteles)
                    {
                        hoteles += '-' + hotel.ToString();
                    }
                    MessageBox.Show("Para modificarlo, contacte al admin de los siguientes hoteles:\n" + hoteles);
                    button_guardar.Enabled = false;
                    return;
                }

                listBox_preHot.DataSource = current_user.hoteles;

                es_modificacion = true;

                textBox_preUser.Text     = current_user.id_usuario;
                textBox_username.Text    = current_user.id_usuario;
                textBox_preUser.Enabled  = false;
                textBox_username.Enabled = false;
                textBox_prePass.Text     = current_user.password;
                textBox_prePass.Enabled  = false;

                current_user.roles        = _rolMan.GetAllPorUser(textBox_preUser.Text, false);
                listBox_preRol.DataSource = current_user.roles;

                textBox_preInt.Text    = Convert.ToString(current_user.intentos);
                textBox_preInt.Enabled = false;


                textBox_preEstado.Text = Convert.ToString(current_user.baja_logica);
            }
            else
            {
                panel_mod.Visible = false;
            }
        }