/// <summary> /// Create a new DevolucionVenta object. /// </summary> /// <param name="idEmpresa">Initial value of the IdEmpresa property.</param> /// <param name="idUsuario">Initial value of the idUsuario property.</param> /// <param name="idNumeroDevolucion">Initial value of the IdNumeroDevolucion property.</param> /// <param name="idEstado">Initial value of the idEstado property.</param> public static DevolucionVenta CreateDevolucionVenta(global::System.Int32 idEmpresa, global::System.Int32 idUsuario, global::System.Int32 idNumeroDevolucion, global::System.Int32 idEstado) { DevolucionVenta devolucionVenta = new DevolucionVenta(); devolucionVenta.IdEmpresa = idEmpresa; devolucionVenta.idUsuario = idUsuario; devolucionVenta.IdNumeroDevolucion = idNumeroDevolucion; devolucionVenta.idEstado = idEstado; return devolucionVenta; }
/// <summary> /// Deprecated Method for adding a new object to the DevolucionVenta EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToDevolucionVenta(DevolucionVenta devolucionVenta) { base.AddObject("DevolucionVenta", devolucionVenta); }
private void btnGenerar_Click(object sender, EventArgs e) { try { if (this.txtNumeroFactura.Text == "") { MessageBox.Show("Ingrese Numero Factura.", "Modulo de Facturacion", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (this.txtcodarticulo.Text == "") { MessageBox.Show("Ingrese Numero Factura.", "Modulo de Facturacion", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (cmbestado.SelectedValue == "") { MessageBox.Show("Seleccione un Estado.", "Modulo de Facturacion", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (this.tbldetalle.Rows.Count == 0) { MessageBox.Show("Favor ingrese datos para su devolucion.", "Modulo de Facturacion", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DevolucionVenta obj = new DevolucionVenta(); // obj.cabecera_comprobante = Int32.Parse(txtNumeroDevolucion.Text); obj.IdNumeroDevolucion = Int32.Parse(txtNumeroDevolucion.Text); obj.IdNumeroFactura = Int32.Parse(txtNumeroFactura.Text); obj.Fecha = this.dtpFecha.Value; obj.IdEmpresa = Seguridad.empresa; obj.idUsuario = Seguridad.usuario; obj.idEstado = Int32.Parse(cmbestado.SelectedValue.ToString()); da.AddToDevolucionVenta(obj); int respuesta = da.SaveChanges(); if (respuesta > 0) { int i = 0; while (i < tbldetalle.Rows.Count) { DevolucionDet objdet = new DevolucionDet(); objdet.IdEmpresa = Seguridad.empresa; objdet.idUsuario = Seguridad.usuario; objdet.idEstado = Int32.Parse(cmbestado.SelectedValue.ToString()); objdet.Linea = i + 1; objdet.IdNumeroDevolucion = Int32.Parse(txtNumeroDevolucion.Text); objdet.IdArticulo = Int32.Parse(tbldetalle.Rows[i][0].ToString()); objdet.Observacion =(tbldetalle.Rows[i][2].ToString()); objdet.cantidad =Int32.Parse(tbldetalle.Rows[i][3].ToString()); da.AddToDevolucionDet (objdet); // Incrementar inventario da.SaveChanges(); i++; } MessageBox.Show("Registro Ingresado con exito.", "Modulo de Facturacion", MessageBoxButtons.OK, MessageBoxIcon.Information); //cargarpromociones(); ImprimirReporte(); limpiar(); } } catch (Exception ex) { MessageBox.Show("Ingrese Correctamente los valores. " + ex.Message, "Modulo de Facturacion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }