/// <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.BOLETA bol = bbdd.BOLETA.First(e => e.ID_BOLETA == ID_BOLETA); /* Se elimina el registro del EDM */ bbdd.BOLETA.Remove(bol); bbdd.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
//Agregar public bool Create() { Datos.FerreteriaFermeEntities bbdd = new Datos.FerreteriaFermeEntities(); Datos.BOLETA bol = new Datos.BOLETA(); try { CommonBC.Syncronize(this, bol); bbdd.BOLETA.Add(bol); bbdd.SaveChanges(); return(true); } catch (Exception ex) { bbdd.BOLETA.Remove(bol); return(false); } }
/// <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.BOLETA bol = bbdd.BOLETA.First(e => e.ID_BOLETA == ID_BOLETA); /* Se copian las propiedades del negocio a los datos */ CommonBC.Syncronize(this, bol); 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.BOLETA bol = bbdd.BOLETA.First(e => e.ID_BOLETA == ID_BOLETA); /* Se copian las propiedades de datos al negocio */ CommonBC.Syncronize(bol, this); /* Carga descripción de los Tipos */ LeerNombreMedio(); return(true); } catch (Exception ex) { return(false); } }