public void cargarUsuario(string usuario, string roluser, Login.LogIn form) { user = usuario; log = form; rol = roluser; /*PREPARAR BOTONERA*/ this.Text = "Menu Principal: " + usuario; depositosToolStripMenuItem.Visible = false; tarjetasToolStripMenuItem.Visible = false; transferenciaToolStripMenuItem.Visible = false; listadosEstadisticosToolStripMenuItem.Visible = false; clienteToolStripMenuItem.Visible = false; cuentaToolStripMenuItem.Visible = false; rolToolStripMenuItem.Visible = false; usuarioToolStripMenuItem.Visible = false; facturarToolStripMenuItem.Visible = false; retiroToolStripMenuItem1.Visible = false; consultarSaldoToolStripMenuItem.Visible = false; aBMTipoDeCuentaToolStripMenuItem.Visible = false; Conexion con = new Conexion(); string query; query = "SELECT F.descripcion FROM LPP.FUNCIONALIDADXROL FR " + " JOIN LPP.FUNCIONALIDAD F ON F.id_funcionalidad = FR.funcionalidad " + " JOIN LPP.ROLES R ON R.id_rol = FR.rol " + " JOIN LPP.ROLESXUSUARIO RU ON RU.rol = R.id_rol " + " WHERE R.habilitado = 1 and RU.username = '******' AND r.nombre = '" + rol + "' " + " ORDER BY F.id_funcionalidad"; con.cnn.Open(); SqlCommand command = new SqlCommand(query, con.cnn); SqlDataReader lector1 = command.ExecuteReader(); bool entro = false; while (lector1.Read()) { entro = false; if (!entro) { if (lector1.GetString(0) == "Depositos") { entro = true; depositosToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "Consulta Saldos") { entro = true; consultarSaldoToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "Listados") { entro = true; listadosEstadisticosToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "Asociar/Desasociar Tarjetas") { entro = true; tarjetasToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "Transferencias") { entro = true; transferenciaToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "ABM Cliente") { entro = true; clienteToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "ABM Usuarios") { entro = true; usuarioToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "ABM Cuenta") { entro = true; cuentaToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "ABM Rol") { entro = true; rolToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "Facturar") { entro = true; facturarToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "Retiros") { entro = true; retiroToolStripMenuItem1.Visible = true; } } } con.cnn.Close(); }
public void cargarUsuario(string usuario, string roluser, Login.LogIn form) { user = usuario; log = form; rol = roluser; /*PREPARAR BOTONERA*/ this.Text = "Menu Principal: "+usuario; depositosToolStripMenuItem.Visible = false; tarjetasToolStripMenuItem.Visible = false; transferenciaToolStripMenuItem.Visible = false; listadosEstadisticosToolStripMenuItem.Visible = false; clienteToolStripMenuItem.Visible = false; cuentaToolStripMenuItem.Visible = false; rolToolStripMenuItem.Visible = false; usuarioToolStripMenuItem.Visible = false; facturarToolStripMenuItem.Visible = false; retiroToolStripMenuItem1.Visible = false; consultarSaldoToolStripMenuItem.Visible = false; aBMTipoDeCuentaToolStripMenuItem.Visible = false; Conexion con = new Conexion(); string query; query = "SELECT F.descripcion FROM LPP.FUNCIONALIDADXROL FR " +" JOIN LPP.FUNCIONALIDAD F ON F.id_funcionalidad = FR.funcionalidad " +" JOIN LPP.ROLES R ON R.id_rol = FR.rol " +" JOIN LPP.ROLESXUSUARIO RU ON RU.rol = R.id_rol " +" WHERE R.habilitado = 1 and RU.username = '******' AND r.nombre = '"+rol+"' " +" ORDER BY F.id_funcionalidad"; con.cnn.Open(); SqlCommand command = new SqlCommand(query, con.cnn); SqlDataReader lector1 = command.ExecuteReader(); bool entro = false; while (lector1.Read()) { entro = false; if (!entro) { if (lector1.GetString(0) == "Depositos") { entro = true; depositosToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "Consulta Saldos") { entro = true; consultarSaldoToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "Listados") { entro = true; listadosEstadisticosToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "Asociar/Desasociar Tarjetas") { entro = true; tarjetasToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "Transferencias") { entro = true; transferenciaToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "ABM Cliente") { entro = true; clienteToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "ABM Usuarios") { entro = true; usuarioToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "ABM Cuenta") { entro = true; cuentaToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "ABM Rol") { entro = true; rolToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "Facturar") { entro = true; facturarToolStripMenuItem.Visible = true; } } if (!entro) { if (lector1.GetString(0) == "Retiros") { entro = true; retiroToolStripMenuItem1.Visible = true; } } } con.cnn.Close(); }