public void Cambiar_Estado(Supervisor user) { string estado; if (user.Estado == "OnLine") estado = "OffLine"; else estado = "OnLine"; query.Send_Process("update TSupervisor set su_estado='" + estado + "' where su_login='******'"); }
public bool Autentificar(Supervisor us) { DataTable dt = new DataTable(); dt = query.Search_Data("Select * from TSupervisor where su_login='******' and su_password='******'"); if (dt.Rows.Count == 1) return true; else return false; }
protected void Page_Load(object sender, EventArgs e) { if ((Supervisor)Session["Online_user"] != null) { usu_log.Visible = true; HeadLoginView.Visible = false; usu_Master = (Supervisor)Session["Online_user"]; usu_log.Text = "Bienvenido, "+usu_Master.Nombre+" "+usu_Master.Ape_pa; bot_logout.Visible = true; } }
public Supervisor Loguear_user(string nick) { DataTable dt = new DataTable(); Supervisor user = new Supervisor(); dt = query.Search_Data("Select * from TSupervisor where su_login='******'"); user.Id = dt.Rows[0]["idsupervisor"].ToString(); user.User = dt.Rows[0]["su_login"].ToString(); user.Nombre = dt.Rows[0]["su_nombre"].ToString(); user.Ape_pa = dt.Rows[0]["su_apePat"].ToString(); user.Ape_ma = dt.Rows[0]["su_apeMat"].ToString(); user.Idtipousuario = dt.Rows[0]["idtipoUsuario"].ToString(); user.Estado = dt.Rows[0]["su_estado"].ToString(); return user; }
protected void login_user_Authenticate(object sender, AuthenticateEventArgs e) { Supervisor us = new Supervisor(); us.User = LoginUser.UserName; us.Pass = LoginUser.Password; if (us_pro.Autentificar(us)) { if (!us_pro.VeriOnline(us.User)) { us = us_pro.Loguear_user(us.User); //Page.Session.Add("Detalles", false); if (us.Idtipousuario== "1") { us_pro.Cambiar_Estado(us); us.Estado = "OnLine"; Page.Session.Add("Online_user", us); //Page.Session.Add("UsuarioB", us.nombre); //e.Authenticated = true; //LoginUser.Page.Validate("LoginUserValidationGroup"); //LoginUser.Page.Session.Add("Usu", us); //bool asd = LoginUser.Page.Request.IsAuthenticated; //bool sdgfg = asd; //e.Authenticated = true; //LoginStatus asd = new LoginStatus(); //asd = Request.IsAuthenticated; //LoginUser.Page.Session.Add("on", us); Response.Redirect("../Home_Supervisor.aspx"); } else { Page.Session.Add("LoginError","El Tipo de Usuario no esta Disponible"); } } else Page.Session.Add("LoginError","El usuario ya se encuentra conectado"); } else Page.Session.Add("LoginError","Usuario o contraseña incorrecta, vuelva a intentarlo"); }