Ejemplo n.º 1
0
 public void modificarOcanmat(MODELO.oCanmatVenta oOccantmatVenta)
 {
     oMODELO_SEGURIDAD.Entry(oOccantmatVenta).State = System.Data.Entity.EntityState.Modified;
     oMODELO_SEGURIDAD.SaveChanges();
 }
Ejemplo n.º 2
0
        private void btnAGREGAR_Click(object sender, EventArgs e)
        {
            if (dgvOCM.Rows.Count == 0)
            {
                MessageBox.Show("La orden de Compra se encuentra vacia, por favor ingrese un material");
                return;
            }


            if (string.IsNullOrEmpty(txtNROFACTURA.Text))
            {
                MessageBox.Show("Debe ingresar un numero de orden");
                return;
            }
            if (string.IsNullOrEmpty(txtCLIENTE.Text))
            {
                MessageBox.Show("Debe seleccionar un cliente");
                return;
            }
            if (string.IsNullOrEmpty(dtpFECHA.Text))
            {
                MessageBox.Show("Debe ingresar una fecha");
                return;
            }



            oORDEN.nroFactura = txtNROFACTURA.Text;
            //oORDEN.Proveedor = oPROVEEDOR.razonSocial;
            oORDEN.Cliente = clientesovicj;

            //oORDEN.Proveedor =;
            //oORDEN.Proveedor = (MODELO.Proveedor)ToString();
            //oORDEN.Proveedor = txtPROVEEDOR.Text; /////////////////////////////////////////////////////////////////////////////////
            oORDEN.Fecha          = dtpFECHA.Value;
            oORDEN.IvaTotal       = Convert.ToDecimal(txtIVATOTAL.Text);
            oORDEN.Importe        = Convert.ToDecimal(totalivadesc);
            oORDEN.DescuentoTotal = Convert.ToDecimal(totaldescuento);
            //  oORDEN.CantidadesMat.Add(oCANTMAT);



            //foreach (MODELO.CantidadMat item in listaCantMateriales.ToList())
            //{


            //    MODELO.CantidadMat mat = new MODELO.CantidadMat();
            //    mat.Material = item.Material;
            //    mat.Cantidad_mat = item.Cantidad_mat;
            //    cCantMat.agregarCantMat(mat);
            //    listaCantMateriales.Add(mat);
            //    //oORDEN.CantidadesMat.Add(mat);



            //    // item.OrdenCompra.Add(oORDEN);
            //    // cCantMat.modificarCantMat(item);
            //    //oORDEN.CantidadesMat.Add(item);
            //    // cOrden.modificarOrden(oORDEN);


            //}
            oORDEN.visibily = true;



            MODELO.oCanmatVenta Occantmat = new MODELO.oCanmatVenta();
            foreach (MODELO.CantidadMat item in listaCantMateriales)
            {
                //int cantidadd = Convert.ToInt32(txtCANTIDAD.Text);
                oMATERIAL             = item.Material;
                Occantmat.cantidadmat = item;
                Occantmat.venta       = oORDEN;
                Occantmat.material    = item.Material.DESCRIPCION_CORTA;
                Occantmat.cantidadmat.cantidad_base_venta = item.cantidad_base_venta;

                oMATERIAL = (MODELO.Materiales)cMateriales.obtenerMaterialNombree(item.Material.DESCRIPCION_CORTA)[0];

                oMATERIAL.STOCK -= item.Cantidad_mat;
                cMateriales.modificarMateriales(oMATERIAL);

                cOccantmat.agregarOccantmatVenta(Occantmat);
            }

            //oMATERIAL.STOCK = oMATERIAL.STOCK - Convert.ToInt32(txtCANTIDAD.Text);



            this.DialogResult = DialogResult.OK;
            AGREGAR_AUDITORIA("Alta", oORDEN);
        }
Ejemplo n.º 3
0
 public void agregarOccantmatVenta(MODELO.oCanmatVenta oOccantmatVenta)
 {
     oMODELO_SEGURIDAD.OccantmatSVenta.Add(oOccantmatVenta);
     oMODELO_SEGURIDAD.SaveChanges();
 }