protected void btnLoginNow_Click(object sender, EventArgs e) { if (Captcha.IsValid) { LogonControl.ShowOnPageLoad = false; } //Carga de controles Usuario = new SearchUsuario(this.ToString(), new HotelBooking.HotelBookingDataContext()); SCPV_Usuario_Empleados user = Usuario.VerficaUsuario2(txtEmail.Text.Trim(), txtPassword.Text.Trim()); Session["userCliente"] = user; visiblemenu(); }
public bool updateUsuario(SCPV_Usuario_Empleados user) { bool bandera = false; try { DataContext.SP_SCPV_Actualiza_Usuario(user.Usuario, user.Password, user.Estado); bandera = true; } catch (Exception) { throw; } return(bandera); }
public SCPV_Usuario_Empleados VerficaUsuario(string pEmail, string pPassword) { SCPV_Usuario_Empleados userCliente = null; try { userCliente = DataContext.SCPV_Usuario_Empleados.Where(p => p.Usuario == pEmail && p.Password == pPassword).FirstOrDefault(); if (userCliente == null) { throw new Exception("No existe el usuario"); } } catch (Exception) { throw; } return(userCliente); }
protected void grdListadoUsuarios_CustomCallback(object sender, DevExpress.Web.ASPxGridViewCustomCallbackEventArgs e) { try { if (e.Parameters == "Grabar") { SearchUsuario userGrabar = new SearchUsuario(this.ToString(), new HotelBooking.HotelBookingDataContext()); SCPV_Usuario_Empleados user = new SCPV_Usuario_Empleados(); user.Usuario = this.txtUsuario.Text; user.Password = this.txtPassword.Text; user.Estado = this.cmbEstado.Value.ToString(); user.ID_Empleado = int.Parse(this.cmbEmpleado.Value.ToString()); userGrabar.addUsuario(user); cargaInicialDatosUsuarios(); this.grdListadoUsuarios.JSProperties["cpGrabar"] = "OK"; } else if (e.Parameters == "Modificar") { SearchUsuario userGrabar = new SearchUsuario(this.ToString(), new HotelBooking.HotelBookingDataContext()); SCPV_Usuario_Empleados user = new SCPV_Usuario_Empleados(); user.Usuario = this.txtUsuario.Text; user.Password = this.txtPassword.Text; user.Estado = this.cmbEstado.Value.ToString(); userGrabar.updateUsuario(user); cargaInicialDatosUsuarios(); this.grdListadoUsuarios.JSProperties["cpModificar"] = "OK"; } } catch (Exception) { if (e.Parameters == "Grabar") { this.grdListadoUsuarios.JSProperties["cpGrabar"] = "ERROR"; } else if (e.Parameters == "Modificar") { this.grdListadoUsuarios.JSProperties["cpModificar"] = "ERROR"; } throw; } }
public SCPV_Usuario_Empleados VerficaUsuario2(string pEmail, string pPassword) { SCPV_Usuario_Empleados userClienteRetorno = null; SP_SCPV_Verifica_UsuarioResult userCliente = null; try { userCliente = DataContext.SP_SCPV_Verifica_Usuario(pEmail, pPassword).FirstOrDefault(); if (userCliente == null) { throw new Exception("No existe el usuario"); } else { userClienteRetorno = DataContext.SCPV_Usuario_Empleados.Where(p => p.Usuario == pEmail).FirstOrDefault(); } } catch (Exception) { throw; } return(userClienteRetorno); }