public bool Update()
        {
            try
            {
                Datos.ORDEN_COMPRA orden_compra = Conexion.ModeloEntities.ORDEN_COMPRA.First(em => em.ID == ID);
                orden_compra.ID         = ID;
                orden_compra.DETALLE    = DETALLE;
                orden_compra.EMPRESA_ID = EMPRESA_ID;
                orden_compra.CREADOR_ID = CREADOR_ID;

                Conexion.ModeloEntities.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Read()
        {
            try
            {
                Datos.ORDEN_COMPRA orden_compra = Conexion.ModeloEntities.ORDEN_COMPRA.First(em => em.ID == ID);
                ID         = orden_compra.ID;
                DETALLE    = orden_compra.DETALLE;
                EMPRESA_ID = orden_compra.EMPRESA_ID;
                CREADOR_ID = orden_compra.CREADOR_ID;


                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
 public bool Create()
 {
     try
     {
         Datos.ORDEN_COMPRA orden_compra = new Datos.ORDEN_COMPRA()
         {
             ID         = ID,
             DETALLE    = DETALLE,
             EMPRESA_ID = EMPRESA_ID,
             CREADOR_ID = CREADOR_ID
         };
         Conexion.ModeloEntities.ORDEN_COMPRA.Add(orden_compra);
         Conexion.ModeloEntities.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
        //Agregar
        public bool Create()
        {
            Datos.FerreteriaFermeEntities bbdd = new Datos.FerreteriaFermeEntities();

            Datos.ORDEN_COMPRA orc = new Datos.ORDEN_COMPRA();

            try
            {
                CommonBC.Syncronize(this, orc);

                bbdd.ORDEN_COMPRA.Add(orc);
                bbdd.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                bbdd.ORDEN_COMPRA.Remove(orc);
                return(false);
            }
        }
        /// <summary>
        /// Elimina un registro de proveedor 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.ORDEN_COMPRA orc = bbdd.ORDEN_COMPRA.First(e => e.ID_COMPRA == ID_COMPRA);

                /* Se elimina el registro del EDM */
                bbdd.ORDEN_COMPRA.Remove(orc);

                bbdd.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        /// <summary>
        /// Actualiza un registro de proveedor 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.ORDEN_COMPRA orc = bbdd.ORDEN_COMPRA.First(e => e.ID_COMPRA == ID_COMPRA);

                /* Se copian las propiedades del negocio a los datos */
                CommonBC.Syncronize(this, orc);

                bbdd.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        /// <summary>
        /// Lee un registro de proveedor 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.ORDEN_COMPRA orc = bbdd.ORDEN_COMPRA.First(e => e.ID_COMPRA == ID_COMPRA);

                /* Se copian las propiedades de datos al negocio */
                CommonBC.Syncronize(orc, this);

                /* Carga descripción de los Tipos */
                LeerNombreEmpleado();
                LeerNombreEnvio();
                LeerNombreTipo();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }