private void frmPrincipal_Load(object sender, EventArgs e) { IBLLSysUserRolDTO _BLLUser = new BLLSysUserRolDTO(); try { this.Text = Application.ProductName + " Versión: " + Application.ProductVersion; Utilitarios.CultureInfo(); toolStripStatusLblMensaje.Text = "Usuario Conectado: " + Settings.Default.User; foreach (var item in _BLLUser.GetSysUserByFilter(Settings.Default.User)) { if (item.IdRol == 1) { MessageBox.Show("Usuario Administrador"); } if (item.IdRol == 2) { MessageBox.Show("Usuario para uso de procesos"); this.toolStripMenuItemMantenimientos.Enabled = false; this.administracionToolStripMenuItem.Enabled = false; this.reportesToolStripMenuItemReportes.Enabled = false; } if (item.IdRol == 3) { MessageBox.Show("Usuario para uso de reportes"); this.toolStripMenuItemMantenimientos.Enabled = false; this.administracionToolStripMenuItem.Enabled = false; this.reportesToolStripMenuItemReportes.Enabled = true; this.toolStripMenuItemProcesos.Enabled = false; } } if (!Directory.Exists(@"C:\temp")) { Directory.CreateDirectory(@"C:\temp"); } _MyLogControlEventos.InfoFormat("Conectado a Form Principal"); // Seguridad(); } catch (Exception er) { StringBuilder msg = new StringBuilder(); msg.AppendFormat("Message {0}\n", er.Message); msg.AppendFormat("Source {0}\n", er.Source); msg.AppendFormat("InnerException {0}\n", er.InnerException); msg.AppendFormat("StackTrace {0}\n", er.StackTrace); msg.AppendFormat("TargetSite {0}\n", er.TargetSite); // Log error _MyLogControlEventos.ErrorFormat("Error {0}", msg.ToString()); // Mensaje de Error MessageBox.Show("Se ha producido el siguiente error " + er.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }