Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!this.ValidateChildren())
            {
                return;
            }

            bool success = Log();

            if (success)
            {
                var roles   = Roles.GetAllFor(LoginData.IdUsuario);
                var hoteles = HotelesLogin.GetAllFor(LoginData.IdUsuario);

                bool noOk = false;
                bool debeAbrirSeleccionar = roles.Count > 1 || hoteles.Count > 1;

                if (debeAbrirSeleccionar)
                {
                    noOk = Seleccionar();
                }
                else
                {
                    var rol = roles.First();

                    if (rol.Activo == "N")
                    {
                        MessageBox.Show("Su rol esta inhabilitado, por favor contacte a un administrador");

                        noOk = true;
                    }
                    else
                    {
                        LoginData.Rol   = rol;
                        LoginData.Hotel = hoteles.First();
                    }
                }

                if (!noOk)
                {
                    this.Hide();

                    Inicio form = new Inicio();

                    form.Show();
                }
            }
        }
Example #2
0
        public Seleccion()
        {
            InitializeComponent();

            roles = Roles.GetAllFor(LoginData.IdUsuario);
            this.rolesCombo.DataSource = roles;

            hoteles = HotelesLogin.GetAllFor(LoginData.IdUsuario);
            this.hotelesCombo.DataSource = hoteles;

            this.rolesCombo.SelectedIndex   = 0;
            this.hotelesCombo.SelectedIndex = 0;

            this.rolesCombo.Enabled   = roles.Count > 1;
            this.hotelesCombo.Enabled = hoteles.Count > 1;
        }
Example #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!this.ValidateChildren())
            {
                return;
            }

            bool success = Log();

            if (success)
            {
                var roles   = Roles.GetAllFor(LoginData.IdUsuario);
                var hoteles = HotelesLogin.GetAllFor(LoginData.IdUsuario);

                bool debeAbrirSeleccionar = roles.Count > 1 || hoteles.Count > 1;

                if (debeAbrirSeleccionar)
                {
                    Seleccionar();
                }
                else
                {
                    LoginData.Rol = roles.First();
                }

                if (LoginData.Rol.idRol == 2)
                {
                    LoginData.Hotel = hoteles.First();
                }

                this.Hide();

                Form1 form = new Form1();

                form.Show();
            }
        }