/// <summary> /// Actualiza un registro de cargo en la BBDD /// </summary> /// <returns></returns> public bool Update() { Datos.FerreteriaFermeEntities bbdd = new Datos.FerreteriaFermeEntities(); try { /* Se obtiene el primer registro coincidente con el id */ Datos.COMPRA_PROVEEDOR cop = bbdd.COMPRA_PROVEEDOR.First(e => e.ID_COMPRA == ID_COMPRA); /* Se copian las propiedades del negocio a los datos */ CommonBC.Syncronize(this, cop); bbdd.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
//Agregar public bool Create() { Datos.FerreteriaFermeEntities bbdd = new Datos.FerreteriaFermeEntities(); Datos.COMPRA_PROVEEDOR cop = new Datos.COMPRA_PROVEEDOR(); try { CommonBC.Syncronize(this, cop); bbdd.COMPRA_PROVEEDOR.Add(cop); bbdd.SaveChanges(); return(true); } catch (Exception ex) { bbdd.COMPRA_PROVEEDOR.Remove(cop); return(false); } }
/// <summary> /// Elimina un registro de producto en la BBDD /// </summary> /// <returns></returns> public bool Delete() { Datos.FerreteriaFermeEntities bbdd = new Datos.FerreteriaFermeEntities(); try { /* Se obtiene el primer registro coincidente con el id */ Datos.COMPRA_PROVEEDOR cop = bbdd.COMPRA_PROVEEDOR.First(e => e.ID_COMPRA == ID_COMPRA); /* Se elimina el registro del EDM */ bbdd.COMPRA_PROVEEDOR.Remove(cop); bbdd.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
/// <summary> /// Lee un registro de cargi en la BBDD /// </summary> /// <returns></returns> public bool Read() { Datos.FerreteriaFermeEntities bbdd = new Datos.FerreteriaFermeEntities(); try { /* Se obtiene el primer registro coincidente con el id */ Datos.COMPRA_PROVEEDOR cop = bbdd.COMPRA_PROVEEDOR.First(e => e.ID_COMPRA == ID_COMPRA); /* Se copian las propiedades de datos al negocio */ CommonBC.Syncronize(cop, this); /* Carga descripción de los Tipos */ LeerNombreProveedor(); return(true); } catch (Exception ex) { return(false); } }