public bool Eliminar() { try { ACCESO ac = CommonBC.DBConexion.ACCESO.Find(ID); CommonBC.DBConexion.ACCESO.Remove(ac); CommonBC.DBConexion.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool ActualizarPreguntaRespuesta() { try { ACCESO ac = CommonBC.DBConexion.ACCESO.First(b => b.USUARIO_ID == this.UsuarioId); ac.PREGUNTA = this.Pregunta; ac.RESPUESTA = this.Respuesta; CommonBC.DBConexion.Entry(ac).State = System.Data.EntityState.Modified; CommonBC.DBConexion.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool ObtenerPreguntas() { try { ACCESO a = CommonBC.DBConexion.ACCESO.First(b => b.USUARIO.ToLower().Equals(this.Usuario.ToLower())); this.ID = (int)a.ID; this.Clave = a.CLAVE; this.Pregunta = a.PREGUNTA; this.Respuesta = a.RESPUESTA; this.UsuarioId = (int)a.USUARIO_ID; return(true); } catch (Exception) { return(false); } }
public bool Leer() { try { ACCESO ac = CommonBC.DBConexion.ACCESO.Find(this.ID); this.Usuario = ac.USUARIO; this.Clave = ac.CLAVE; this.Pregunta = ac.PREGUNTA; this.Respuesta = ac.RESPUESTA; return(true); } catch (Exception) { return(false); } }
public bool ObtenerDatosAccesoProveedor(int id) { try { ACCESO a = CommonBC.DBConexion.ACCESO.First(b => b.PROVEEDOR_ID == id); this.ID = (int)a.ID; this.Usuario = a.USUARIO; this.Clave = a.CLAVE; this.Pregunta = a.PREGUNTA; this.ProveedorId = (int)a.PROVEEDOR_ID; return(true); } catch (Exception) { return(false); } }
public bool Agregar() { try { Datos.ACCESO ac = new ACCESO(); ac.ID = this.ID; ac.USUARIO = this.Usuario; ac.CLAVE = this.Clave; ac.PREGUNTA = this.Pregunta; ac.RESPUESTA = this.Respuesta; ac.USUARIO_ID = this.UsuarioId; ac.PROVEEDOR_ID = this.ProveedorId; CommonBC.DBConexion.ACCESO.Add(ac); CommonBC.DBConexion.SaveChanges(); return(true); } catch (Exception) { return(false); } }