예제 #1
0
 private void FormRole_Load(object sender, EventArgs e)
 {
     PreparareMenu(true);
     EnableFields(true);
     RoleConnection.LoadDGV(dg_rol);
     groupBoxAdd.Enabled = false;
 }
예제 #2
0
        private void btn_delete_Click(object sender, EventArgs e)
        {
            FunctionDAO itemSelected = (FunctionDAO)lst_functions_added.Items[lst_functions_added.SelectedIndex];

            removedFunctions.Add(itemSelected);
            addedFunctions.Remove(itemSelected);

            RoleConnection.DeleteFunction(role, itemSelected);
        }
예제 #3
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Int32 id = Convert.ToInt32(dg_rol.CurrentRow.Cells["Rol_Id"].Value);

            if (MessageBox.Show("¿Realmente desea eliminar el rol seleccionado?", "Advertencia", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
            {
                RoleConnection.DeleteRole(id);
                RoleConnection.LoadDGV(dg_rol);
            }
        }
예제 #4
0
 private void btn_search_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txt_search_name.Text.Trim()))
     {
         string word = txt_search_name.Text.Trim();
         RoleConnection.SearchRole(dg_rol, word);
     }
     else
     {
         MessageBox.Show("Ingrese un rol a buscar por favor.");
     }
 }
예제 #5
0
        private void acceptToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Boolean enabled = chk_enabled.Checked;

            String newName = txt_name.Text.Trim();

            RoleConnection.UpdateName(role.Id, newName, enabled);

            MessageBox.Show("La modificación del nombre y/o estado del rol la verá una vez hecho click en Reestablecer.");

            this.Close();
        }
예제 #6
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txt_add_name.Text.Trim()))
            {
                RoleDAO role = new RoleDAO();

                role.Name  = txt_add_name.Text.Trim();
                role.State = chk_available.Checked;

                RoleConnection.SaveRole(role);

                Int32 id = RoleConnection.GetRoleId(txt_add_name.Text.Trim());
                role.Id = id;

                if (MessageBox.Show("¿Desea agregarle funcionalidades ahora?", "Pregunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    this.Hide();
                    FormAMRole form = new FormAMRole(role, true, false);
                    form.ShowDialog();
                    this.Show();
                }
                else
                {
                    MessageBox.Show("El rol se ha guardado correctamente.");
                    txt_add_name.Text     = "";
                    chk_available.Checked = false;
                    groupBoxAdd.Enabled   = false;
                }
            }
            else
            {
                MessageBox.Show("Debe indicar el nombre del nuevo rol.");
            }

            RoleConnection.LoadDGV(dg_rol);
        }
예제 #7
0
 private void btn_reestablish_Click(object sender, EventArgs e)
 {
     RoleConnection.LoadDGV(dg_rol);
     txt_search_name.Text = "";
 }