private void frm_menu_Load(object sender, EventArgs e) { string msn = ""; if (!EmpresaTR.llenarDatosGlobales(ref msn)) { Mensaje.advertencia(msn); Global.nombreImpresora = "Generic / Text Only"; Global.cantidadDecimales = 2; } if (Global.idRol != 1) { this.tsm_editar.Visible = false; } List <ItemMenu> items = MenuTR.consultarItemsXRol(Global.idRol); bool usarGuia = ParametroTR.ConsultarBool("guiaRemision"); if (usarGuia) { this.flp_botones.Left -= this.btn_guia.Width / 2; this.btn_guia.Show(); } this.procesarMenu(0, null, items); this.actualizarColor(); this.abrirSocket(); if (ParametroTR.ConsultarSincronizacionContinua("") == 1) { this.verificarSincronizacionContinua(); } else { this.verificarSincronizacion(); } }
protected void guardarEstado() { if (this.trv_menu.SelectedNode == null || !this.hizoCambio) { return; } List <int> seleccionados = new List <int>(); foreach (object[] objeto in this.checkboxes) { CheckBox check = (CheckBox)objeto[1]; if (check.Checked) { seleccionados.Add(Convert.ToInt32(objeto[0])); } } MenuTR.actualizar(Convert.ToInt32(this.trv_menu.SelectedNode.Name.Substring(1)), seleccionados); }
private void trv_menu_AfterSelect(object sender, TreeViewEventArgs e) { this.lbl_item.Text = this.trv_menu.SelectedNode.FullPath; this.limpiarCheck(); List <int> roles = MenuTR.consultarPermisos(Convert.ToInt32(this.trv_menu.SelectedNode.Name.Substring(1))); if (roles != null) { foreach (int idRol in roles) { Object[] objeto = this.checkboxes.Find(element => Convert.ToInt32(element[0]) == idRol); CheckBox check = (CheckBox)objeto[1]; check.CheckedChanged -= check_CheckedChanged; check.Checked = true; check.CheckedChanged += check_CheckedChanged; } } this.hizoCambio = false; }
private void frm_permisoMenu_Load(object sender, EventArgs e) { //object menu = Activator.CreateInstance(null, "Pos.App.frm_menu"); //((Form)menu).Show(); this.trv_menu.AfterSelect -= trv_menu_AfterSelect; roles = new List <Rol>(); roles.Add(new Rol() { Idrol_usuario = 1, Nombre = "Administrador", Estado = true }); roles.Add(new Rol() { Idrol_usuario = 2, Nombre = "Cajero", Estado = true }); checkboxes = new List <object[]>(); int xInicial = 205; int yInicial = 38; foreach (Rol rol in this.roles) { CheckBox check = new CheckBox(); check.Name = rol.Nombre; check.Text = rol.Nombre; check.CheckedChanged += check_CheckedChanged; check.Location = new Point(xInicial, yInicial); yInicial += 22; this.Controls.Add(check); object[] objeto = new object[2]; objeto[0] = rol.Idrol_usuario; objeto[1] = check; this.checkboxes.Add(objeto); } List <ItemMenu> lista = MenuTR.consultarItems(); this.procesarMenu(0, null, lista); this.trv_menu.AfterSelect += trv_menu_AfterSelect; }