Exemplo n.º 1
0
        private void CargarPerfiles()
        {
            try
            {
                BLL.Tables.TBL_PERFILES _perfiles = new BLL.Tables.TBL_PERFILES();
                _perfiles.ItemList();
                Entities.Tables.TBL_PERFILES _itemSeleccion = new Entities.Tables.TBL_PERFILES();
                //Limpia el combo
                this.comboPerfil.SuspendLayout();
                this.comboPerfil.DataSource = null;
                this.comboPerfil.Items.Clear();

                //Carga el item de Seleccion.-
                _itemSeleccion.NOMBREPERFIL = "<Seleccione un Perfil>";
                _itemSeleccion.ID_PERFIL    = 0;
                _perfiles.Result.Insert(0, _itemSeleccion);

                //Carga el combo
                this.comboPerfil.ValueMember   = "Id_Perfil";
                this.comboPerfil.DisplayMember = "NombrePerfil";
                this.comboPerfil.DataSource    = _perfiles.Result;
                this.comboPerfil.SelectedValue = 0;
                this.comboPerfil.ResumeLayout();
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        private void cmdGrabarUsuario_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.textBoxPerfil.Text.Trim() != string.Empty)
                {
                    BLL.Tables.TBL_PERFILES      _perfil    = new BLL.Tables.TBL_PERFILES();
                    Entities.Tables.TBL_PERFILES _newPerfil = new Entities.Tables.TBL_PERFILES();
                    _newPerfil.NOMBREPERFIL      = this.textBoxPerfil.Text.ToString().Trim();
                    _newPerfil.DESCRIPCIONPERFIL = this.textBoxDescripcion.Text.ToString().Trim();

                    _perfil.Add(_newPerfil);

                    MessageBox.Show("Perfil dado de alta correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Debe ingresar una descripción de Perfil", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }