protected void Page_Load(object sender, EventArgs e) { vehiculoCtrl = new VehiculoController(); homeCtrl = new HomeController(); if (!IsPostBack) { if (!SitePrincipal.IsIntruso()) { if (SitePrincipal.ExisteActiva()) { placa = Request.QueryString["placa"]; if (!String.IsNullOrEmpty(placa)) { var nplaca = vehiculoCtrl.listar(placa); lblanio.Text = nplaca.Año.Value.ToString(); lblchasis.Text = nplaca.NroChasis; lblfechareg.Text = nplaca.FechaReg.ToString(); lblmodelo.Text = nplaca.Modelo; lblmotor.Text = nplaca.NroMotor; lblplaca.Text = nplaca.NroPlaca; lblusuarioreg.Text = nplaca.UsuaReg; } else { Response.Redirect("~/Vistas/Vehiculos/Index"); } } else { SitePrincipal.pagRedireccion = "~/Vistas/Vehiculos/Create"; Response.Redirect("~/Vistas/Empresas/Panel"); } } } }
public static string CargarConductores() { string result = String.Empty; VehiculoController vehiculoCtrl = new VehiculoController(); List <PersonaCboDet> lista = new List <PersonaCboDet>(); if (SitePrincipal.ExisteActiva()) { HomeController homeCtrl = new HomeController(); var user = HttpContext.Current.User.Identity.Name; var nit = homeCtrl.obtenerNit(user); // si esta dentro de una empresas lista = vehiculoCtrl.GetNotPersCondX(nit);// result = JsonConvert.SerializeObject(lista, Formatting.Indented); } else { if (HttpContext.Current.User.IsInRole("SA")) { ///si es super administrador debera traer todos los conductores de las empresas lista = vehiculoCtrl.GetNotPersCondX(); result = JsonConvert.SerializeObject(lista, Formatting.Indented); } } //lista = vehiculoCtrl.GetNotPersCond(); //result = JsonConvert.SerializeObject(lista, Formatting.Indented); return(result); }
protected void Page_Load(object sender, EventArgs e) { if (SitePrincipal.IsIntruso()) { Response.Redirect("~/Account/Login"); } }
private void Application_AuthenticateRequest(object sender, EventArgs e) { string authCookieName = FormsAuthentication.FormsCookieName; HttpCookie authCookie = Context.Request.Cookies[authCookieName]; if (authCookie != null) { FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value); if (authTicket == null) { throw new Exception("Authentication cookie failed to decrypt."); } else { int userID = int.Parse(authTicket.Name); User currentUser = new User(); currentUser.UserID = userID; string[] userData = authTicket.UserData.Split('|'); SitePrincipal thisPrincipal = new SitePrincipal(new SiteIdentity(currentUser, currentUser.GetRoles(), currentUser.GetPermissions())); currentUser.UserID = userID; currentUser.FirstName = userData[1]; currentUser.LastName = userData[2]; currentUser.EmailAddress = userData[3]; currentUser.RegionID = int.Parse(userData[4]); Context.User = thisPrincipal; } } else if (blnJumpLogin) { JumpLogin(); } }
protected void Page_Load(object sender, EventArgs e) { seguimientoCtrl = new SeguimientoController(); if (!IsPostBack) { if (!SitePrincipal.IsIntruso()) { if (SitePrincipal.ExisteActiva()) { id = Request.QueryString["id"]; var se = seguimientoCtrl.listar(id); lblid.Text = se.CodSeguimiento.ToString(); lblestado.Text = (se.estado.Value) ? "Activo" : "Inactivo"; lblfechai.Text = se.FechaInicio.ToString(); lblfechaf.Text = se.FechaFin.ToString(); lblgps.Text = se.IMEI.ToString(); lblplaca.Text = se.NroPlaca.ToString(); } else { SitePrincipal.pagRedireccion = "~/Vistas/Seguimiento/Index"; SitePrincipal.countRedireccion = 0; Response.Redirect("~/Vistas/Empresas/Panel"); } } else { Response.Redirect("~/Account/Login"); } } }
protected void Page_Load(object sender, EventArgs e) { homeCtrl = new HomeController(); pc = new PersonaController(); rolCtrl = new RolController(); if (!IsPostBack) { if (!SitePrincipal.IsIntruso()) { if (SitePrincipal.ExisteActiva()) { cargarTipoPersona(); CargarRoles(); } else { SitePrincipal.pagRedireccion = "~/Vistas/Personas/Create"; SitePrincipal.countRedireccion = 0; Response.Redirect("~/Vistas/Empresas/Panel"); } } else { Response.Redirect("~/Account/Login"); } } }
public bool LogIn(string userName, string password, bool rememberMe) { var user = _userRepository.GetByEmail(userName); if (user != null) { string truePassword = Cryptography.Decrypt(user.Password, AppConstants.SECRET_CODE); if (truePassword == password) { FormsAuthentication.SetAuthCookie(userName, rememberMe); var logoninfo = new LogonInfo() { DateLogin = DateTime.Now, Email = user.Email, Id = user.UID, FullName = user.Name }; var principal = new SitePrincipal(logoninfo); HttpContext.Current.User = principal; return(true); } } return(false); }
/// <summary> /// Single Sign On /// </summary> protected void SingleSignOne() { if (this.IsValidSSOServer()) { SitePrincipal newUser = null; if (PageUtility.GetAppConfig("SSO.Request.OnlyID").ToUpper() == "Y") { newUser = SitePrincipal.ValidateLogin(this._LOGIN_ID); } else { newUser = SitePrincipal.ValidateLogin(this._LOGIN_ID, this._PASSWORD); } if (newUser != null) { FormsAuthentication.RedirectFromLoginPage(this._LOGIN_ID, false); Response.Redirect("Main.aspx"); } } if (PageUtility.GetAppConfig("SSO").ToUpper() == "E") { string sURL = ConfigurationManager.AppSettings["SSO.MainPage"].ToString(); Response.Redirect(sURL); } }
public static string getDatos(string data = "") { string result = String.Empty; UsuarioController gpusuariosCtrl = new UsuarioController(); HomeController homeCtrl = new HomeController(); List <ListarAbmUsuario> lista = new List <ListarAbmUsuario>(); if (SitePrincipal.ExisteActiva()) { var userName = HttpContext.Current.User.Identity.Name; var nit = homeCtrl.obtenerNit(userName); lista = gpusuariosCtrl.ListarUsuarioPorEmpresa(nit); } else { if (HttpContext.Current.User.IsInRole("SA")) { lista = gpusuariosCtrl.GetAllSA(); } } result = JsonConvert.SerializeObject(lista, Formatting.Indented); return(result); }
public static string getDatos(string data = "") { string result = String.Empty; SeguimientoController segCtrl = new SeguimientoController(); HomeController homeCtrl = new HomeController(); ////List<ListarAbmAsignacionSeguimiento> lista = new List<ListarAbmAsignacionSeguimiento>(); List <clsSeguimiento> lista = new List <clsSeguimiento>(); if (SitePrincipal.ExisteActiva()) { var userName = HttpContext.Current.User.Identity.Name; var nit = homeCtrl.obtenerNit(userName); lista = segCtrl.listarAsignacionSeguimiento(nit); } else { if (HttpContext.Current.User.IsInRole("SA")) { lista = segCtrl.ListarAsignacionSeguimientoSA(); } } result = JsonConvert.SerializeObject(lista, Formatting.Indented); return(result); }
protected void Page_Load(object sender, EventArgs e) { gpsCtrl = new GpsController(); vehiculoCtrl = new VehiculoController(); seguimientoCtrl = new SeguimientoController(); homeCtrl = new HomeController(); if (!SitePrincipal.IsIntruso()) { ListarIMEI(); ListarPlaca(); id = Request.QueryString["id"]; var seg = seguimientoCtrl.listar(id); txtid.Text = seg.CodSeguimiento.ToString(); txtFechaI.Text = seg.FechaInicio.ToShortDateString().ToString(); chkestado.Checked = seg.estado.Value; cboplaca.SelectedValue = seg.NroPlaca; cboimei.SelectedValue = seg.IMEI; } else { Response.Redirect("~/Account/Login"); } }
protected void Page_Load(object sender, EventArgs e) { personaCtrl = new PersonaController(); vehiculoCtrl = new VehiculoController(); homeCtrl = new HomeController(); if (!IsPostBack) { if (!SitePrincipal.IsIntruso()) { if (SitePrincipal.ExisteActiva()) { CargarComboUsuario(); CargarGrillaVehiculo(); } else { SitePrincipal.pagRedireccion = "~/Vistas/Usuarios/AsignarVehiculo"; SitePrincipal.countRedireccion = 0; Response.Redirect("~/Vistas/Empresas/Panel"); } } else { Response.Redirect("~/Account/Login"); } } }
protected void Page_Load(object sender, EventArgs e) { zonasCtrl = new ZonasController(); if (!IsPostBack) { if (!SitePrincipal.IsIntruso()) { if (SitePrincipal.ExisteActiva()) { id = Request.QueryString["id"]; if (!String.IsNullOrEmpty(id)) { lblcodigoGeo.Text = id; var rg = zonasCtrl.obtenerGeocerca(id); lbldescripcion.Text = rg.Descripcion.ToString(); lblcolorlim.Text = rg.ColorLimite.ToString(); lblcolorrelleno.Text = rg.ColorRelleno.ToString(); lblzona.Text = rg.TipoGeocerca.Descripcion.ToString(); } else { Response.Redirect("~/Vistas/Geocercas/Index"); } } } else { Response.Redirect("~/Account/Login"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!SitePrincipal.IsIntruso()) { if (SitePrincipal.ExisteActiva()) { // listarEmpresa(); string imei = Request.QueryString["cod"]; string funct = "javascript:getEdit(" + imei + ");"; ClientScript.RegisterStartupScript(GetType(), "JavaScript", funct, true); } else { Response.Redirect("~/Vistas/Empresas/Panel"); } } else { this.Session.Remove("AllBehaviorsDS"); Response.Redirect("~/Account/Login"); } } }
public static string CargarGestionPersona() { string result = String.Empty; HomeController homeCtrl = new HomeController(); PersonaController personaCtrl = new PersonaController(); var user = HttpContext.Current.User.Identity.Name; var nit = homeCtrl.obtenerNit(user); List <ListarAbmPersona> lista = new List <ListarAbmPersona>(); if (SitePrincipal.ExisteActiva()) { //Cargar todos los datos de personas filtradas por el NIT var detalle_persona_empresa = personaCtrl.ListarPersonalPorEmpresa(nit); var filtardetalle = personaCtrl.ListarSoloPersonalSA(); var detalle_persona_empresault = detalle_persona_empresa.Where(a => !filtardetalle.Select(b => b.CI).Contains(a.CI)); lista = detalle_persona_empresault.ToList(); result = JsonConvert.SerializeObject(lista, Formatting.Indented); } else { if (HttpContext.Current.User.IsInRole("SA")) { var detalle_persona = personaCtrl.GetAllSA(); lista = detalle_persona.ToList(); result = JsonConvert.SerializeObject(lista, Formatting.Indented); } } return(result); }
private void ListarGeocercaxEmpresa(string nombre) { var user = HttpContext.Current.User.Identity.Name; var nit = homeCtrl.obtenerNit(user); if (SitePrincipal.ExisteActiva()) { var result = zonasCtrl.ListarGeocerca(nit); if (!String.IsNullOrEmpty(nombre)) { result = result.Where(s => s.Descripcion.Contains(nombre)).ToList(); } gdvGeocerca.DataSource = result; gdvGeocerca.DataBind(); } else { if (User.IsInRole("SA")) { var result1 = zonasCtrl.ListarGeocercaSA(); if (!String.IsNullOrEmpty(nombre)) { result1 = result1.Where(s => s.Descripcion.Contains(nombre)).ToList(); } gdvGeocerca.DataSource = result1; gdvGeocerca.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { gpsCtrl = new GpsController(); empresaCtrl = new EmpresaController(); if (!IsPostBack) { if (!SitePrincipal.IsIntruso()) { imei = Request.QueryString["imei"]; if (!String.IsNullOrEmpty(imei)) { lblimei.Text = imei; GPS g = gpsCtrl.listar(imei); lblid.Text = g.ID; lblmodelo.Text = g.Modelo; lbltelefono.Text = g.NroTelefono.ToString(); lblusuarioreg.Text = g.UsuaReg.ToString(); lblfechareg.Text = g.FechaReg.ToString(); } else { Response.Redirect("~/Vistas/GPSs/Index"); } } else { Response.Redirect("~/Account/Login"); } } }
protected void Page_Load(object sender, EventArgs e) { seguimientoCtrl = new SeguimientoController(); homeCtrl = new HomeController(); if (!IsPostBack) { if (!SitePrincipal.IsIntruso()) { if (!SitePrincipal.ExisteActiva()) { SitePrincipal.pagRedireccion = "~/Vistas/GPSs/Create"; Response.Redirect("~/Vistas/Empresas/Panel"); } else { ListarIMEI(); ListarPlaca(); chkestado.Checked = true; } } else { Response.Redirect("~/Account/Login"); } } }
public static string getDatos(string data = "") { string result = String.Empty; AsignarConductorController gpsCtrl = new AsignarConductorController(); HomeController homeCtrl = new HomeController(); List <ConductorAsiganadoDet> lista = new List <ConductorAsiganadoDet>(); if (SitePrincipal.ExisteActiva()) { var userName = HttpContext.Current.User.Identity.Name; var nit = homeCtrl.obtenerNit(userName); lista = gpsCtrl.getlistaAsignados(nit, 1); } else { if (HttpContext.Current.User.IsInRole("SA")) { lista = gpsCtrl.getlistaAsignados("", 0); } } result = JsonConvert.SerializeObject(lista, Formatting.Indented); return(result); }
public static string getDatos(string data = "") { string result = String.Empty; AlarmaController alarmaCtrl = new AlarmaController(); HomeController homeCtrl = new HomeController(); List <AlarmaDetalle> lista = new List <AlarmaDetalle>(); if (SitePrincipal.ExisteActiva()) { var userName = HttpContext.Current.User.Identity.Name; var nit = homeCtrl.obtenerNit(userName); lista = alarmaCtrl.GetAll(nit); } else { if (HttpContext.Current.User.IsInRole("SA")) { lista = alarmaCtrl.GetAll(); } } result = JsonConvert.SerializeObject(lista, Formatting.Indented); return(result); }
protected void Page_Load(object sender, EventArgs e) { cx = new VehiculoController(); homerCtrl = new HomeController(); if (!IsPostBack) { if (!SitePrincipal.IsIntruso()) { if (SitePrincipal.ExisteActiva()) { cargarMarca(); cargarTipoVehiculo(); } else { SitePrincipal.pagRedireccion = "~/Vistas/Vehiculos/Create"; Response.Redirect("~/Vistas/Empresas/Panel"); } } else { Response.Redirect("~/Account/Login"); } } }
public void RolesTest() { // Test to see if we can get the roles for a user SitePrincipal principal = new SitePrincipal("SecureNameSpace",1); ArrayList roles = principal.Roles; Assert.IsTrue(roles.Count==4,"Role count is wrong"); }
protected void Page_Load(object sender, EventArgs e) { privilegioCtrl = new PrivilegioController(); if (SitePrincipal.IsIntruso()) { Response.Redirect("~/Account/Login"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (SitePrincipal.IsIntruso()) { MensajeAlerta("ok"); Response.Redirect("~/Account/Login"); } } }
protected void Page_Load(object sender, EventArgs e) { homeCtrl = new HomeController(); personaCtrl = new PersonaController(); if (!IsPostBack) { if (!SitePrincipal.IsIntruso()) { if (SitePrincipal.ExisteActiva()) { ci = Request.QueryString["ci"]; if (!String.IsNullOrEmpty(ci)) { lblCi.Text = ci; Persona p = personaCtrl.listar(ci); if (p.Estado) { lblnombre.Text = p.Nombre; lblapellidop.Text = p.ApellidoP; lblapellidom.Text = p.ApellidoM; lbldireccion.Text = p.Direccion; lbltelefono.Text = p.Telefono; lblemail.Text = p.Email; lblcontacto.Text = p.Contacto; lbltelefonoc.Text = p.TelfContacto; lbllicencia.Text = p.CategoriaL; } else { MensajeAlerta("El personal ya ha sido dado de baja"); Response.Redirect("~/Vistas/Personas/Index"); } } else { Response.Redirect("~/Vistas/Personas/Index"); } } else { SitePrincipal.pagRedireccion = "~/Vistas/Personas/Index"; SitePrincipal.countRedireccion = 0; Response.Redirect("~/Vistas/Empresas/Panel"); } } else { Response.Redirect("~/Account/Login"); } } }
protected void Page_Load(object sender, EventArgs e) { rolCtrl = new RolController(); if (!SitePrincipal.IsIntruso()) { CargarNiveles(); } else { Response.Redirect("~/Account/Login"); } }
protected void Application_AuthenticateRequest(object sender, EventArgs e) { HttpApplication app = (HttpApplication)sender; if (app.Request.IsAuthenticated && Context.User.Identity.IsAuthenticated) { if (Context.User == null) { SitePrincipal newUser = new SitePrincipal(Convert.ToInt32(Context.User.Identity.Name)); Context.User = newUser; } } }
protected void Page_Load(object sender, EventArgs e) { homeCtrl = new HomeController(); zonasCtrl = new ZonasController(); if (!IsPostBack) { if (SitePrincipal.IsIntruso()) { Response.Redirect("~/Account/Login"); } } }
protected void Page_Load(object sender, EventArgs e) { vehiculoCtrl = new VehiculoController(); empresaCtrl = new EmpresaController(); if (!IsPostBack) { if (!SitePrincipal.IsIntruso()) { placa = Request.QueryString["placa"]; if (!String.IsNullOrEmpty(placa)) { var ve = vehiculoCtrl.listar(placa); lblplaca.Text = ve.NroPlaca; lblanio.Text = ve.Año.ToString(); lblpatente.Text = ve.Patente.ToString(); lblchasis.Text = ve.NroChasis.ToString(); lblfechareg.Text = ve.FechaReg.ToShortDateString(); lblmodelo.Text = ve.Modelo; lblmotor.Text = ve.NroMotor; lblusuarioreg.Text = ve.UsuaReg; //string idempresa = ve.idempresa; //if (!String.IsNullOrEmpty(idempresa)) //{ // var empresa = empresaCtrl.listar(idempresa); // lblnite.Text = empresa.NIT; // lblrazonse.Text = empresa.RazonSocial; // lblemaile.Text = empresa.email; //} string nroplaca = ve.NroPlaca; if (!String.IsNullOrEmpty(nroplaca)) { //var empresa = empresaCtrl.listar(idempresa); var empresa = empresaCtrl.getEmpresaXNroPlaca(nroplaca); lblnite.Text = empresa.NIT; lblrazonse.Text = empresa.RazonSocial; lblemaile.Text = empresa.email; } } else { Response.Redirect("~/Vistas/Vehiculos/Index"); } } else { Response.Redirect("~/Account/Login"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!SitePrincipal.IsIntruso()) { CargarGestionVehiculo(); } else { Response.Redirect("~/Account/Login"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!SitePrincipal.IsIntruso()) { // listarEmpresa(); } else { this.Session.Remove("AllBehaviorsDS"); Response.Redirect("~/Account/Login"); } } }
public void LoadUserTest() { // Using the SitePricipal load a user and verify the roles are loaded SitePrincipal principal = new SitePrincipal("SecureNameSpace",1); Assert.IsTrue(principal.Roles.Count==4,"The number of roles for user 1 is wrong"); }
public void IsInRoleTest() { // Test to see if user is in a given role SitePrincipal principal = new SitePrincipal("SecureNameSpace",1); Assert.IsTrue(principal.IsInRole("1"),"Role not found"); }