private void btnAceptar_Click(object sender, EventArgs e) { if (DirectorioActivo.Autenticar(Common.Common.Dominio, txtUser.Text.ToString(), txtPwd.Text.ToString(), DBMETAL_SHARP.Common.Common.path)) { List <Entidades.Ent_Usuario> user = ConsultaEntidades.ObtenerUsuarioPorRoles("GetUserForRoles", txtUser.Text.ToString().Trim()); if (user != null && user.Count() > 0) { Common.Common.User = user; Common.Common.Permissions = ConsultaEntidades.GetPermisosRoles("SPGet_RolesForUser", txtUser.Text.ToString().Trim(), "frmPpal"); if (Common.Common.Permissions.Count > 0) { frmSplash oSplash = new frmSplash(); oSplash.Show(); this.Hide(); } else { MessageBox.Show("Usuario no posee permisos para este módulo", "DBMetal", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Usuario no activo en directorio activo", "DBMetal", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Usuario no registrado en DBMetal", "DBMetal", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnAceptar_Click(object sender, EventArgs e) { try { if (DirectorioActivo.Autenticar(this.domain, txtUser.Text.ToString(), txtPwd.Text.ToString(), this.activeDirectoryUlr)) { clsRf.cConnection = this.conn; var value = oRf.getUsersGeneric(txtUser.Text.ToString()); if (value.ToList().Count > 0) { if (value.Select(c => c.activo_User).Count() == 0) { MessageBox.Show("Disabled User", "Shipment", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (value.Where(r => r.id_Grupo.Equals(3) && r.activo_User).Count() > 0) { if (value.Select(c => c.login_User.ToString().ToUpper()).FirstOrDefault().ToString().ToUpper() == txtUser.Text.ToString().ToUpper()) { clsRf.sUser = txtUser.Text.ToString(); clsRf.sIdentification = value.Select(c => c.id_User).FirstOrDefault().ToString(); clsRf.sIdGrupo = value.Select(c => c.idGrupo_User).FirstOrDefault().ToString(); var intercept = value.Where(s => s.id_Grupo.Equals(22) && s.activo_User); if (intercept.Count() > 0) { clsRf.valueIntercpt = true; } var IsAuditor = value.Where(s => s.nombre_Grupo.Equals("Auditor") && s.activo_User); frm_Intercept_Intervals oPpal = new frm_Intercept_Intervals(clsRf.sUser); if (IsAuditor.Count() > 0) { oPpal.IsAuditor = true; } oPpal.Show(); this.Hide(); } else { MessageBox.Show("user without privileges", "Shipment", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { if (value.Where(r => r.id_Grupo.Equals(22) && r.activo_User).Count() > 0) { if (value.Where(r => r.id_Grupo.Equals(22)).Select(c => c.login_User.ToString().ToUpper()).FirstOrDefault().ToString().ToUpper() == txtUser.Text.ToString().ToUpper()) { clsRf.valueIntercpt = true; clsRf.sUser = txtUser.Text.ToString(); frmSplash oSplash = new frmSplash(); oSplash.Show(); this.Hide(); } else { MessageBox.Show("user without privileges", "Shipment", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { if (value.Where(r => r.id_Grupo.Equals(7) && r.activo_User).Count() > 0) { if (value.Where(r => r.id_Grupo.Equals(7)).Select(c => c.login_User.ToString().ToUpper()).FirstOrDefault().ToString().ToUpper() == txtUser.Text.ToString().ToUpper()) { clsRf.valueTopografish = true; clsRf.sUser = txtUser.Text.ToString(); frmSplash oSplash = new frmSplash(); oSplash.Show(); this.Hide(); } } else { MessageBox.Show("user without privileges in group", "Shipment", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } } else { MessageBox.Show("User not active in Active Directory", "Shipment", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } catch (Exception ex) { throw new Exception("Error: " + ex.Message); } }