public int Inserta(DateTime pDatFecEntregaProg,DateTime pDatFecEntregaEfec,String pStrObservaciones,
            String pStrTipoEntrega,int pIntIdProveedor,int pIntIdMaterial, int pIntCantidad, int pIntIdProyecto)
        {
            int intResultado = -999;
            ObrasPublicasEntities objContext = new ObrasPublicasEntities();

            try{
                ProyectoInversion_DAL objProyectoInversion_DAL = new ProyectoInversion_DAL();
                ProyectoInversion objProyectoInversion =  objProyectoInversion_DAL.ObtieneXId(pIntIdProyecto);

                if (objProyectoInversion.IdEstado == ProyectoInversion.STR_ID_ESTADO_ADJUDICADO)
                {
                    intResultado = -998;
                }
                else
                {
                    OP_ENTREGA_MATERIAL objEntregaMaterial = new OP_ENTREGA_MATERIAL();
                    objEntregaMaterial.coMaterial = pIntIdMaterial;
                    objEntregaMaterial.coProveedor = pIntIdProveedor;
                    objEntregaMaterial.coProyecto = pIntIdProyecto;
                    objEntregaMaterial.feEntregaEfectiva = pDatFecEntregaEfec;
                    objEntregaMaterial.feEntregaProgramada = pDatFecEntregaProg;
                    objEntregaMaterial.noTipoEntrega = pStrTipoEntrega;
                    objEntregaMaterial.nuCantidad = pIntCantidad;
                    objEntregaMaterial.txObservaciones = pStrObservaciones;

                    objContext.AddToOP_ENTREGA_MATERIAL(objEntregaMaterial);
                    int intRows = objContext.SaveChanges();

                    if (intRows > 0)
                    {
                        intResultado = 1;
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.ToString().Contains("IX_op_proyecto_inversion_publica"))
                {
                    intResultado = -998;
                }
            }
            return intResultado;
        }
 /// <summary>
 /// Create a new OP_ENTREGA_MATERIAL object.
 /// </summary>
 /// <param name="coEntrega">Initial value of the coEntrega property.</param>
 /// <param name="coProveedor">Initial value of the coProveedor property.</param>
 /// <param name="coMaterial">Initial value of the coMaterial property.</param>
 public static OP_ENTREGA_MATERIAL CreateOP_ENTREGA_MATERIAL(global::System.Int32 coEntrega, global::System.Int32 coProveedor, global::System.Int32 coMaterial)
 {
     OP_ENTREGA_MATERIAL oP_ENTREGA_MATERIAL = new OP_ENTREGA_MATERIAL();
     oP_ENTREGA_MATERIAL.coEntrega = coEntrega;
     oP_ENTREGA_MATERIAL.coProveedor = coProveedor;
     oP_ENTREGA_MATERIAL.coMaterial = coMaterial;
     return oP_ENTREGA_MATERIAL;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the OP_ENTREGA_MATERIAL EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToOP_ENTREGA_MATERIAL(OP_ENTREGA_MATERIAL oP_ENTREGA_MATERIAL)
 {
     base.AddObject("OP_ENTREGA_MATERIAL", oP_ENTREGA_MATERIAL);
 }