public CedEntidades.Flow WF_Flow_get(string IdFlow) { DataView dv = (DataView)Ejecutar("Select IdFlow, DescrFlow from WF_Flow where IdFlow='" + IdFlow + "'", TipoRetorno.DV, Transaccion.NoAcepta, sesion.CnnStr); CedEntidades.Flow flow = new CedEntidades.Flow(); if(dv.Table.Rows.Count > 0) { flow.IdFlow = Convert.ToString(dv.Table.Rows[0]["IdFlow"]); flow.DescrFlow = Convert.ToString(dv.Table.Rows[0]["DescrFlow"]); } return flow; }
public List<CedEntidades.Flow> WF_Flow_lst() { DataView dv = (DataView)Ejecutar("Select IdFlow as Id, DescrFlow as Descr from WF_Flow", TipoRetorno.DV, Transaccion.NoAcepta, sesion.CnnStr); List<CedEntidades.Flow> flows = new List<CedEntidades.Flow>(); for (int i = 0; i < dv.Table.Rows.Count; i++) { CedEntidades.Flow f = new CedEntidades.Flow(); f.IdFlow = Convert.ToString(dv.Table.Rows[i]["Id"]); f.DescrFlow = Convert.ToString(dv.Table.Rows[i]["Descr"]); flows.Add(f); } return flows; }
private void ConsultarLoteIFButton_Click(object sender, EventArgs e) { try { Cursor = System.Windows.Forms.Cursors.WaitCursor; NumeroLoteTextBox.ReadOnly = true; CuitVendedorTextBox.ReadOnly = true; PuntoVentaTextBox.ReadOnly = true; FeaEntidades.InterFacturas.lote_comprobantes Lc = new FeaEntidades.InterFacturas.lote_comprobantes(); eFact_RN.IBK.error[] respErroresLote = new eFact_RN.IBK.error[0]; eFact_RN.IBK.error[] respErroresComprobantes = new eFact_RN.IBK.error[0]; eFact_Entidades.Vendedor v = Aplicacion.Vendedores.Find(delegate(eFact_Entidades.Vendedor e1) { return e1.CuitVendedor == CuitVendedorTextBox.Text; }); if (v == null) { throw new Microsoft.ApplicationBlocks.ExceptionManagement.Vendedor.Inexistente("CUIT " + CuitVendedorTextBox.Text); } if (modoActual == Modo.Contingencia) { lote = new eFact_Entidades.Lote(); if (NumeroLoteTextBox.Text == "") { throw new Microsoft.ApplicationBlocks.ExceptionManagement.Validaciones.ValorNoInfo("Número de lote"); } if (!(Cedeira.SV.Fun.IsNumeric(NumeroLoteTextBox.Text))) { throw new Microsoft.ApplicationBlocks.ExceptionManagement.Validaciones.ValorInvalido("Número de lote"); } lote.NumeroLote = NumeroLoteTextBox.Text; if (CuitVendedorTextBox.Text == "") { throw new Microsoft.ApplicationBlocks.ExceptionManagement.Validaciones.ValorNoInfo("Cuit vendedor"); } if (!(Cedeira.SV.Fun.IsNumeric(CuitVendedorTextBox.Text))) { throw new Microsoft.ApplicationBlocks.ExceptionManagement.Validaciones.ValorInvalido("Cuit vendedor"); } lote.CuitVendedor = CuitVendedorTextBox.Text; if (PuntoVentaTextBox.Text == "") { throw new Microsoft.ApplicationBlocks.ExceptionManagement.Validaciones.ValorNoInfo("Punto de Venta"); } if (!(Cedeira.SV.Fun.IsNumeric(PuntoVentaTextBox.Text))) { throw new Microsoft.ApplicationBlocks.ExceptionManagement.Validaciones.ValorInvalido("Punto de Venta"); } lote.PuntoVenta = PuntoVentaTextBox.Text; eFact_RN.Lote.ConsultarLoteIF(out Lc, out respErroresLote, out respErroresComprobantes, lote, v.NumeroSerieCertificado.ToString()); //Verificar si existe en la base de datos como AceptadaAFIP eFact_Entidades.Lote loteAceptadoAFIP = new eFact_Entidades.Lote(); List<eFact_Entidades.Lote> lotes = new List<eFact_Entidades.Lote>(); eFact_RN.Lote.Consultar(out lotes, eFact_Entidades.Lote.TipoConsulta.SinAplicarFechas, DateTime.Today, DateTime.Today, CuitVendedorTextBox.Text, NumeroLoteTextBox.Text, PuntoVentaTextBox.Text, false, Aplicacion.Sesion); loteAceptadoAFIP = lotes.Find(delegate(eFact_Entidades.Lote e1) { return e1.IdEstado == "AceptadoAFIP" || e1.IdEstado == "AceptadoAFIPO" || e1.IdEstado == "AceptadoAFIPP"; }); if (loteAceptadoAFIP != null && loteAceptadoAFIP.IdOp != 0) { //Verificar si cambio el XML de respuesta string loteXml = ""; eFact_RN.Lote.SerializarLc(out loteXml, Lc); if (!(loteAceptadoAFIP.LoteXmlIF.Equals(loteXml))) { MessageBox.Show("El XML de respuesta actual, difiere del XML de respuesta obtenido en esta consulta. Si actualiza los datos, quedará registrado este último XML de respuesta.", "ATENCION", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } lote = loteAceptadoAFIP; lote.LoteXmlIF = loteXml; for (int i = 0; i < lote.Comprobantes.Count; i++) { if (Lc.comprobante[i].cabecera.informacion_comprobante.cae != null) { lote.Comprobantes[i].NumeroCAE = Lc.comprobante[i].cabecera.informacion_comprobante.cae; lote.Comprobantes[i].FechaCAE = eFact_RN.Archivo.ConvertirStringToDateTime(Lc.comprobante[i].cabecera.informacion_comprobante.fecha_obtencion_cae.Trim()); lote.Comprobantes[i].FechaVtoCAE = eFact_RN.Archivo.ConvertirStringToDateTime(Lc.comprobante[i].cabecera.informacion_comprobante.fecha_vencimiento_cae.Trim()); } lote.Comprobantes[i].EstadoIFoAFIP = Lc.comprobante[i].cabecera.informacion_comprobante.resultado; lote.Comprobantes[i].ComentarioIFoAFIP = Lc.comprobante[i].cabecera.informacion_comprobante.motivo; } } else { eFact_RN.Lote.Lc2Lote(out lote, Lc, Aplicacion.Aplic, Aplicacion.Sesion); eventoContingencia = new CedEntidades.Evento(); CedEntidades.Flow flow = new CedEntidades.Flow(); flow.IdFlow = "eFact"; eventoContingencia.Flow = flow; string resultado = ""; string resultadoTexto = ""; if (Lc.cabecera_lote.resultado != null && Lc.cabecera_lote.resultado.ToString().Trim() != "") { resultado = Lc.cabecera_lote.resultado.ToString(); resultadoTexto = "\r\nEl lote consultado se encuentra en estado: " + Lc.cabecera_lote.resultado.ToString(); } switch (resultado) { case "A": eventoContingencia.Id = "RegContAFIP"; break; case "O": eventoContingencia.Id = "RegContAFIPO"; break; case "P": eventoContingencia.Id = "RegContAFIPP"; break; default: throw new Microsoft.ApplicationBlocks.ExceptionManagement.Validaciones.Lote.EstadoNoPermitido("Solo es posible operar en contingencia con lotes Aceptados por AFIP." + resultadoTexto); } Cedeira.SV.WF.LeerEvento(eventoContingencia, Aplicacion.Sesion); lote.WF.EventosPosibles.Clear(); lote.WF.EventosPosibles.Add(eventoContingencia); } lote.WF.EsquemaSegEventosPosibles = Cedeira.SV.WF.EsquemaSegEventosPosibles(lote.WF); eFact_RN.Lote.MuestroEsquemaSegEventosPosibles(EsquemaSegEventosPosiblesTreeView, lote); BindingControles(); DetalleLoteDataGridView.AutoGenerateColumns = false; DetalleLoteDataGridView.DataSource = new List<eFact_Entidades.Comprobante>(); DetalleLoteDataGridView.DataSource = lote.Comprobantes; CancelarButton.Visible = true; ActualizarButton.Visible = true; ConsultarLoteIFButton.Enabled = false; } else { eFact_RN.Lote.ConsultarLoteIF(out Lc, out respErroresLote, out respErroresComprobantes, lote, v.NumeroSerieCertificado.ToString()); MessageBox.Show("Lote de comprobantes número " + lote.NumeroLote + " encontrado satisfactoriamente en Interfacturas.", "Consulta de Lotes", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Consulta de Lotes", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); if (modoActual == Modo.Contingencia) { Cancelar(); } } finally { Cursor = System.Windows.Forms.Cursors.Default; } }